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

Unified Diff: base/observer_list_unittest.cc

Issue 12226007: base: Convert the remaining uses of MessageLoop::RunUntilIdle to RunLoop variant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win Created 7 years, 10 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/metrics/field_trial_unittest.cc ('k') | base/prefs/json_pref_store_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/observer_list_unittest.cc
diff --git a/base/observer_list_unittest.cc b/base/observer_list_unittest.cc
index 0a2a49d8ab4653f3f3895a4eb700e68613e37d3e..591d2307cec48f66949cebe1ab8b06fbcf3da713 100644
--- a/base/observer_list_unittest.cc
+++ b/base/observer_list_unittest.cc
@@ -10,12 +10,11 @@
#include "base/compiler_specific.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop.h"
+#include "base/run_loop.h"
#include "base/threading/platform_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
-using base::PlatformThread;
-using base::Time;
-
+namespace base {
namespace {
class Foo {
@@ -223,14 +222,14 @@ TEST(ObserverListThreadSafeTest, BasicTest) {
observer_list->AddObserver(&b);
observer_list->Notify(&Foo::Observe, 10);
- loop.RunUntilIdle();
+ RunLoop().RunUntilIdle();
observer_list->AddObserver(&evil);
observer_list->AddObserver(&c);
observer_list->AddObserver(&d);
observer_list->Notify(&Foo::Observe, 10);
- loop.RunUntilIdle();
+ RunLoop().RunUntilIdle();
EXPECT_EQ(20, a.total);
EXPECT_EQ(-20, b.total);
@@ -253,7 +252,7 @@ TEST(ObserverListThreadSafeTest, RemoveObserver) {
observer_list->RemoveObserver(&b);
observer_list->Notify(&Foo::Observe, 10);
- loop.RunUntilIdle();
+ RunLoop().RunUntilIdle();
EXPECT_EQ(0, a.total);
EXPECT_EQ(0, b.total);
@@ -264,7 +263,7 @@ TEST(ObserverListThreadSafeTest, RemoveObserver) {
observer_list->RemoveObserver(&b);
observer_list->Notify(&Foo::Observe, 10);
- loop.RunUntilIdle();
+ RunLoop().RunUntilIdle();
EXPECT_EQ(10, a.total);
EXPECT_EQ(0, b.total);
@@ -286,7 +285,7 @@ TEST(ObserverListThreadSafeTest, WithoutMessageLoop) {
observer_list->AddObserver(&c);
observer_list->Notify(&Foo::Observe, 10);
- loop.RunUntilIdle();
+ RunLoop().RunUntilIdle();
EXPECT_EQ(0, a.total);
EXPECT_EQ(0, b.total);
@@ -300,7 +299,7 @@ TEST(ObserverListThreadSafeTest, WithoutMessageLoop) {
// Notify again.
observer_list->Notify(&Foo::Observe, 20);
- loop.RunUntilIdle();
+ RunLoop().RunUntilIdle();
EXPECT_EQ(20, a.total);
EXPECT_EQ(0, b.total);
@@ -314,7 +313,7 @@ TEST(ObserverListThreadSafeTest, WithoutMessageLoop) {
MessageLoop loop;
observer_list->AddObserver(&b);
observer_list->Notify(&Foo::Observe, 30);
- loop.RunUntilIdle();
+ RunLoop().RunUntilIdle();
EXPECT_EQ(20, a.total);
EXPECT_EQ(30, b.total);
@@ -359,7 +358,7 @@ TEST(ObserverListThreadSafeTest, RemoveMultipleObservers) {
a.AddFooToRemove(&b);
observer_list->Notify(&Foo::Observe, 1);
- loop.RunUntilIdle();
+ RunLoop().RunUntilIdle();
}
// A test driver for a multi-threaded notification loop. Runs a number
@@ -399,7 +398,7 @@ static void ThreadSafeObserverHarness(int num_threads,
observer_list->Notify(&Foo::Observe, 10);
- loop.RunUntilIdle();
+ RunLoop().RunUntilIdle();
}
for (int index = 0; index < num_threads; index++) {
@@ -464,7 +463,7 @@ TEST(ObserverListThreadSafeTest, Existing) {
observer_list->AddObserver(&b);
observer_list->Notify(&Foo::Observe, 1);
- loop.RunUntilIdle();
+ RunLoop().RunUntilIdle();
EXPECT_TRUE(b.added);
// B's adder should not have been notified because it was added during
@@ -473,7 +472,7 @@ TEST(ObserverListThreadSafeTest, Existing) {
// Notify again to make sure b's adder is notified.
observer_list->Notify(&Foo::Observe, 1);
- loop.RunUntilIdle();
+ RunLoop().RunUntilIdle();
EXPECT_EQ(1, b.adder.total);
}
@@ -547,3 +546,4 @@ TEST(ObserverListTest, IteratorOutlivesList) {
}
} // namespace
+} // namespace base
« no previous file with comments | « base/metrics/field_trial_unittest.cc ('k') | base/prefs/json_pref_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698