summaryrefslogtreecommitdiffstats
path: root/base/waitable_event_watcher_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/waitable_event_watcher_unittest.cc')
-rw-r--r--base/waitable_event_watcher_unittest.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/base/waitable_event_watcher_unittest.cc b/base/waitable_event_watcher_unittest.cc
index 44b9b89..049de38 100644
--- a/base/waitable_event_watcher_unittest.cc
+++ b/base/waitable_event_watcher_unittest.cc
@@ -107,6 +107,22 @@ void RunTest_OutlivesMessageLoop(MessageLoop::Type message_loop_type) {
}
}
+void RunTest_DeleteUnder(MessageLoop::Type message_loop_type) {
+ // Delete the WaitableEvent out from under the Watcher. This is explictly
+ // allowed by the interface.
+
+ MessageLoop message_loop(message_loop_type);
+
+ {
+ WaitableEventWatcher watcher;
+
+ WaitableEvent* event = new WaitableEvent(false, false);
+ QuitDelegate delegate;
+ watcher.StartWatching(event, &delegate);
+ delete event;
+ }
+}
+
} // namespace
//-----------------------------------------------------------------------------
@@ -134,3 +150,9 @@ TEST(WaitableEventWatcherTest, OutlivesMessageLoop) {
RunTest_OutlivesMessageLoop(MessageLoop::TYPE_IO);
RunTest_OutlivesMessageLoop(MessageLoop::TYPE_UI);
}
+
+TEST(WaitableEventWatcherTest, DeleteUnder) {
+ RunTest_DeleteUnder(MessageLoop::TYPE_DEFAULT);
+ RunTest_DeleteUnder(MessageLoop::TYPE_IO);
+ RunTest_DeleteUnder(MessageLoop::TYPE_UI);
+}