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

Side by Side Diff: base/message_loop/message_loop_test.cc

Issue 1390513002: Remove base::MessageLoop::{Quit,QuitClosure} functions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Split into small CLs Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « base/message_loop/message_loop.h ('k') | base/message_loop/message_loop_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/message_loop/message_loop_test.h" 5 #include "base/message_loop/message_loop_test.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 &Foo::Test1ConstRef, foo.get(), a)); 97 &Foo::Test1ConstRef, foo.get(), a));
98 MessageLoop::current()->PostTask(FROM_HERE, Bind( 98 MessageLoop::current()->PostTask(FROM_HERE, Bind(
99 &Foo::Test1Ptr, foo.get(), &b)); 99 &Foo::Test1Ptr, foo.get(), &b));
100 MessageLoop::current()->PostTask(FROM_HERE, Bind( 100 MessageLoop::current()->PostTask(FROM_HERE, Bind(
101 &Foo::Test1Int, foo.get(), 100)); 101 &Foo::Test1Int, foo.get(), 100));
102 MessageLoop::current()->PostTask(FROM_HERE, Bind( 102 MessageLoop::current()->PostTask(FROM_HERE, Bind(
103 &Foo::Test2Ptr, foo.get(), &a, &c)); 103 &Foo::Test2Ptr, foo.get(), &a, &c));
104 MessageLoop::current()->PostTask(FROM_HERE, Bind( 104 MessageLoop::current()->PostTask(FROM_HERE, Bind(
105 &Foo::Test2Mixed, foo.get(), a, &d)); 105 &Foo::Test2Mixed, foo.get(), a, &d));
106 // After all tests, post a message that will shut down the message loop 106 // After all tests, post a message that will shut down the message loop
107 MessageLoop::current()->PostTask(FROM_HERE, Bind( 107 MessageLoop::current()->PostTask(
108 &MessageLoop::Quit, Unretained(MessageLoop::current()))); 108 FROM_HERE,
109 Bind(&MessageLoop::QuitWhenIdle, Unretained(MessageLoop::current())));
109 110
110 // Now kick things off 111 // Now kick things off
111 MessageLoop::current()->Run(); 112 MessageLoop::current()->Run();
112 113
113 EXPECT_EQ(foo->test_count(), 105); 114 EXPECT_EQ(foo->test_count(), 105);
114 EXPECT_EQ(foo->result(), "abacad"); 115 EXPECT_EQ(foo->result(), "abacad");
115 } 116 }
116 117
117 void RunTest_PostDelayedTask_Basic(MessagePumpFactory factory) { 118 void RunTest_PostDelayedTask_Basic(MessagePumpFactory factory) {
118 scoped_ptr<MessagePump> pump(factory()); 119 scoped_ptr<MessagePump> pump(factory());
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 void RunTest_RecursivePosts(MessagePumpFactory factory) { 1006 void RunTest_RecursivePosts(MessagePumpFactory factory) {
1006 const int kNumTimes = 1 << 17; 1007 const int kNumTimes = 1 << 17;
1007 scoped_ptr<MessagePump> pump(factory()); 1008 scoped_ptr<MessagePump> pump(factory());
1008 MessageLoop loop(pump.Pass()); 1009 MessageLoop loop(pump.Pass());
1009 loop.PostTask(FROM_HERE, Bind(&PostNTasksThenQuit, kNumTimes)); 1010 loop.PostTask(FROM_HERE, Bind(&PostNTasksThenQuit, kNumTimes));
1010 loop.Run(); 1011 loop.Run();
1011 } 1012 }
1012 1013
1013 } // namespace test 1014 } // namespace test
1014 } // namespace base 1015 } // namespace base
OLDNEW
« no previous file with comments | « base/message_loop/message_loop.h ('k') | base/message_loop/message_loop_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698