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/edk/system/core_test_base.h" | 5 #include "mojo/edk/system/core_test_base.h" |
6 | 6 |
| 7 #include <utility> |
7 #include <vector> | 8 #include <vector> |
8 | 9 |
9 #include "base/logging.h" | 10 #include "base/logging.h" |
10 #include "mojo/edk/embedder/simple_platform_support.h" | 11 #include "mojo/edk/embedder/simple_platform_support.h" |
11 #include "mojo/edk/system/configuration.h" | 12 #include "mojo/edk/system/configuration.h" |
12 #include "mojo/edk/system/core.h" | 13 #include "mojo/edk/system/core.h" |
13 #include "mojo/edk/system/dispatcher.h" | 14 #include "mojo/edk/system/dispatcher.h" |
| 15 #include "mojo/edk/system/handle.h" |
14 #include "mojo/edk/system/memory.h" | 16 #include "mojo/edk/system/memory.h" |
15 #include "mojo/edk/util/ref_ptr.h" | 17 #include "mojo/edk/util/ref_ptr.h" |
16 #include "mojo/public/cpp/system/macros.h" | 18 #include "mojo/public/cpp/system/macros.h" |
17 | 19 |
18 using mojo::util::MutexLocker; | 20 using mojo::util::MutexLocker; |
19 using mojo::util::RefPtr; | 21 using mojo::util::RefPtr; |
20 | 22 |
21 namespace mojo { | 23 namespace mojo { |
22 namespace system { | 24 namespace system { |
23 namespace test { | 25 namespace test { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 } | 219 } |
218 | 220 |
219 void CoreTestBase::TearDown() { | 221 void CoreTestBase::TearDown() { |
220 CHECK(core_); | 222 CHECK(core_); |
221 core_.reset(); | 223 core_.reset(); |
222 } | 224 } |
223 | 225 |
224 MojoHandle CoreTestBase::CreateMockHandle(CoreTestBase::MockHandleInfo* info) { | 226 MojoHandle CoreTestBase::CreateMockHandle(CoreTestBase::MockHandleInfo* info) { |
225 CHECK(core_); | 227 CHECK(core_); |
226 auto dispatcher = MockDispatcher::Create(info); | 228 auto dispatcher = MockDispatcher::Create(info); |
227 MojoHandle rv = core_->AddDispatcher(dispatcher.get()); | 229 MojoHandle rv = core_->AddHandle( |
| 230 Handle(std::move(dispatcher), |
| 231 MOJO_HANDLE_RIGHT_DUPLICATE | MOJO_HANDLE_RIGHT_TRANSFER | |
| 232 MOJO_HANDLE_RIGHT_READ | MOJO_HANDLE_RIGHT_WRITE | |
| 233 MOJO_HANDLE_RIGHT_EXECUTE)); |
228 CHECK_NE(rv, MOJO_HANDLE_INVALID); | 234 CHECK_NE(rv, MOJO_HANDLE_INVALID); |
229 return rv; | 235 return rv; |
230 } | 236 } |
231 | 237 |
232 // CoreTestBase_MockHandleInfo ------------------------------------------------- | 238 // CoreTestBase_MockHandleInfo ------------------------------------------------- |
233 | 239 |
234 CoreTestBase_MockHandleInfo::CoreTestBase_MockHandleInfo() {} | 240 CoreTestBase_MockHandleInfo::CoreTestBase_MockHandleInfo() {} |
235 | 241 |
236 CoreTestBase_MockHandleInfo::~CoreTestBase_MockHandleInfo() {} | 242 CoreTestBase_MockHandleInfo::~CoreTestBase_MockHandleInfo() {} |
237 | 243 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 } | 433 } |
428 | 434 |
429 void CoreTestBase_MockHandleInfo::AwakableWasAdded(Awakable* awakable) { | 435 void CoreTestBase_MockHandleInfo::AwakableWasAdded(Awakable* awakable) { |
430 MutexLocker locker(&mutex_); | 436 MutexLocker locker(&mutex_); |
431 added_awakables_.push_back(awakable); | 437 added_awakables_.push_back(awakable); |
432 } | 438 } |
433 | 439 |
434 } // namespace test | 440 } // namespace test |
435 } // namespace system | 441 } // namespace system |
436 } // namespace mojo | 442 } // namespace mojo |
OLD | NEW |