diff options
author | Hsin-Yi Chen <hsinyichen@google.com> | 2017-07-28 11:28:52 +0800 |
---|---|---|
committer | Haitao Shan <hshan@google.com> | 2017-08-08 15:20:09 -0700 |
commit | 7e04edd5b3f0ca9a2d8bca78d5ae70c09b623299 (patch) | |
tree | 1e33a29730604be3fa7716d695e694eacd480858 | |
parent | 72cce2f70a7b13b41f442b65ae80506a69415266 (diff) | |
download | native-7e04edd5b3f0ca9a2d8bca78d5ae70c09b623299.tar.gz |
Cast binder data type to uint64_t in high bits test
1. Cast fb->binder to uint64_t before shifting by 32 bits. It avoids
undefined result when binder is 32-bit.
2. Swap EXPECT_EQ arguments. The first one is expected value and the
second is actual value.
Bug: 64118463
Test: ./binderLibTest on x86 emulator
Change-Id: I4f736bd5b55db5af8598db0d5cd5fbd9ef323448
-rw-r--r-- | libs/binder/tests/binderLibTest.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libs/binder/tests/binderLibTest.cpp b/libs/binder/tests/binderLibTest.cpp index 757291cd2a..a04869ae62 100644 --- a/libs/binder/tests/binderLibTest.cpp +++ b/libs/binder/tests/binderLibTest.cpp @@ -681,10 +681,10 @@ TEST_F(BinderLibTest, CheckHandleZeroBinderHighBitsZeroCookie) { const flat_binder_object *fb = reply.readObject(false); ASSERT_TRUE(fb != NULL); - EXPECT_EQ(fb->type, BINDER_TYPE_HANDLE); - EXPECT_EQ(ProcessState::self()->getStrongProxyForHandle(fb->handle), m_server); - EXPECT_EQ(fb->cookie, (binder_uintptr_t)0); - EXPECT_EQ(fb->binder >> 32, (binder_uintptr_t)0); + EXPECT_EQ(BINDER_TYPE_HANDLE, fb->type); + EXPECT_EQ(m_server, ProcessState::self()->getStrongProxyForHandle(fb->handle)); + EXPECT_EQ((binder_uintptr_t)0, fb->cookie); + EXPECT_EQ((uint64_t)0, (uint64_t)fb->binder >> 32); } TEST_F(BinderLibTest, FreedBinder) { |