| 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 <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 uint64_t /*offset*/, | 163 uint64_t /*offset*/, |
| 164 uint64_t /*num_bytes*/, | 164 uint64_t /*num_bytes*/, |
| 165 MojoMapBufferFlags /*flags*/, | 165 MojoMapBufferFlags /*flags*/, |
| 166 std::unique_ptr<platform::PlatformSharedBufferMapping>* /*mapping*/) | 166 std::unique_ptr<platform::PlatformSharedBufferMapping>* /*mapping*/) |
| 167 override { | 167 override { |
| 168 info_->IncrementMapBufferCallCount(); | 168 info_->IncrementMapBufferCallCount(); |
| 169 mutex().AssertHeld(); | 169 mutex().AssertHeld(); |
| 170 return MOJO_RESULT_UNIMPLEMENTED; | 170 return MOJO_RESULT_UNIMPLEMENTED; |
| 171 } | 171 } |
| 172 | 172 |
| 173 MojoResult WaitSetAddImpl( |
| 174 RefPtr<Dispatcher>&& /*dispatcher*/, |
| 175 MojoHandleSignals /*signals*/, |
| 176 uint64_t /*cookie*/, |
| 177 UserPointer<const MojoWaitSetAddOptions> /*options*/) override { |
| 178 info_->IncrementWaitSetAddCallCount(); |
| 179 // Note: |mutex()| is *not* held. |
| 180 return MOJO_RESULT_UNIMPLEMENTED; |
| 181 } |
| 182 |
| 183 MojoResult WaitSetRemoveImpl(uint64_t /*cookie*/) override { |
| 184 info_->IncrementWaitSetRemoveCallCount(); |
| 185 // Note: |mutex()| is *not* held. |
| 186 return MOJO_RESULT_UNIMPLEMENTED; |
| 187 } |
| 188 |
| 189 MojoResult WaitSetWaitImpl(MojoDeadline /*deadline*/, |
| 190 UserPointer<uint32_t> /*num_results*/, |
| 191 UserPointer<MojoWaitSetResult> /*results*/, |
| 192 UserPointer<uint32_t> /*max_results*/) override { |
| 193 info_->IncrementWaitSetWaitCallCount(); |
| 194 // Note: |mutex()| is *not* held. |
| 195 return MOJO_RESULT_UNIMPLEMENTED; |
| 196 } |
| 197 |
| 173 MojoResult AddAwakableImplNoLock(Awakable* awakable, | 198 MojoResult AddAwakableImplNoLock(Awakable* awakable, |
| 174 uint64_t /*context*/, | 199 uint64_t /*context*/, |
| 175 bool /*persistent*/, | 200 bool /*persistent*/, |
| 176 MojoHandleSignals /*signals*/, | 201 MojoHandleSignals /*signals*/, |
| 177 HandleSignalsState* signals_state) override { | 202 HandleSignalsState* signals_state) override { |
| 178 info_->IncrementAddAwakableCallCount(); | 203 info_->IncrementAddAwakableCallCount(); |
| 179 mutex().AssertHeld(); | 204 mutex().AssertHeld(); |
| 180 if (signals_state) | 205 if (signals_state) |
| 181 *signals_state = HandleSignalsState(); | 206 *signals_state = HandleSignalsState(); |
| 182 if (info_->IsAddAwakableAllowed()) { | 207 if (info_->IsAddAwakableAllowed()) { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 unsigned CoreTestBase_MockHandleInfo::GetGetBufferInformationCallCount() const { | 350 unsigned CoreTestBase_MockHandleInfo::GetGetBufferInformationCallCount() const { |
| 326 MutexLocker locker(&mutex_); | 351 MutexLocker locker(&mutex_); |
| 327 return get_buffer_information_call_count_; | 352 return get_buffer_information_call_count_; |
| 328 } | 353 } |
| 329 | 354 |
| 330 unsigned CoreTestBase_MockHandleInfo::GetMapBufferCallCount() const { | 355 unsigned CoreTestBase_MockHandleInfo::GetMapBufferCallCount() const { |
| 331 MutexLocker locker(&mutex_); | 356 MutexLocker locker(&mutex_); |
| 332 return map_buffer_call_count_; | 357 return map_buffer_call_count_; |
| 333 } | 358 } |
| 334 | 359 |
| 360 unsigned CoreTestBase_MockHandleInfo::GetWaitSetAddCallCount() const { |
| 361 MutexLocker locker(&mutex_); |
| 362 return wait_set_add_call_count_; |
| 363 } |
| 364 |
| 365 unsigned CoreTestBase_MockHandleInfo::GetWaitSetRemoveCallCount() const { |
| 366 MutexLocker locker(&mutex_); |
| 367 return wait_set_remove_call_count_; |
| 368 } |
| 369 |
| 370 unsigned CoreTestBase_MockHandleInfo::GetWaitSetWaitCallCount() const { |
| 371 MutexLocker locker(&mutex_); |
| 372 return wait_set_wait_call_count_; |
| 373 } |
| 374 |
| 335 unsigned CoreTestBase_MockHandleInfo::GetAddAwakableCallCount() const { | 375 unsigned CoreTestBase_MockHandleInfo::GetAddAwakableCallCount() const { |
| 336 MutexLocker locker(&mutex_); | 376 MutexLocker locker(&mutex_); |
| 337 return add_awakable_call_count_; | 377 return add_awakable_call_count_; |
| 338 } | 378 } |
| 339 | 379 |
| 340 unsigned CoreTestBase_MockHandleInfo::GetRemoveAwakableCallCount() const { | 380 unsigned CoreTestBase_MockHandleInfo::GetRemoveAwakableCallCount() const { |
| 341 MutexLocker locker(&mutex_); | 381 MutexLocker locker(&mutex_); |
| 342 return remove_awakable_call_count_; | 382 return remove_awakable_call_count_; |
| 343 } | 383 } |
| 344 | 384 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 void CoreTestBase_MockHandleInfo::IncrementGetBufferInformationCallCount() { | 465 void CoreTestBase_MockHandleInfo::IncrementGetBufferInformationCallCount() { |
| 426 MutexLocker locker(&mutex_); | 466 MutexLocker locker(&mutex_); |
| 427 get_buffer_information_call_count_++; | 467 get_buffer_information_call_count_++; |
| 428 } | 468 } |
| 429 | 469 |
| 430 void CoreTestBase_MockHandleInfo::IncrementMapBufferCallCount() { | 470 void CoreTestBase_MockHandleInfo::IncrementMapBufferCallCount() { |
| 431 MutexLocker locker(&mutex_); | 471 MutexLocker locker(&mutex_); |
| 432 map_buffer_call_count_++; | 472 map_buffer_call_count_++; |
| 433 } | 473 } |
| 434 | 474 |
| 475 void CoreTestBase_MockHandleInfo::IncrementWaitSetAddCallCount() { |
| 476 MutexLocker locker(&mutex_); |
| 477 wait_set_add_call_count_++; |
| 478 } |
| 479 |
| 480 void CoreTestBase_MockHandleInfo::IncrementWaitSetRemoveCallCount() { |
| 481 MutexLocker locker(&mutex_); |
| 482 wait_set_remove_call_count_++; |
| 483 } |
| 484 |
| 485 void CoreTestBase_MockHandleInfo::IncrementWaitSetWaitCallCount() { |
| 486 MutexLocker locker(&mutex_); |
| 487 wait_set_wait_call_count_++; |
| 488 } |
| 489 |
| 435 void CoreTestBase_MockHandleInfo::IncrementAddAwakableCallCount() { | 490 void CoreTestBase_MockHandleInfo::IncrementAddAwakableCallCount() { |
| 436 MutexLocker locker(&mutex_); | 491 MutexLocker locker(&mutex_); |
| 437 add_awakable_call_count_++; | 492 add_awakable_call_count_++; |
| 438 } | 493 } |
| 439 | 494 |
| 440 void CoreTestBase_MockHandleInfo::IncrementRemoveAwakableCallCount() { | 495 void CoreTestBase_MockHandleInfo::IncrementRemoveAwakableCallCount() { |
| 441 MutexLocker locker(&mutex_); | 496 MutexLocker locker(&mutex_); |
| 442 remove_awakable_call_count_++; | 497 remove_awakable_call_count_++; |
| 443 } | 498 } |
| 444 | 499 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 458 } | 513 } |
| 459 | 514 |
| 460 void CoreTestBase_MockHandleInfo::AwakableWasAdded(Awakable* awakable) { | 515 void CoreTestBase_MockHandleInfo::AwakableWasAdded(Awakable* awakable) { |
| 461 MutexLocker locker(&mutex_); | 516 MutexLocker locker(&mutex_); |
| 462 added_awakables_.push_back(awakable); | 517 added_awakables_.push_back(awakable); |
| 463 } | 518 } |
| 464 | 519 |
| 465 } // namespace test | 520 } // namespace test |
| 466 } // namespace system | 521 } // namespace system |
| 467 } // namespace mojo | 522 } // namespace mojo |
| OLD | NEW |