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

Unified Diff: base/memory/memory_pressure_monitor_chromeos_unittest.cc

Issue 2354333002: Remove calls to MessageLoop(ForUI|ForIO)::Run/RunUntilIdle. (Closed)
Patch Set: fix build error Created 4 years, 3 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 | « base/cancelable_callback.h ('k') | chrome/browser/chromeos/login/test/wizard_in_process_browser_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/memory_pressure_monitor_chromeos_unittest.cc
diff --git a/base/memory/memory_pressure_monitor_chromeos_unittest.cc b/base/memory/memory_pressure_monitor_chromeos_unittest.cc
index eb259eae20f85bf59ec6f8bfa037ea983acff26d..23b037cea6e0f71aca06a7fbb367e3fe892b3c5f 100644
--- a/base/memory/memory_pressure_monitor_chromeos_unittest.cc
+++ b/base/memory/memory_pressure_monitor_chromeos_unittest.cc
@@ -7,6 +7,7 @@
#include "base/macros.h"
#include "base/memory/memory_pressure_listener.h"
#include "base/message_loop/message_loop.h"
+#include "base/run_loop.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
@@ -84,7 +85,7 @@ TEST(ChromeOSMemoryPressureMonitorTest, CheckMemoryPressure) {
ResetOnMemoryPressureCalled();
monitor->CheckMemoryPressureForTest();
- message_loop.RunUntilIdle();
+ RunLoop().RunUntilIdle();
EXPECT_FALSE(WasOnMemoryPressureCalled());
EXPECT_EQ(MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE,
monitor->GetCurrentPressureLevel());
@@ -92,7 +93,7 @@ TEST(ChromeOSMemoryPressureMonitorTest, CheckMemoryPressure) {
// Setting the memory level to 80% should produce a moderate pressure level.
monitor->SetMemoryInPercentOverride(80);
monitor->CheckMemoryPressureForTest();
- message_loop.RunUntilIdle();
+ RunLoop().RunUntilIdle();
EXPECT_TRUE(WasOnMemoryPressureCalled());
EXPECT_EQ(MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE,
monitor->GetCurrentPressureLevel());
@@ -103,7 +104,7 @@ TEST(ChromeOSMemoryPressureMonitorTest, CheckMemoryPressure) {
int i = 0;
for (; i < 100; i++) {
monitor->CheckMemoryPressureForTest();
- message_loop.RunUntilIdle();
+ RunLoop().RunUntilIdle();
EXPECT_EQ(MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE,
monitor->GetCurrentPressureLevel());
if (WasOnMemoryPressureCalled()) {
@@ -119,7 +120,7 @@ TEST(ChromeOSMemoryPressureMonitorTest, CheckMemoryPressure) {
// Setting the memory usage to 99% should produce critical levels.
monitor->SetMemoryInPercentOverride(99);
monitor->CheckMemoryPressureForTest();
- message_loop.RunUntilIdle();
+ RunLoop().RunUntilIdle();
EXPECT_TRUE(WasOnMemoryPressureCalled());
EXPECT_EQ(MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL,
on_memory_pressure_level);
@@ -128,7 +129,7 @@ TEST(ChromeOSMemoryPressureMonitorTest, CheckMemoryPressure) {
// Calling it again should immediately produce a second call.
monitor->CheckMemoryPressureForTest();
- message_loop.RunUntilIdle();
+ RunLoop().RunUntilIdle();
EXPECT_TRUE(WasOnMemoryPressureCalled());
EXPECT_EQ(MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL,
on_memory_pressure_level);
@@ -139,7 +140,7 @@ TEST(ChromeOSMemoryPressureMonitorTest, CheckMemoryPressure) {
// pressure should go back to moderate.
monitor->SetMemoryInPercentOverride(80);
monitor->CheckMemoryPressureForTest();
- message_loop.RunUntilIdle();
+ RunLoop().RunUntilIdle();
EXPECT_FALSE(WasOnMemoryPressureCalled());
EXPECT_EQ(MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE,
monitor->GetCurrentPressureLevel());
@@ -149,7 +150,7 @@ TEST(ChromeOSMemoryPressureMonitorTest, CheckMemoryPressure) {
int j = 0;
for (; j < 100; j++) {
monitor->CheckMemoryPressureForTest();
- message_loop.RunUntilIdle();
+ RunLoop().RunUntilIdle();
EXPECT_EQ(MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE,
monitor->GetCurrentPressureLevel());
if (WasOnMemoryPressureCalled()) {
« no previous file with comments | « base/cancelable_callback.h ('k') | chrome/browser/chromeos/login/test/wizard_in_process_browser_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698