Index: base/memory/discardable_memory_unittest.cc |
diff --git a/base/memory/discardable_memory_unittest.cc b/base/memory/discardable_memory_unittest.cc |
index 516a96b5a4fa2576a6cb031877ddf7d7bff0cfac..dc0e2cd21262b4d7da8dd3edb891b91bb8f2d5b7 100644 |
--- a/base/memory/discardable_memory_unittest.cc |
+++ b/base/memory/discardable_memory_unittest.cc |
@@ -6,6 +6,7 @@ |
#include <algorithm> |
+#include "base/run_loop.h" |
#include "testing/gtest/include/gtest/gtest.h" |
#if defined(OS_ANDROID) |
@@ -18,8 +19,12 @@ |
class DiscardableMemoryTest |
: public testing::TestWithParam<DiscardableMemoryType> { |
public: |
- DiscardableMemoryTest() {} |
+ DiscardableMemoryTest() : message_loop_(MessageLoop::TYPE_IO) { |
+ // Register memory pressure listeners now that we have a message loop. |
+ DiscardableMemory::RegisterMemoryPressureListeners(); |
+ } |
virtual ~DiscardableMemoryTest() { |
+ DiscardableMemory::UnregisterMemoryPressureListeners(); |
} |
protected: |
@@ -27,6 +32,9 @@ |
return DiscardableMemory::CreateLockedMemoryWithType( |
GetParam(), size).Pass(); |
} |
+ |
+ private: |
+ MessageLoop message_loop_; |
}; |
const size_t kSize = 1024; |