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

Unified Diff: base/message_loop/message_pump_libevent_unittest.cc

Issue 1452063005: Fixing base unittests impacted by Debug ASAN (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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/message_loop/message_pump_libevent.cc ('k') | base/security_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/message_pump_libevent_unittest.cc
diff --git a/base/message_loop/message_pump_libevent_unittest.cc b/base/message_loop/message_pump_libevent_unittest.cc
index 7d796dff8763cfee5ddc6f906b4d95bd1b1d8631..e911905abd7b489b47254a7195f6315701b422e9 100644
--- a/base/message_loop/message_pump_libevent_unittest.cc
+++ b/base/message_loop/message_pump_libevent_unittest.cc
@@ -77,8 +77,8 @@ class StupidWatcher : public MessagePumpLibevent::Watcher {
// Test to make sure that we catch calling WatchFileDescriptor off of the
// wrong thread.
-#if defined(OS_CHROMEOS)
-// Flaky on Chrome OS: crbug.com/138845.
+#if defined(OS_CHROMEOS) || defined(OS_LINUX)
+// Flaky on Chrome OS and Linux: crbug.com/138845.
#define MAYBE_TestWatchingFromBadThread DISABLED_TestWatchingFromBadThread
#else
#define MAYBE_TestWatchingFromBadThread TestWatchingFromBadThread
@@ -246,7 +246,7 @@ TEST_F(MessagePumpLibeventTest, QuitWatcher) {
MessagePumpLibevent::FileDescriptorWatcher controller;
QuitWatcher delegate(&controller, &run_loop);
WaitableEvent event(false /* manual_reset */, false /* initially_signaled */);
- WaitableEventWatcher watcher;
+ scoped_ptr<WaitableEventWatcher> watcher(new WaitableEventWatcher);
// Tell the pump to watch the pipe.
pump->WatchFileDescriptor(pipefds_[0], false, MessagePumpLibevent::WATCH_READ,
@@ -258,13 +258,17 @@ TEST_F(MessagePumpLibeventTest, QuitWatcher) {
Bind(&WriteFDWrapper, pipefds_[1], &buf, 1);
io_loop()->PostTask(FROM_HERE,
Bind(IgnoreResult(&WaitableEventWatcher::StartWatching),
- Unretained(&watcher), &event, write_fd_task));
+ Unretained(watcher.get()), &event, write_fd_task));
// Queue |event| to signal on |loop|.
loop.PostTask(FROM_HERE, Bind(&WaitableEvent::Signal, Unretained(&event)));
// Now run the MessageLoop.
run_loop.Run();
+
+ // StartWatching can move |watcher| to IO thread. Release on IO thread.
+ io_loop()->PostTask(FROM_HERE, Bind(&WaitableEventWatcher::StopWatching,
+ Owned(watcher.release())));
}
} // namespace
« no previous file with comments | « base/message_loop/message_pump_libevent.cc ('k') | base/security_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698