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 <string> | 5 #include <string> |
6 | 6 |
7 #include "mojo/public/cpp/environment/default_async_waiter.h" | 7 #include "mojo/public/cpp/environment/default_async_waiter.h" |
8 #include "mojo/public/cpp/environment/environment.h" | 8 #include "mojo/public/cpp/environment/environment.h" |
9 #include "mojo/public/cpp/system/core.h" | 9 #include "mojo/public/cpp/system/core.h" |
10 #include "mojo/public/cpp/system/macros.h" | 10 #include "mojo/public/cpp/system/macros.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 } | 33 } |
34 | 34 |
35 private: | 35 private: |
36 int result_count_; | 36 int result_count_; |
37 MojoResult last_result_; | 37 MojoResult last_result_; |
38 | 38 |
39 MOJO_DISALLOW_COPY_AND_ASSIGN(TestAsyncWaitCallback); | 39 MOJO_DISALLOW_COPY_AND_ASSIGN(TestAsyncWaitCallback); |
40 }; | 40 }; |
41 | 41 |
42 MojoAsyncWaitID CallAsyncWait(const Handle& handle, | 42 MojoAsyncWaitID CallAsyncWait(const Handle& handle, |
43 MojoWaitFlags flags, | 43 MojoHandleSignals signals, |
44 TestAsyncWaitCallback* callback) { | 44 TestAsyncWaitCallback* callback) { |
45 return GetDefaultAsyncWaiter()->AsyncWait( | 45 return GetDefaultAsyncWaiter()->AsyncWait( |
46 handle.value(), | 46 handle.value(), |
47 flags, | 47 signals, |
48 MOJO_DEADLINE_INDEFINITE, | 48 MOJO_DEADLINE_INDEFINITE, |
49 &TestAsyncWaitCallback::OnHandleReady, | 49 &TestAsyncWaitCallback::OnHandleReady, |
50 callback); | 50 callback); |
51 } | 51 } |
52 | 52 |
53 void CallCancelWait(MojoAsyncWaitID wait_id) { | 53 void CallCancelWait(MojoAsyncWaitID wait_id) { |
54 GetDefaultAsyncWaiter()->CancelWait(wait_id); | 54 GetDefaultAsyncWaiter()->CancelWait(wait_id); |
55 } | 55 } |
56 | 56 |
57 class AsyncWaiterTest : public testing::Test { | 57 class AsyncWaiterTest : public testing::Test { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 CallCancelWait( | 107 CallCancelWait( |
108 CallAsyncWait(test_pipe.handle0.get(), | 108 CallAsyncWait(test_pipe.handle0.get(), |
109 MOJO_WAIT_FLAG_READABLE, | 109 MOJO_WAIT_FLAG_READABLE, |
110 &callback)); | 110 &callback)); |
111 RunLoop::current()->Run(); | 111 RunLoop::current()->Run(); |
112 EXPECT_EQ(0, callback.result_count()); | 112 EXPECT_EQ(0, callback.result_count()); |
113 } | 113 } |
114 | 114 |
115 } // namespace | 115 } // namespace |
116 } // namespace mojo | 116 } // namespace mojo |
OLD | NEW |