OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/system/dispatcher.h" | 5 #include "mojo/system/dispatcher.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
11 #include "base/threading/simple_thread.h" | 11 #include "base/threading/simple_thread.h" |
| 12 #include "mojo/embedder/platform_shared_buffer.h" |
12 #include "mojo/system/memory.h" | 13 #include "mojo/system/memory.h" |
13 #include "mojo/system/raw_shared_buffer.h" | |
14 #include "mojo/system/waiter.h" | 14 #include "mojo/system/waiter.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 | 16 |
17 namespace mojo { | 17 namespace mojo { |
18 namespace system { | 18 namespace system { |
19 namespace { | 19 namespace { |
20 | 20 |
21 // Trivial subclass that makes the constructor public. | 21 // Trivial subclass that makes the constructor public. |
22 class TrivialDispatcher : public Dispatcher { | 22 class TrivialDispatcher : public Dispatcher { |
23 public: | 23 public: |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, dispatcher_->EndReadData(0)); | 216 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, dispatcher_->EndReadData(0)); |
217 break; | 217 break; |
218 case DUPLICATE_BUFFER_HANDLE: { | 218 case DUPLICATE_BUFFER_HANDLE: { |
219 scoped_refptr<Dispatcher> unused; | 219 scoped_refptr<Dispatcher> unused; |
220 EXPECT_EQ( | 220 EXPECT_EQ( |
221 MOJO_RESULT_INVALID_ARGUMENT, | 221 MOJO_RESULT_INVALID_ARGUMENT, |
222 dispatcher_->DuplicateBufferHandle(NullUserPointer(), &unused)); | 222 dispatcher_->DuplicateBufferHandle(NullUserPointer(), &unused)); |
223 break; | 223 break; |
224 } | 224 } |
225 case MAP_BUFFER: { | 225 case MAP_BUFFER: { |
226 scoped_ptr<RawSharedBufferMapping> unused; | 226 scoped_ptr<embedder::PlatformSharedBufferMapping> unused; |
227 EXPECT_EQ( | 227 EXPECT_EQ( |
228 MOJO_RESULT_INVALID_ARGUMENT, | 228 MOJO_RESULT_INVALID_ARGUMENT, |
229 dispatcher_->MapBuffer(0u, 0u, MOJO_MAP_BUFFER_FLAG_NONE, &unused)); | 229 dispatcher_->MapBuffer(0u, 0u, MOJO_MAP_BUFFER_FLAG_NONE, &unused)); |
230 break; | 230 break; |
231 } | 231 } |
232 case ADD_WAITER: { | 232 case ADD_WAITER: { |
233 HandleSignalsState hss; | 233 HandleSignalsState hss; |
234 MojoResult r = | 234 MojoResult r = |
235 dispatcher_->AddWaiter(&waiter_, ~MOJO_HANDLE_SIGNAL_NONE, 0, &hss); | 235 dispatcher_->AddWaiter(&waiter_, ~MOJO_HANDLE_SIGNAL_NONE, 0, &hss); |
236 EXPECT_TRUE(r == MOJO_RESULT_FAILED_PRECONDITION || | 236 EXPECT_TRUE(r == MOJO_RESULT_FAILED_PRECONDITION || |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 event.Signal(); | 317 event.Signal(); |
318 } // Joins all the threads. | 318 } // Joins all the threads. |
319 | 319 |
320 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); | 320 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); |
321 } | 321 } |
322 } | 322 } |
323 | 323 |
324 } // namespace | 324 } // namespace |
325 } // namespace system | 325 } // namespace system |
326 } // namespace mojo | 326 } // namespace mojo |
OLD | NEW |