Loading libs/gui/tests/Android.bp +2 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,8 @@ cc_test { cppflags: [ "-Wall", "-Werror", "-Wno-extra", "-Wextra", "-Wthread-safety", "-DCOM_ANDROID_GRAPHICS_LIBGUI_FLAGS_BQ_SETFRAMERATE=true", ], Loading libs/gui/tests/BLASTBufferQueue_test.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ #define LOG_TAG "BLASTBufferQueue_test" #pragma clang diagnostic ignored "-Wsign-compare" #pragma clang diagnostic ignored "-Wthread-safety" #include <gui/BLASTBufferQueue.h> #include <android/hardware/graphics/common/1.2/types.h> Loading Loading @@ -476,7 +479,7 @@ TEST_F(BLASTBufferQueueTest, TripleBuffering) { ASSERT_EQ(OK, igbProducer->requestBuffer(slot, &buf)); allocated.push_back({slot, fence}); } for (int i = 0; i < allocated.size(); i++) { for (size_t i = 0; i < allocated.size(); i++) { igbProducer->cancelBuffer(allocated[i].first, allocated[i].second); } Loading libs/gui/tests/BufferQueue_test.cpp +3 −4 Original line number Diff line number Diff line Loading @@ -119,8 +119,7 @@ TEST_F(BufferQueueTest, DISABLED_BufferQueueInAnotherProcess) { } sp<IServiceManager> serviceManager = defaultServiceManager(); sp<IBinder> binderProducer = serviceManager->getService(PRODUCER_NAME); sp<IBinder> binderProducer = serviceManager->waitForService(PRODUCER_NAME); mProducer = interface_cast<IGraphicBufferProducer>(binderProducer); EXPECT_TRUE(mProducer != nullptr); sp<IBinder> binderConsumer = Loading Loading @@ -1114,7 +1113,7 @@ TEST_F(BufferQueueTest, TestDiscardFreeBuffers) { // Check onBuffersDiscarded is called with correct slots auto buffersDiscarded = pl->getDiscardedSlots(); ASSERT_EQ(buffersDiscarded.size(), 1); ASSERT_EQ(buffersDiscarded.size(), 1u); ASSERT_EQ(buffersDiscarded[0], releasedSlot); // Check no free buffers in dump Loading Loading @@ -1239,7 +1238,7 @@ TEST_F(BufferQueueTest, TestConsumerDetachProducerListener) { ASSERT_EQ(OK, mConsumer->detachBuffer(item.mSlot)); // Check whether the slot from IProducerListener is same to the detached slot. ASSERT_EQ(pl->getDetachedSlots().size(), 1); ASSERT_EQ(pl->getDetachedSlots().size(), 1u); ASSERT_EQ(pl->getDetachedSlots()[0], slots[1]); // Dequeue another buffer. Loading libs/gui/tests/DisplayedContentSampling_test.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -116,10 +116,10 @@ TEST_F(DisplayedContentSamplingTest, SampleCollectionCoherentWithSupportMask) { EXPECT_EQ(OK, status); if (stats.numFrames <= 0) return; if (componentMask & (0x1 << 0)) EXPECT_NE(0, stats.component_0_sample.size()); if (componentMask & (0x1 << 1)) EXPECT_NE(0, stats.component_1_sample.size()); if (componentMask & (0x1 << 2)) EXPECT_NE(0, stats.component_2_sample.size()); if (componentMask & (0x1 << 3)) EXPECT_NE(0, stats.component_3_sample.size()); if (componentMask & (0x1 << 0)) EXPECT_NE(0u, stats.component_0_sample.size()); if (componentMask & (0x1 << 1)) EXPECT_NE(0u, stats.component_1_sample.size()); if (componentMask & (0x1 << 2)) EXPECT_NE(0u, stats.component_2_sample.size()); if (componentMask & (0x1 << 3)) EXPECT_NE(0u, stats.component_3_sample.size()); } } // namespace android libs/gui/tests/EndToEndNativeInputTest.cpp +8 −6 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <memory> #include <android-base/thread_annotations.h> #include <android/gui/BnWindowInfosReportedListener.h> #include <android/keycodes.h> #include <android/native_window.h> Loading Loading @@ -78,21 +79,22 @@ static constexpr std::chrono::nanoseconds DISPATCHING_TIMEOUT = 5s; class SynchronousWindowInfosReportedListener : public gui::BnWindowInfosReportedListener { public: binder::Status onWindowInfosReported() override { std::lock_guard<std::mutex> lock{mMutex}; std::scoped_lock lock{mLock}; mWindowInfosReported = true; mConditionVariable.notify_one(); return binder::Status::ok(); } void wait() { std::unique_lock<std::mutex> lock{mMutex}; mConditionVariable.wait(lock, [&] { return mWindowInfosReported; }); std::unique_lock lock{mLock}; android::base::ScopedLockAssertion assumeLocked(mLock); mConditionVariable.wait(lock, [&]() REQUIRES(mLock) { return mWindowInfosReported; }); } private: std::mutex mMutex; std::mutex mLock; std::condition_variable mConditionVariable; bool mWindowInfosReported{false}; bool mWindowInfosReported GUARDED_BY(mLock){false}; }; class InputSurface { Loading Loading @@ -250,7 +252,7 @@ public: EXPECT_EQ(0, mev->getFlags() & VERIFIED_MOTION_EVENT_FLAGS); } void expectKey(uint32_t keycode) { void expectKey(int32_t keycode) { InputEvent *ev = consumeEvent(); ASSERT_NE(ev, nullptr); ASSERT_EQ(InputEventType::KEY, ev->getType()); Loading Loading
libs/gui/tests/Android.bp +2 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,8 @@ cc_test { cppflags: [ "-Wall", "-Werror", "-Wno-extra", "-Wextra", "-Wthread-safety", "-DCOM_ANDROID_GRAPHICS_LIBGUI_FLAGS_BQ_SETFRAMERATE=true", ], Loading
libs/gui/tests/BLASTBufferQueue_test.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ #define LOG_TAG "BLASTBufferQueue_test" #pragma clang diagnostic ignored "-Wsign-compare" #pragma clang diagnostic ignored "-Wthread-safety" #include <gui/BLASTBufferQueue.h> #include <android/hardware/graphics/common/1.2/types.h> Loading Loading @@ -476,7 +479,7 @@ TEST_F(BLASTBufferQueueTest, TripleBuffering) { ASSERT_EQ(OK, igbProducer->requestBuffer(slot, &buf)); allocated.push_back({slot, fence}); } for (int i = 0; i < allocated.size(); i++) { for (size_t i = 0; i < allocated.size(); i++) { igbProducer->cancelBuffer(allocated[i].first, allocated[i].second); } Loading
libs/gui/tests/BufferQueue_test.cpp +3 −4 Original line number Diff line number Diff line Loading @@ -119,8 +119,7 @@ TEST_F(BufferQueueTest, DISABLED_BufferQueueInAnotherProcess) { } sp<IServiceManager> serviceManager = defaultServiceManager(); sp<IBinder> binderProducer = serviceManager->getService(PRODUCER_NAME); sp<IBinder> binderProducer = serviceManager->waitForService(PRODUCER_NAME); mProducer = interface_cast<IGraphicBufferProducer>(binderProducer); EXPECT_TRUE(mProducer != nullptr); sp<IBinder> binderConsumer = Loading Loading @@ -1114,7 +1113,7 @@ TEST_F(BufferQueueTest, TestDiscardFreeBuffers) { // Check onBuffersDiscarded is called with correct slots auto buffersDiscarded = pl->getDiscardedSlots(); ASSERT_EQ(buffersDiscarded.size(), 1); ASSERT_EQ(buffersDiscarded.size(), 1u); ASSERT_EQ(buffersDiscarded[0], releasedSlot); // Check no free buffers in dump Loading Loading @@ -1239,7 +1238,7 @@ TEST_F(BufferQueueTest, TestConsumerDetachProducerListener) { ASSERT_EQ(OK, mConsumer->detachBuffer(item.mSlot)); // Check whether the slot from IProducerListener is same to the detached slot. ASSERT_EQ(pl->getDetachedSlots().size(), 1); ASSERT_EQ(pl->getDetachedSlots().size(), 1u); ASSERT_EQ(pl->getDetachedSlots()[0], slots[1]); // Dequeue another buffer. Loading
libs/gui/tests/DisplayedContentSampling_test.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -116,10 +116,10 @@ TEST_F(DisplayedContentSamplingTest, SampleCollectionCoherentWithSupportMask) { EXPECT_EQ(OK, status); if (stats.numFrames <= 0) return; if (componentMask & (0x1 << 0)) EXPECT_NE(0, stats.component_0_sample.size()); if (componentMask & (0x1 << 1)) EXPECT_NE(0, stats.component_1_sample.size()); if (componentMask & (0x1 << 2)) EXPECT_NE(0, stats.component_2_sample.size()); if (componentMask & (0x1 << 3)) EXPECT_NE(0, stats.component_3_sample.size()); if (componentMask & (0x1 << 0)) EXPECT_NE(0u, stats.component_0_sample.size()); if (componentMask & (0x1 << 1)) EXPECT_NE(0u, stats.component_1_sample.size()); if (componentMask & (0x1 << 2)) EXPECT_NE(0u, stats.component_2_sample.size()); if (componentMask & (0x1 << 3)) EXPECT_NE(0u, stats.component_3_sample.size()); } } // namespace android
libs/gui/tests/EndToEndNativeInputTest.cpp +8 −6 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <memory> #include <android-base/thread_annotations.h> #include <android/gui/BnWindowInfosReportedListener.h> #include <android/keycodes.h> #include <android/native_window.h> Loading Loading @@ -78,21 +79,22 @@ static constexpr std::chrono::nanoseconds DISPATCHING_TIMEOUT = 5s; class SynchronousWindowInfosReportedListener : public gui::BnWindowInfosReportedListener { public: binder::Status onWindowInfosReported() override { std::lock_guard<std::mutex> lock{mMutex}; std::scoped_lock lock{mLock}; mWindowInfosReported = true; mConditionVariable.notify_one(); return binder::Status::ok(); } void wait() { std::unique_lock<std::mutex> lock{mMutex}; mConditionVariable.wait(lock, [&] { return mWindowInfosReported; }); std::unique_lock lock{mLock}; android::base::ScopedLockAssertion assumeLocked(mLock); mConditionVariable.wait(lock, [&]() REQUIRES(mLock) { return mWindowInfosReported; }); } private: std::mutex mMutex; std::mutex mLock; std::condition_variable mConditionVariable; bool mWindowInfosReported{false}; bool mWindowInfosReported GUARDED_BY(mLock){false}; }; class InputSurface { Loading Loading @@ -250,7 +252,7 @@ public: EXPECT_EQ(0, mev->getFlags() & VERIFIED_MOTION_EVENT_FLAGS); } void expectKey(uint32_t keycode) { void expectKey(int32_t keycode) { InputEvent *ev = consumeEvent(); ASSERT_NE(ev, nullptr); ASSERT_EQ(InputEventType::KEY, ev->getType()); Loading