diff options
author | darin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-24 20:42:35 +0000 |
---|---|---|
committer | darin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-24 20:42:35 +0000 |
commit | 05992b2a814db10d48e4deaeb9fea873e37bd329 (patch) | |
tree | 059ec037ad02e4143d1d858760b8c70b640685aa /base/object_watcher_unittest.cc | |
parent | 285c4d949ba2831ddfcca84fca818d4028654cd9 (diff) | |
download | chromium_src-05992b2a814db10d48e4deaeb9fea873e37bd329.zip chromium_src-05992b2a814db10d48e4deaeb9fea873e37bd329.tar.gz chromium_src-05992b2a814db10d48e4deaeb9fea873e37bd329.tar.bz2 |
Run ObjectWatcher unit tests against all types of message loops.
R=jar
Review URL: http://codereview.chromium.org/4245
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2570 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/object_watcher_unittest.cc')
-rw-r--r-- | base/object_watcher_unittest.cc | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/base/object_watcher_unittest.cc b/base/object_watcher_unittest.cc index d830dfc..3d2b068 100644 --- a/base/object_watcher_unittest.cc +++ b/base/object_watcher_unittest.cc @@ -10,8 +10,6 @@ namespace { -typedef testing::Test ObjectWatcherTest; - class QuitDelegate : public base::ObjectWatcher::Delegate { public: virtual void OnObjectSignaled(HANDLE object) { @@ -32,8 +30,8 @@ class DecrementCountDelegate : public base::ObjectWatcher::Delegate { } // namespace -TEST(ObjectWatcherTest, BasicSignal) { - MessageLoop message_loop; +void RunTest_BasicSignal(MessageLoop::Type message_loop_type) { + MessageLoop message_loop(message_loop_type); base::ObjectWatcher watcher; @@ -51,8 +49,8 @@ TEST(ObjectWatcherTest, BasicSignal) { CloseHandle(event); } -TEST(ObjectWatcherTest, BasicCancel) { - MessageLoop message_loop; +void RunTest_BasicCancel(MessageLoop::Type message_loop_type) { + MessageLoop message_loop(message_loop_type); base::ObjectWatcher watcher; @@ -69,8 +67,8 @@ TEST(ObjectWatcherTest, BasicCancel) { } -TEST(ObjectWatcherTest, CancelAfterSet) { - MessageLoop message_loop; +void RunTest_CancelAfterSet(MessageLoop::Type message_loop_type) { + MessageLoop message_loop(message_loop_type); base::ObjectWatcher watcher; @@ -98,7 +96,7 @@ TEST(ObjectWatcherTest, CancelAfterSet) { CloseHandle(event); } -TEST(ObjectWatcherTest, OutlivesMessageLoop) { +void RunTest_OutlivesMessageLoop(MessageLoop::Type message_loop_type) { // Simulate a MessageLoop that dies before an ObjectWatcher. This ordinarily // doesn't happen when people use the Thread class, but it can happen when // people use the Singleton pattern or atexit. @@ -106,7 +104,7 @@ TEST(ObjectWatcherTest, OutlivesMessageLoop) { { base::ObjectWatcher watcher; { - MessageLoop message_loop; + MessageLoop message_loop(message_loop_type); QuitDelegate delegate; watcher.StartWatching(event, &delegate); @@ -114,3 +112,29 @@ TEST(ObjectWatcherTest, OutlivesMessageLoop) { } CloseHandle(event); } + +//----------------------------------------------------------------------------- + +TEST(ObjectWatcherTest, BasicSignal) { + RunTest_BasicSignal(MessageLoop::TYPE_DEFAULT); + RunTest_BasicSignal(MessageLoop::TYPE_IO); + RunTest_BasicSignal(MessageLoop::TYPE_UI); +} + +TEST(ObjectWatcherTest, BasicCancel) { + RunTest_BasicCancel(MessageLoop::TYPE_DEFAULT); + RunTest_BasicCancel(MessageLoop::TYPE_IO); + RunTest_BasicCancel(MessageLoop::TYPE_UI); +} + +TEST(ObjectWatcherTest, CancelAfterSet) { + RunTest_CancelAfterSet(MessageLoop::TYPE_DEFAULT); + RunTest_CancelAfterSet(MessageLoop::TYPE_IO); + RunTest_CancelAfterSet(MessageLoop::TYPE_UI); +} + +TEST(ObjectWatcherTest, OutlivesMessageLoop) { + RunTest_OutlivesMessageLoop(MessageLoop::TYPE_DEFAULT); + RunTest_OutlivesMessageLoop(MessageLoop::TYPE_IO); + RunTest_OutlivesMessageLoop(MessageLoop::TYPE_UI); +} |