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

Unified Diff: base/synchronization/waitable_event_watcher_unittest.cc

Issue 10790028: Change explicit usage of each type of message loop in WaitableEventWatcher tests to instead loop th… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Merge Created 8 years, 5 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/base.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/synchronization/waitable_event_watcher_unittest.cc
diff --git a/base/synchronization/waitable_event_watcher_unittest.cc b/base/synchronization/waitable_event_watcher_unittest.cc
index c48333a2e8181c7dcaa4d995029acc5c404bf716..8fa4e7b242568efe4a226fb41f65159b21023252 100644
--- a/base/synchronization/waitable_event_watcher_unittest.cc
+++ b/base/synchronization/waitable_event_watcher_unittest.cc
@@ -12,6 +12,17 @@ namespace base {
namespace {
+// The message loops on which each waitable event timer should be tested.
+const MessageLoop::Type testing_message_loops[] = {
+ MessageLoop::TYPE_DEFAULT,
+ MessageLoop::TYPE_IO,
+#if !defined(OS_IOS) // iOS does not allow direct running of the UI loop.
+ MessageLoop::TYPE_UI,
+#endif
+};
+
+const int kNumTestingMessageLoops = arraysize(testing_message_loops);
+
class QuitDelegate : public WaitableEventWatcher::Delegate {
public:
virtual void OnWaitableEventSignaled(WaitableEvent* event) OVERRIDE {
@@ -127,27 +138,27 @@ void RunTest_DeleteUnder(MessageLoop::Type message_loop_type) {
//-----------------------------------------------------------------------------
TEST(WaitableEventWatcherTest, BasicSignal) {
- RunTest_BasicSignal(MessageLoop::TYPE_DEFAULT);
- RunTest_BasicSignal(MessageLoop::TYPE_IO);
- RunTest_BasicSignal(MessageLoop::TYPE_UI);
+ for (int i = 0; i < kNumTestingMessageLoops; i++) {
+ RunTest_BasicSignal(testing_message_loops[i]);
+ }
}
TEST(WaitableEventWatcherTest, BasicCancel) {
- RunTest_BasicCancel(MessageLoop::TYPE_DEFAULT);
- RunTest_BasicCancel(MessageLoop::TYPE_IO);
- RunTest_BasicCancel(MessageLoop::TYPE_UI);
+ for (int i = 0; i < kNumTestingMessageLoops; i++) {
+ RunTest_BasicCancel(testing_message_loops[i]);
+ }
}
TEST(WaitableEventWatcherTest, CancelAfterSet) {
- RunTest_CancelAfterSet(MessageLoop::TYPE_DEFAULT);
- RunTest_CancelAfterSet(MessageLoop::TYPE_IO);
- RunTest_CancelAfterSet(MessageLoop::TYPE_UI);
+ for (int i = 0; i < kNumTestingMessageLoops; i++) {
+ RunTest_CancelAfterSet(testing_message_loops[i]);
+ }
}
TEST(WaitableEventWatcherTest, OutlivesMessageLoop) {
- RunTest_OutlivesMessageLoop(MessageLoop::TYPE_DEFAULT);
- RunTest_OutlivesMessageLoop(MessageLoop::TYPE_IO);
- RunTest_OutlivesMessageLoop(MessageLoop::TYPE_UI);
+ for (int i = 0; i < kNumTestingMessageLoops; i++) {
+ RunTest_OutlivesMessageLoop(testing_message_loops[i]);
+ }
}
#if defined(OS_WIN)
@@ -157,9 +168,9 @@ TEST(WaitableEventWatcherTest, OutlivesMessageLoop) {
#define MAYBE_DeleteUnder DeleteUnder
#endif
TEST(WaitableEventWatcherTest, MAYBE_DeleteUnder) {
- RunTest_DeleteUnder(MessageLoop::TYPE_DEFAULT);
- RunTest_DeleteUnder(MessageLoop::TYPE_IO);
- RunTest_DeleteUnder(MessageLoop::TYPE_UI);
+ for (int i = 0; i < kNumTestingMessageLoops; i++) {
+ RunTest_DeleteUnder(testing_message_loops[i]);
+ }
}
} // namespace base
« no previous file with comments | « base/base.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698