summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2022-06-10 22:04:44 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-06-10 22:04:44 +0000
commit93baab7e843c0e9681490479d5e82370e224b304 (patch)
tree364acafacef3b1c11c722759721722451803407a
parentce20f7fa151001d5d528c34243aa0114b31d15bc (diff)
parent34f8fc859a9ee567f5b6c84921e23f228dc79703 (diff)
downloadnative-93baab7e843c0e9681490479d5e82370e224b304.tar.gz
Merge "Fixed gpuservice_unittest mem leaks" am: 34f8fc859a
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2120130 Change-Id: I09a1640f746cf56ad5d14b1df587fc822974c70c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--services/gpuservice/tests/unittests/GpuStatsTest.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/services/gpuservice/tests/unittests/GpuStatsTest.cpp b/services/gpuservice/tests/unittests/GpuStatsTest.cpp
index 0baf1f93da..3c7644f369 100644
--- a/services/gpuservice/tests/unittests/GpuStatsTest.cpp
+++ b/services/gpuservice/tests/unittests/GpuStatsTest.cpp
@@ -25,6 +25,7 @@
#include <gtest/gtest.h>
#include <stats_pull_atom_callback.h>
#include <statslog.h>
+#include <utils/Looper.h>
#include <utils/String16.h>
#include <utils/Vector.h>
@@ -62,8 +63,9 @@ enum InputCommand : int32_t {
// clang-format on
class GpuStatsTest : public testing::Test {
+ sp<android::Looper> looper;
public:
- GpuStatsTest() {
+ GpuStatsTest() : looper(Looper::prepare(0 /* opts */)) {
const ::testing::TestInfo* const test_info =
::testing::UnitTest::GetInstance()->current_test_info();
ALOGD("**** Setting up for %s.%s\n", test_info->test_case_name(), test_info->name());
@@ -73,6 +75,10 @@ public:
const ::testing::TestInfo* const test_info =
::testing::UnitTest::GetInstance()->current_test_info();
ALOGD("**** Tearing down after %s.%s\n", test_info->test_case_name(), test_info->name());
+
+ // performs all pending callbacks until all data has been consumed
+ // gives time to process binder transactions by thread pool
+ looper->pollAll(1000);
}
std::string inputCommand(InputCommand cmd);