Add test for null native_handle_t*.

Test: hidl_test

Bug: 30814137
Change-Id: Ic52a4c588e2fde3859a0ae8c098e5cb60a87efe8
This commit is contained in:
Yifan Hong 2016-10-27 13:18:43 -07:00
parent b7307d5c8a
commit 688bb1e2c6
3 changed files with 9 additions and 0 deletions

View file

@ -17,6 +17,7 @@
package android.hardware.tests.bar@1.0;
import android.hardware.tests.foo@1.0::IFoo;
import android.hardware.tests.foo@1.0::Abc;
import android.hardware.tests.foo@1.0::Unrelated;
interface IBar extends android.hardware.tests.foo@1.0::IFoo {
@ -29,4 +30,5 @@ interface IBar extends android.hardware.tests.foo@1.0::IFoo {
};
thisIsNew();
expectNullHandle(handle h, Abc xyz) generates (bool hIsNull, bool xyzHasNull);
};

View file

@ -153,6 +153,12 @@ Return<void> Bar::thisIsNew() {
return Void();
}
Return<void> Bar::expectNullHandle(const native_handle_t* h, const Abc& xyz, expectNullHandle_cb _hidl_cb) {
ALOGI("SERVER(Bar) h = %p, xyz.z = %p", h, xyz.z);
_hidl_cb(h == nullptr, xyz.z == nullptr);
return Void();
}
IBar* HIDL_FETCH_IBar(const char* /* name */) {
return new Bar();
}

View file

@ -64,6 +64,7 @@ struct Bar : public IBar {
// Methods from ::android::hardware::tests::bar::V1_0::IBar follow.
Return<void> thisIsNew() override;
Return<void> expectNullHandle(const native_handle_t* h, const Abc& xyz, expectNullHandle_cb _hidl_cb) override;
private:
sp<IFoo> mFoo;