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

Side by Side Diff: base/synchronization/waitable_event_watcher_unittest.cc

Issue 11794032: base: Update the calls from MessageLoop::Quit() to QuitWhenIdle(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « base/message_pump_glib_unittest.cc ('k') | base/threading/thread.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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.h" 5 #include "base/message_loop.h"
6 #include "base/synchronization/waitable_event.h" 6 #include "base/synchronization/waitable_event.h"
7 #include "base/synchronization/waitable_event_watcher.h" 7 #include "base/synchronization/waitable_event_watcher.h"
8 #include "base/threading/platform_thread.h" 8 #include "base/threading/platform_thread.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace base { 11 namespace base {
12 12
13 namespace { 13 namespace {
14 14
15 // The message loops on which each waitable event timer should be tested. 15 // The message loops on which each waitable event timer should be tested.
16 const MessageLoop::Type testing_message_loops[] = { 16 const MessageLoop::Type testing_message_loops[] = {
17 MessageLoop::TYPE_DEFAULT, 17 MessageLoop::TYPE_DEFAULT,
18 MessageLoop::TYPE_IO, 18 MessageLoop::TYPE_IO,
19 #if !defined(OS_IOS) // iOS does not allow direct running of the UI loop. 19 #if !defined(OS_IOS) // iOS does not allow direct running of the UI loop.
20 MessageLoop::TYPE_UI, 20 MessageLoop::TYPE_UI,
21 #endif 21 #endif
22 }; 22 };
23 23
24 const int kNumTestingMessageLoops = arraysize(testing_message_loops); 24 const int kNumTestingMessageLoops = arraysize(testing_message_loops);
25 25
26 class QuitDelegate : public WaitableEventWatcher::Delegate { 26 class QuitDelegate : public WaitableEventWatcher::Delegate {
27 public: 27 public:
28 virtual void OnWaitableEventSignaled(WaitableEvent* event) OVERRIDE { 28 virtual void OnWaitableEventSignaled(WaitableEvent* event) OVERRIDE {
29 MessageLoop::current()->Quit(); 29 MessageLoop::current()->QuitWhenIdle();
30 } 30 }
31 }; 31 };
32 32
33 class DecrementCountDelegate : public WaitableEventWatcher::Delegate { 33 class DecrementCountDelegate : public WaitableEventWatcher::Delegate {
34 public: 34 public:
35 explicit DecrementCountDelegate(int* counter) : counter_(counter) { 35 explicit DecrementCountDelegate(int* counter) : counter_(counter) {
36 } 36 }
37 virtual void OnWaitableEventSignaled(WaitableEvent* object) OVERRIDE { 37 virtual void OnWaitableEventSignaled(WaitableEvent* object) OVERRIDE {
38 --(*counter_); 38 --(*counter_);
39 } 39 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 #else 167 #else
168 #define MAYBE_DeleteUnder DeleteUnder 168 #define MAYBE_DeleteUnder DeleteUnder
169 #endif 169 #endif
170 TEST(WaitableEventWatcherTest, MAYBE_DeleteUnder) { 170 TEST(WaitableEventWatcherTest, MAYBE_DeleteUnder) {
171 for (int i = 0; i < kNumTestingMessageLoops; i++) { 171 for (int i = 0; i < kNumTestingMessageLoops; i++) {
172 RunTest_DeleteUnder(testing_message_loops[i]); 172 RunTest_DeleteUnder(testing_message_loops[i]);
173 } 173 }
174 } 174 }
175 175
176 } // namespace base 176 } // namespace base
OLDNEW
« no previous file with comments | « base/message_pump_glib_unittest.cc ('k') | base/threading/thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698