diff options
Diffstat (limited to 'libs/binder/tests')
-rw-r--r-- | libs/binder/tests/binderParcelUnitTest.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libs/binder/tests/binderParcelUnitTest.cpp b/libs/binder/tests/binderParcelUnitTest.cpp index a71da3f384..c4b3299428 100644 --- a/libs/binder/tests/binderParcelUnitTest.cpp +++ b/libs/binder/tests/binderParcelUnitTest.cpp @@ -26,6 +26,7 @@ using android::IPCThreadState; using android::NO_ERROR; using android::OK; using android::Parcel; +using android::PERMISSION_DENIED; using android::sp; using android::status_t; using android::String16; @@ -356,6 +357,16 @@ TEST(Parcel, AppendWithFdPartial) { ASSERT_NE(-1, p1.readFileDescriptor()); } +TEST(Parcel, AppendOverObject) { + Parcel p1; + p1.writeDupFileDescriptor(0); + Parcel p2; + p2.writeInt32(2); + + p1.setDataPosition(8); + ASSERT_EQ(PERMISSION_DENIED, p1.appendFrom(&p2, 0, p2.dataSize())); +} + // Tests a second operation results in a parcel at the same location as it // started. void parcelOpSameLength(const std::function<void(Parcel*)>& a, const std::function<void(Parcel*)>& b) { |