| 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/bindings/callback.h" | 5 #include "mojo/public/cpp/bindings/callback.h" |
| 6 #include "mojo/public/cpp/environment/async_waiter.h" | 6 #include "mojo/public/cpp/environment/async_waiter.h" |
| 7 #include "mojo/public/cpp/test_support/test_utils.h" | 7 #include "mojo/public/cpp/test_support/test_utils.h" |
| 8 #include "mojo/public/cpp/utility/run_loop.h" | 8 #include "mojo/public/cpp/utility/run_loop.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 TestAsyncWaitCallback* callback_; | 44 TestAsyncWaitCallback* callback_; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 class AsyncWaiterTest : public testing::Test { | 47 class AsyncWaiterTest : public testing::Test { |
| 48 public: | 48 public: |
| 49 AsyncWaiterTest() {} | 49 AsyncWaiterTest() {} |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 Environment environment_; | |
| 53 RunLoop run_loop_; | 52 RunLoop run_loop_; |
| 54 | 53 |
| 55 MOJO_DISALLOW_COPY_AND_ASSIGN(AsyncWaiterTest); | 54 MOJO_DISALLOW_COPY_AND_ASSIGN(AsyncWaiterTest); |
| 56 }; | 55 }; |
| 57 | 56 |
| 58 // Verifies AsyncWaitCallback is notified when pipe is ready. | 57 // Verifies AsyncWaitCallback is notified when pipe is ready. |
| 59 TEST_F(AsyncWaiterTest, CallbackNotified) { | 58 TEST_F(AsyncWaiterTest, CallbackNotified) { |
| 60 TestAsyncWaitCallback callback; | 59 TestAsyncWaitCallback callback; |
| 61 MessagePipe test_pipe; | 60 MessagePipe test_pipe; |
| 62 EXPECT_TRUE(test::WriteTextMessage(test_pipe.handle1.get(), std::string())); | 61 EXPECT_TRUE(test::WriteTextMessage(test_pipe.handle1.get(), std::string())); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 { | 97 { |
| 99 AsyncWaiter waiter(test_pipe.handle0.get(), MOJO_HANDLE_SIGNAL_READABLE, | 98 AsyncWaiter waiter(test_pipe.handle0.get(), MOJO_HANDLE_SIGNAL_READABLE, |
| 100 ManualCallback(&callback)); | 99 ManualCallback(&callback)); |
| 101 } | 100 } |
| 102 RunLoop::current()->Run(); | 101 RunLoop::current()->Run(); |
| 103 EXPECT_EQ(0, callback.result_count()); | 102 EXPECT_EQ(0, callback.result_count()); |
| 104 } | 103 } |
| 105 | 104 |
| 106 } // namespace | 105 } // namespace |
| 107 } // namespace mojo | 106 } // namespace mojo |
| OLD | NEW |