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/environment/async_waiter.h> | 5 #include <mojo/environment/async_waiter.h> |
6 #include <mojo/result.h> | 6 #include <mojo/result.h> |
7 #include <mojo/system/time.h> | 7 #include <mojo/system/time.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
| 11 #include "gtest/gtest.h" |
11 #include "mojo/public/cpp/environment/environment.h" | 12 #include "mojo/public/cpp/environment/environment.h" |
12 #include "mojo/public/cpp/system/handle.h" | 13 #include "mojo/public/cpp/system/handle.h" |
13 #include "mojo/public/cpp/system/macros.h" | 14 #include "mojo/public/cpp/system/macros.h" |
14 #include "mojo/public/cpp/system/message_pipe.h" | 15 #include "mojo/public/cpp/system/message_pipe.h" |
15 #include "mojo/public/cpp/test_support/test_utils.h" | 16 #include "mojo/public/cpp/test_support/test_utils.h" |
16 #include "mojo/public/cpp/utility/run_loop.h" | 17 #include "mojo/public/cpp/utility/run_loop.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | |
18 | 18 |
19 namespace mojo { | 19 namespace mojo { |
20 namespace { | 20 namespace { |
21 | 21 |
22 class TestAsyncWaitCallback { | 22 class TestAsyncWaitCallback { |
23 public: | 23 public: |
24 TestAsyncWaitCallback() : result_count_(0), last_result_(MOJO_RESULT_OK) {} | 24 TestAsyncWaitCallback() : result_count_(0), last_result_(MOJO_RESULT_OK) {} |
25 ~TestAsyncWaitCallback() {} | 25 ~TestAsyncWaitCallback() {} |
26 | 26 |
27 int result_count() const { return result_count_; } | 27 int result_count() const { return result_count_; } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 EXPECT_TRUE(test::WriteTextMessage(test_pipe.handle1.get(), std::string())); | 108 EXPECT_TRUE(test::WriteTextMessage(test_pipe.handle1.get(), std::string())); |
109 | 109 |
110 CallCancelWait(CallAsyncWait( | 110 CallCancelWait(CallAsyncWait( |
111 test_pipe.handle0.get(), MOJO_HANDLE_SIGNAL_READABLE, &callback)); | 111 test_pipe.handle0.get(), MOJO_HANDLE_SIGNAL_READABLE, &callback)); |
112 RunLoop::current()->Run(); | 112 RunLoop::current()->Run(); |
113 EXPECT_EQ(0, callback.result_count()); | 113 EXPECT_EQ(0, callback.result_count()); |
114 } | 114 } |
115 | 115 |
116 } // namespace | 116 } // namespace |
117 } // namespace mojo | 117 } // namespace mojo |
OLD | NEW |