| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/message_pump_libevent.h" | 5 #include "base/message_loop/message_pump_libevent.h" |
| 6 | 6 |
| 7 #include <unistd.h> | 7 #include <unistd.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 // base:MessagePumpLibevent::Watcher interface | 71 // base:MessagePumpLibevent::Watcher interface |
| 72 void OnFileCanReadWithoutBlocking(int fd) override {} | 72 void OnFileCanReadWithoutBlocking(int fd) override {} |
| 73 void OnFileCanWriteWithoutBlocking(int fd) override {} | 73 void OnFileCanWriteWithoutBlocking(int fd) override {} |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 #if GTEST_HAS_DEATH_TEST && !defined(NDEBUG) | 76 #if GTEST_HAS_DEATH_TEST && !defined(NDEBUG) |
| 77 | 77 |
| 78 // Test to make sure that we catch calling WatchFileDescriptor off of the | 78 // Test to make sure that we catch calling WatchFileDescriptor off of the |
| 79 // wrong thread. | 79 // wrong thread. |
| 80 TEST_F(MessagePumpLibeventTest, TestWatchingFromBadThread) { | 80 #if defined(OS_CHROMEOS) |
| 81 // Flaky on Chrome OS: crbug.com/138845. |
| 82 #define MAYBE_TestWatchingFromBadThread DISABLED_TestWatchingFromBadThread |
| 83 #else |
| 84 #define MAYBE_TestWatchingFromBadThread TestWatchingFromBadThread |
| 85 #endif |
| 86 TEST_F(MessagePumpLibeventTest, MAYBE_TestWatchingFromBadThread) { |
| 81 MessagePumpLibevent::FileDescriptorWatcher watcher; | 87 MessagePumpLibevent::FileDescriptorWatcher watcher; |
| 82 StupidWatcher delegate; | 88 StupidWatcher delegate; |
| 83 | 89 |
| 84 ASSERT_DEATH(io_loop()->WatchFileDescriptor( | 90 ASSERT_DEATH(io_loop()->WatchFileDescriptor( |
| 85 STDOUT_FILENO, false, MessageLoopForIO::WATCH_READ, &watcher, &delegate), | 91 STDOUT_FILENO, false, MessageLoopForIO::WATCH_READ, &watcher, &delegate), |
| 86 "Check failed: " | 92 "Check failed: " |
| 87 "watch_file_descriptor_caller_checker_.CalledOnValidThread\\(\\)"); | 93 "watch_file_descriptor_caller_checker_.CalledOnValidThread\\(\\)"); |
| 88 } | 94 } |
| 89 | 95 |
| 90 TEST_F(MessagePumpLibeventTest, QuitOutsideOfRun) { | 96 TEST_F(MessagePumpLibeventTest, QuitOutsideOfRun) { |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 // Queue |event| to signal on |loop|. | 263 // Queue |event| to signal on |loop|. |
| 258 loop.PostTask(FROM_HERE, Bind(&WaitableEvent::Signal, Unretained(&event))); | 264 loop.PostTask(FROM_HERE, Bind(&WaitableEvent::Signal, Unretained(&event))); |
| 259 | 265 |
| 260 // Now run the MessageLoop. | 266 // Now run the MessageLoop. |
| 261 run_loop.Run(); | 267 run_loop.Run(); |
| 262 } | 268 } |
| 263 | 269 |
| 264 } // namespace | 270 } // namespace |
| 265 | 271 |
| 266 } // namespace base | 272 } // namespace base |
| OLD | NEW |