summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2022-06-10 21:28:20 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2022-06-10 21:28:20 +0000
commit34f8fc859a9ee567f5b6c84921e23f228dc79703 (patch)
treeb4755e7935549e67db7fccb18dd627bd1cf319f2
parentece70230826f0f1e868c9a9d22c7cf9ca27de2c0 (diff)
parent01eeab93f38168153c42e8819221b5417aab79ab (diff)
downloadnative-34f8fc859a9ee567f5b6c84921e23f228dc79703.tar.gz
Merge "Fixed gpuservice_unittest mem leaks"
-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);