Chromium Code Reviews| Index: mojo/public/cpp/utility/tests/run_loop_unittest.cc |
| diff --git a/mojo/public/cpp/utility/tests/run_loop_unittest.cc b/mojo/public/cpp/utility/tests/run_loop_unittest.cc |
| index d9f754c66d3fde8245fbc03651a34a5a1829ff36..58d317ceccccb4173f4c045c3b265c41ec3f2cb0 100644 |
| --- a/mojo/public/cpp/utility/tests/run_loop_unittest.cc |
| +++ b/mojo/public/cpp/utility/tests/run_loop_unittest.cc |
| @@ -413,5 +413,25 @@ TEST_F(RunLoopTest, DelayedTaskOrder) { |
| EXPECT_EQ(3, sequence[2]); |
| } |
| +struct QuittingTask { |
| + QuittingTask(RunLoop* run_loop) : run_loop(run_loop) {} |
|
jamesr
2014/09/24 08:04:32
explicit
qsr
2014/09/24 09:14:15
Done.
|
| + |
| + void Run() const { run_loop->Quit(); } |
| + |
| + RunLoop* run_loop; |
| +}; |
| + |
| +TEST_F(RunLoopTest, QuitFromDelayedTask) { |
| + TestRunLoopHandler handler; |
| + MessagePipe test_pipe; |
| + RunLoop run_loop; |
| + run_loop.AddHandler(&handler, |
| + test_pipe.handle0.get(), |
| + MOJO_HANDLE_SIGNAL_READABLE, |
| + MOJO_DEADLINE_INDEFINITE); |
| + run_loop.PostDelayedTask(Closure(QuittingTask(&run_loop)), 0); |
| + run_loop.Run(); |
| +} |
| + |
| } // namespace |
| } // namespace mojo |