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/basictypes.h" | 7 #include "base/basictypes.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/system/raw_shared_buffer.h" |
12 #include "mojo/system/waiter.h" | 13 #include "mojo/system/waiter.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 | 15 |
15 namespace mojo { | 16 namespace mojo { |
16 namespace system { | 17 namespace system { |
17 namespace { | 18 namespace { |
18 | 19 |
19 // Trivial subclass that makes the constructor public. | 20 // Trivial subclass that makes the constructor public. |
20 class TrivialDispatcher : public Dispatcher { | 21 class TrivialDispatcher : public Dispatcher { |
21 public: | 22 public: |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, | 177 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, |
177 dispatcher_->EndReadData(0)); | 178 dispatcher_->EndReadData(0)); |
178 break; | 179 break; |
179 case DUPLICATE_BUFFER_HANDLE: { | 180 case DUPLICATE_BUFFER_HANDLE: { |
180 scoped_refptr<Dispatcher> unused; | 181 scoped_refptr<Dispatcher> unused; |
181 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, | 182 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, |
182 dispatcher_->DuplicateBufferHandle(NULL, &unused)); | 183 dispatcher_->DuplicateBufferHandle(NULL, &unused)); |
183 break; | 184 break; |
184 } | 185 } |
185 case MAP_BUFFER: { | 186 case MAP_BUFFER: { |
186 scoped_ptr<RawSharedBuffer::Mapping> unused; | 187 scoped_ptr<RawSharedBufferMapping> unused; |
187 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, | 188 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, |
188 dispatcher_->MapBuffer(0u, 0u, MOJO_MAP_BUFFER_FLAG_NONE, | 189 dispatcher_->MapBuffer(0u, 0u, MOJO_MAP_BUFFER_FLAG_NONE, |
189 &unused)); | 190 &unused)); |
190 break; | 191 break; |
191 } | 192 } |
192 case ADD_WAITER: { | 193 case ADD_WAITER: { |
193 MojoResult r = dispatcher_->AddWaiter(&waiter_, | 194 MojoResult r = dispatcher_->AddWaiter(&waiter_, |
194 MOJO_WAIT_FLAG_EVERYTHING, 0); | 195 MOJO_WAIT_FLAG_EVERYTHING, 0); |
195 EXPECT_TRUE(r == MOJO_RESULT_FAILED_PRECONDITION || | 196 EXPECT_TRUE(r == MOJO_RESULT_FAILED_PRECONDITION || |
196 r == MOJO_RESULT_INVALID_ARGUMENT); | 197 r == MOJO_RESULT_INVALID_ARGUMENT); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 event.Signal(); // Kicks off real work on the threads. | 265 event.Signal(); // Kicks off real work on the threads. |
265 } // Joins all the threads. | 266 } // Joins all the threads. |
266 | 267 |
267 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); | 268 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); |
268 } | 269 } |
269 } | 270 } |
270 | 271 |
271 } // namespace | 272 } // namespace |
272 } // namespace system | 273 } // namespace system |
273 } // namespace mojo | 274 } // namespace mojo |
OLD | NEW |