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

Side by Side Diff: base/waitable_event_watcher_unittest.cc

Issue 18291: Windows scons fix: more functions static and scons file fix (Closed)
Patch Set: Created 11 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
« no previous file with comments | « base/base_lib.scons ('k') | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/platform_thread.h" 6 #include "base/platform_thread.h"
7 #include "base/waitable_event.h" 7 #include "base/waitable_event.h"
8 #include "base/waitable_event_watcher.h" 8 #include "base/waitable_event_watcher.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 13 matching lines...) Expand all
24 public: 24 public:
25 DecrementCountDelegate(int* counter) : counter_(counter) { 25 DecrementCountDelegate(int* counter) : counter_(counter) {
26 } 26 }
27 virtual void OnWaitableEventSignaled(WaitableEvent* object) { 27 virtual void OnWaitableEventSignaled(WaitableEvent* object) {
28 --(*counter_); 28 --(*counter_);
29 } 29 }
30 private: 30 private:
31 int* counter_; 31 int* counter_;
32 }; 32 };
33 33
34 } // namespace
35
36 void RunTest_BasicSignal(MessageLoop::Type message_loop_type) { 34 void RunTest_BasicSignal(MessageLoop::Type message_loop_type) {
37 MessageLoop message_loop(message_loop_type); 35 MessageLoop message_loop(message_loop_type);
38 36
39 // A manual-reset event that is not yet signaled. 37 // A manual-reset event that is not yet signaled.
40 WaitableEvent event(true, false); 38 WaitableEvent event(true, false);
41 39
42 WaitableEventWatcher watcher; 40 WaitableEventWatcher watcher;
43 EXPECT_EQ(NULL, watcher.GetWatchedEvent()); 41 EXPECT_EQ(NULL, watcher.GetWatchedEvent());
44 42
45 QuitDelegate delegate; 43 QuitDelegate delegate;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 WaitableEventWatcher watcher; 100 WaitableEventWatcher watcher;
103 { 101 {
104 MessageLoop message_loop(message_loop_type); 102 MessageLoop message_loop(message_loop_type);
105 103
106 QuitDelegate delegate; 104 QuitDelegate delegate;
107 watcher.StartWatching(&event, &delegate); 105 watcher.StartWatching(&event, &delegate);
108 } 106 }
109 } 107 }
110 } 108 }
111 109
110 } // namespace
111
112 //----------------------------------------------------------------------------- 112 //-----------------------------------------------------------------------------
113 113
114 TEST(WaitableEventWatcherTest, BasicSignal) { 114 TEST(WaitableEventWatcherTest, BasicSignal) {
115 RunTest_BasicSignal(MessageLoop::TYPE_DEFAULT); 115 RunTest_BasicSignal(MessageLoop::TYPE_DEFAULT);
116 RunTest_BasicSignal(MessageLoop::TYPE_IO); 116 RunTest_BasicSignal(MessageLoop::TYPE_IO);
117 RunTest_BasicSignal(MessageLoop::TYPE_UI); 117 RunTest_BasicSignal(MessageLoop::TYPE_UI);
118 } 118 }
119 119
120 TEST(WaitableEventWatcherTest, BasicCancel) { 120 TEST(WaitableEventWatcherTest, BasicCancel) {
121 RunTest_BasicCancel(MessageLoop::TYPE_DEFAULT); 121 RunTest_BasicCancel(MessageLoop::TYPE_DEFAULT);
122 RunTest_BasicCancel(MessageLoop::TYPE_IO); 122 RunTest_BasicCancel(MessageLoop::TYPE_IO);
123 RunTest_BasicCancel(MessageLoop::TYPE_UI); 123 RunTest_BasicCancel(MessageLoop::TYPE_UI);
124 } 124 }
125 125
126 TEST(WaitableEventWatcherTest, CancelAfterSet) { 126 TEST(WaitableEventWatcherTest, CancelAfterSet) {
127 RunTest_CancelAfterSet(MessageLoop::TYPE_DEFAULT); 127 RunTest_CancelAfterSet(MessageLoop::TYPE_DEFAULT);
128 RunTest_CancelAfterSet(MessageLoop::TYPE_IO); 128 RunTest_CancelAfterSet(MessageLoop::TYPE_IO);
129 RunTest_CancelAfterSet(MessageLoop::TYPE_UI); 129 RunTest_CancelAfterSet(MessageLoop::TYPE_UI);
130 } 130 }
131 131
132 TEST(WaitableEventWatcherTest, OutlivesMessageLoop) { 132 TEST(WaitableEventWatcherTest, OutlivesMessageLoop) {
133 RunTest_OutlivesMessageLoop(MessageLoop::TYPE_DEFAULT); 133 RunTest_OutlivesMessageLoop(MessageLoop::TYPE_DEFAULT);
134 RunTest_OutlivesMessageLoop(MessageLoop::TYPE_IO); 134 RunTest_OutlivesMessageLoop(MessageLoop::TYPE_IO);
135 RunTest_OutlivesMessageLoop(MessageLoop::TYPE_UI); 135 RunTest_OutlivesMessageLoop(MessageLoop::TYPE_UI);
136 } 136 }
OLDNEW
« no previous file with comments | « base/base_lib.scons ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698