Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Unified Diff: components/memory_coordinator/child/child_memory_coordinator_impl_unittest.cc

Issue 2259743002: Add MemoryStateListenerAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: native Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/memory_coordinator/child/child_memory_coordinator_impl_android.cc ('k') | content/app/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/memory_coordinator/child/child_memory_coordinator_impl_unittest.cc
diff --git a/components/memory_coordinator/child/child_memory_coordinator_impl_unittest.cc b/components/memory_coordinator/child/child_memory_coordinator_impl_unittest.cc
index d01bd02c74e1821fbc2a2b6c89deb5f570ccf23b..724c0cdf4282a603ae26e2f09d9e5d8bd00241d7 100644
--- a/components/memory_coordinator/child/child_memory_coordinator_impl_unittest.cc
+++ b/components/memory_coordinator/child/child_memory_coordinator_impl_unittest.cc
@@ -5,6 +5,9 @@
#include "components/memory_coordinator/child/child_memory_coordinator_impl.h"
#if defined(OS_ANDROID)
+#include "base/android/jni_android.h"
+#include "components/memory_coordinator/android/component_jni_registrar.h"
+#include "components/memory_coordinator/android/memory_state_listener_android.h"
#include "components/memory_coordinator/child/child_memory_coordinator_impl_android.h"
#endif // defined(OS_ANDROID)
@@ -43,6 +46,9 @@ class ChildMemoryCoordinatorImplTest : public testing::Test,
ChildMemoryCoordinatorImplTest()
: message_loop_(new base::MessageLoop) {
auto parent = coordinator_handle_.Bind();
+#if defined(OS_ANDROID)
+ android::RegisterJni(base::android::AttachCurrentThread());
+#endif
coordinator_impl_ = CreateChildMemoryCoordinator(std::move(parent), this);
// Needs to run loop to initalize mojo pointers including |child_| in
// MockMemoryCoordinatorHandle.
@@ -179,7 +185,7 @@ TEST_F(ChildMemoryCoordinatorImplTest, OnTrimMemoryImmediately) {
ChildMemoryCoordinatorImplAndroid& coordinator_android =
static_cast<ChildMemoryCoordinatorImplAndroid&>(coordinator_impl());
- coordinator_android.OnTrimMemory(kTrimMemoryComplete);
+ MemoryStateListenerAndroid::SimulateOnTrimMemory(kTrimMemoryComplete);
EXPECT_EQ(true, on_trim_memory_called_);
}
#endif // defined(OS_ANDROID)
« no previous file with comments | « components/memory_coordinator/child/child_memory_coordinator_impl_android.cc ('k') | content/app/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698