Loading libs/binder/ndk/tests/libbinder_ndk_unit_test.cpp +9 −3 Original line number Diff line number Diff line Loading @@ -377,18 +377,24 @@ TEST(NdkBinder, CantHaveTwoLocalBinderClassesWithSameDescriptor) { } TEST(NdkBinder, GetTestServiceStressTest) { // libbinder has some complicated logic to make sure only one instance of // ABpBinder is associated with each binder. constexpr size_t kNumThreads = 10; constexpr size_t kNumCalls = 1000; std::vector<std::thread> threads; // this is not a lazy service, but we must make sure that it's started before calling // checkService on it, since the other process serving it might not be started yet. { // getService, not waitForService, to take advantage of timeout auto binder = ndk::SpAIBinder(AServiceManager_getService(IFoo::kSomeInstanceName)); ASSERT_NE(nullptr, binder.get()); } for (size_t i = 0; i < kNumThreads; i++) { threads.push_back(std::thread([&]() { for (size_t j = 0; j < kNumCalls; j++) { auto binder = ndk::SpAIBinder(AServiceManager_checkService(IFoo::kSomeInstanceName)); ASSERT_NE(nullptr, binder.get()); EXPECT_EQ(STATUS_OK, AIBinder_ping(binder.get())); } })); Loading Loading
libs/binder/ndk/tests/libbinder_ndk_unit_test.cpp +9 −3 Original line number Diff line number Diff line Loading @@ -377,18 +377,24 @@ TEST(NdkBinder, CantHaveTwoLocalBinderClassesWithSameDescriptor) { } TEST(NdkBinder, GetTestServiceStressTest) { // libbinder has some complicated logic to make sure only one instance of // ABpBinder is associated with each binder. constexpr size_t kNumThreads = 10; constexpr size_t kNumCalls = 1000; std::vector<std::thread> threads; // this is not a lazy service, but we must make sure that it's started before calling // checkService on it, since the other process serving it might not be started yet. { // getService, not waitForService, to take advantage of timeout auto binder = ndk::SpAIBinder(AServiceManager_getService(IFoo::kSomeInstanceName)); ASSERT_NE(nullptr, binder.get()); } for (size_t i = 0; i < kNumThreads; i++) { threads.push_back(std::thread([&]() { for (size_t j = 0; j < kNumCalls; j++) { auto binder = ndk::SpAIBinder(AServiceManager_checkService(IFoo::kSomeInstanceName)); ASSERT_NE(nullptr, binder.get()); EXPECT_EQ(STATUS_OK, AIBinder_ping(binder.get())); } })); Loading