OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/public/cpp/utility/run_loop.h" | 5 #include "mojo/public/cpp/utility/run_loop.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "mojo/public/cpp/system/core.h" | 9 #include "mojo/public/cpp/system/core.h" |
10 #include "mojo/public/cpp/test_support/test_utils.h" | 10 #include "mojo/public/cpp/test_support/test_utils.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 int error_count_; | 43 int error_count_; |
44 MojoResult last_error_result_; | 44 MojoResult last_error_result_; |
45 | 45 |
46 MOJO_DISALLOW_COPY_AND_ASSIGN(TestRunLoopHandler); | 46 MOJO_DISALLOW_COPY_AND_ASSIGN(TestRunLoopHandler); |
47 }; | 47 }; |
48 | 48 |
49 class RunLoopTest : public testing::Test { | 49 class RunLoopTest : public testing::Test { |
50 public: | 50 public: |
51 RunLoopTest() {} | 51 RunLoopTest() {} |
52 | 52 |
53 virtual void SetUp() override { | 53 void SetUp() override { |
54 Test::SetUp(); | 54 Test::SetUp(); |
55 RunLoop::SetUp(); | 55 RunLoop::SetUp(); |
56 } | 56 } |
57 virtual void TearDown() override { | 57 void TearDown() override { |
58 RunLoop::TearDown(); | 58 RunLoop::TearDown(); |
59 Test::TearDown(); | 59 Test::TearDown(); |
60 } | 60 } |
61 | 61 |
62 private: | 62 private: |
63 MOJO_DISALLOW_COPY_AND_ASSIGN(RunLoopTest); | 63 MOJO_DISALLOW_COPY_AND_ASSIGN(RunLoopTest); |
64 }; | 64 }; |
65 | 65 |
66 // Trivial test to verify Run() with no added handles returns. | 66 // Trivial test to verify Run() with no added handles returns. |
67 TEST_F(RunLoopTest, ExitsWithNoHandles) { | 67 TEST_F(RunLoopTest, ExitsWithNoHandles) { |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 run_loop.AddHandler(&handler, | 422 run_loop.AddHandler(&handler, |
423 test_pipe.handle0.get(), | 423 test_pipe.handle0.get(), |
424 MOJO_HANDLE_SIGNAL_READABLE, | 424 MOJO_HANDLE_SIGNAL_READABLE, |
425 MOJO_DEADLINE_INDEFINITE); | 425 MOJO_DEADLINE_INDEFINITE); |
426 run_loop.PostDelayedTask(Closure(QuittingTask(&run_loop)), 0); | 426 run_loop.PostDelayedTask(Closure(QuittingTask(&run_loop)), 0); |
427 run_loop.Run(); | 427 run_loop.Run(); |
428 } | 428 } |
429 | 429 |
430 } // namespace | 430 } // namespace |
431 } // namespace mojo | 431 } // namespace mojo |
OLD | NEW |