| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 lock().AssertAcquired(); | 116 lock().AssertAcquired(); |
| 117 return MOJO_RESULT_UNIMPLEMENTED; | 117 return MOJO_RESULT_UNIMPLEMENTED; |
| 118 } | 118 } |
| 119 | 119 |
| 120 MojoResult EndReadDataImplNoLock(uint32_t /*num_bytes_read*/) override { | 120 MojoResult EndReadDataImplNoLock(uint32_t /*num_bytes_read*/) override { |
| 121 info_->IncrementEndReadDataCallCount(); | 121 info_->IncrementEndReadDataCallCount(); |
| 122 lock().AssertAcquired(); | 122 lock().AssertAcquired(); |
| 123 return MOJO_RESULT_UNIMPLEMENTED; | 123 return MOJO_RESULT_UNIMPLEMENTED; |
| 124 } | 124 } |
| 125 | 125 |
| 126 MojoResult AddWaiterImplNoLock(Waiter* /*waiter*/, | 126 MojoResult AddAwakableImplNoLock(Awakable* /*awakable*/, |
| 127 MojoHandleSignals /*signals*/, | 127 MojoHandleSignals /*signals*/, |
| 128 uint32_t /*context*/, | 128 uint32_t /*context*/, |
| 129 HandleSignalsState* signals_state) override { | 129 HandleSignalsState* signals_state) override { |
| 130 info_->IncrementAddWaiterCallCount(); | 130 info_->IncrementAddAwakableCallCount(); |
| 131 lock().AssertAcquired(); | 131 lock().AssertAcquired(); |
| 132 if (signals_state) | 132 if (signals_state) |
| 133 *signals_state = HandleSignalsState(); | 133 *signals_state = HandleSignalsState(); |
| 134 return MOJO_RESULT_FAILED_PRECONDITION; | 134 return MOJO_RESULT_FAILED_PRECONDITION; |
| 135 } | 135 } |
| 136 | 136 |
| 137 void RemoveWaiterImplNoLock(Waiter* /*waiter*/, | 137 void RemoveAwakableImplNoLock(Awakable* /*awakable*/, |
| 138 HandleSignalsState* signals_state) override { | 138 HandleSignalsState* signals_state) override { |
| 139 info_->IncrementRemoveWaiterCallCount(); | 139 info_->IncrementRemoveAwakableCallCount(); |
| 140 lock().AssertAcquired(); | 140 lock().AssertAcquired(); |
| 141 if (signals_state) | 141 if (signals_state) |
| 142 *signals_state = HandleSignalsState(); | 142 *signals_state = HandleSignalsState(); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void CancelAllWaitersNoLock() override { | 145 void CancelAllAwakablesNoLock() override { |
| 146 info_->IncrementCancelAllWaitersCallCount(); | 146 info_->IncrementCancelAllAwakablesCallCount(); |
| 147 lock().AssertAcquired(); | 147 lock().AssertAcquired(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 scoped_refptr<Dispatcher> CreateEquivalentDispatcherAndCloseImplNoLock() | 150 scoped_refptr<Dispatcher> CreateEquivalentDispatcherAndCloseImplNoLock() |
| 151 override { | 151 override { |
| 152 return scoped_refptr<Dispatcher>(new MockDispatcher(info_)); | 152 return scoped_refptr<Dispatcher>(new MockDispatcher(info_)); |
| 153 } | 153 } |
| 154 | 154 |
| 155 CoreTestBase::MockHandleInfo* const info_; | 155 CoreTestBase::MockHandleInfo* const info_; |
| 156 | 156 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 dtor_call_count_(0), | 189 dtor_call_count_(0), |
| 190 close_call_count_(0), | 190 close_call_count_(0), |
| 191 write_message_call_count_(0), | 191 write_message_call_count_(0), |
| 192 read_message_call_count_(0), | 192 read_message_call_count_(0), |
| 193 write_data_call_count_(0), | 193 write_data_call_count_(0), |
| 194 begin_write_data_call_count_(0), | 194 begin_write_data_call_count_(0), |
| 195 end_write_data_call_count_(0), | 195 end_write_data_call_count_(0), |
| 196 read_data_call_count_(0), | 196 read_data_call_count_(0), |
| 197 begin_read_data_call_count_(0), | 197 begin_read_data_call_count_(0), |
| 198 end_read_data_call_count_(0), | 198 end_read_data_call_count_(0), |
| 199 add_waiter_call_count_(0), | 199 add_awakable_call_count_(0), |
| 200 remove_waiter_call_count_(0), | 200 remove_awakable_call_count_(0), |
| 201 cancel_all_waiters_call_count_(0) { | 201 cancel_all_awakables_call_count_(0) { |
| 202 } | 202 } |
| 203 | 203 |
| 204 CoreTestBase_MockHandleInfo::~CoreTestBase_MockHandleInfo() { | 204 CoreTestBase_MockHandleInfo::~CoreTestBase_MockHandleInfo() { |
| 205 } | 205 } |
| 206 | 206 |
| 207 unsigned CoreTestBase_MockHandleInfo::GetCtorCallCount() const { | 207 unsigned CoreTestBase_MockHandleInfo::GetCtorCallCount() const { |
| 208 base::AutoLock locker(lock_); | 208 base::AutoLock locker(lock_); |
| 209 return ctor_call_count_; | 209 return ctor_call_count_; |
| 210 } | 210 } |
| 211 | 211 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 unsigned CoreTestBase_MockHandleInfo::GetBeginReadDataCallCount() const { | 252 unsigned CoreTestBase_MockHandleInfo::GetBeginReadDataCallCount() const { |
| 253 base::AutoLock locker(lock_); | 253 base::AutoLock locker(lock_); |
| 254 return begin_read_data_call_count_; | 254 return begin_read_data_call_count_; |
| 255 } | 255 } |
| 256 | 256 |
| 257 unsigned CoreTestBase_MockHandleInfo::GetEndReadDataCallCount() const { | 257 unsigned CoreTestBase_MockHandleInfo::GetEndReadDataCallCount() const { |
| 258 base::AutoLock locker(lock_); | 258 base::AutoLock locker(lock_); |
| 259 return end_read_data_call_count_; | 259 return end_read_data_call_count_; |
| 260 } | 260 } |
| 261 | 261 |
| 262 unsigned CoreTestBase_MockHandleInfo::GetAddWaiterCallCount() const { | 262 unsigned CoreTestBase_MockHandleInfo::GetAddAwakableCallCount() const { |
| 263 base::AutoLock locker(lock_); | 263 base::AutoLock locker(lock_); |
| 264 return add_waiter_call_count_; | 264 return add_awakable_call_count_; |
| 265 } | 265 } |
| 266 | 266 |
| 267 unsigned CoreTestBase_MockHandleInfo::GetRemoveWaiterCallCount() const { | 267 unsigned CoreTestBase_MockHandleInfo::GetRemoveAwakableCallCount() const { |
| 268 base::AutoLock locker(lock_); | 268 base::AutoLock locker(lock_); |
| 269 return remove_waiter_call_count_; | 269 return remove_awakable_call_count_; |
| 270 } | 270 } |
| 271 | 271 |
| 272 unsigned CoreTestBase_MockHandleInfo::GetCancelAllWaitersCallCount() const { | 272 unsigned CoreTestBase_MockHandleInfo::GetCancelAllAwakablesCallCount() const { |
| 273 base::AutoLock locker(lock_); | 273 base::AutoLock locker(lock_); |
| 274 return cancel_all_waiters_call_count_; | 274 return cancel_all_awakables_call_count_; |
| 275 } | 275 } |
| 276 | 276 |
| 277 void CoreTestBase_MockHandleInfo::IncrementCtorCallCount() { | 277 void CoreTestBase_MockHandleInfo::IncrementCtorCallCount() { |
| 278 base::AutoLock locker(lock_); | 278 base::AutoLock locker(lock_); |
| 279 ctor_call_count_++; | 279 ctor_call_count_++; |
| 280 } | 280 } |
| 281 | 281 |
| 282 void CoreTestBase_MockHandleInfo::IncrementDtorCallCount() { | 282 void CoreTestBase_MockHandleInfo::IncrementDtorCallCount() { |
| 283 base::AutoLock locker(lock_); | 283 base::AutoLock locker(lock_); |
| 284 dtor_call_count_++; | 284 dtor_call_count_++; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 void CoreTestBase_MockHandleInfo::IncrementBeginReadDataCallCount() { | 322 void CoreTestBase_MockHandleInfo::IncrementBeginReadDataCallCount() { |
| 323 base::AutoLock locker(lock_); | 323 base::AutoLock locker(lock_); |
| 324 begin_read_data_call_count_++; | 324 begin_read_data_call_count_++; |
| 325 } | 325 } |
| 326 | 326 |
| 327 void CoreTestBase_MockHandleInfo::IncrementEndReadDataCallCount() { | 327 void CoreTestBase_MockHandleInfo::IncrementEndReadDataCallCount() { |
| 328 base::AutoLock locker(lock_); | 328 base::AutoLock locker(lock_); |
| 329 end_read_data_call_count_++; | 329 end_read_data_call_count_++; |
| 330 } | 330 } |
| 331 | 331 |
| 332 void CoreTestBase_MockHandleInfo::IncrementAddWaiterCallCount() { | 332 void CoreTestBase_MockHandleInfo::IncrementAddAwakableCallCount() { |
| 333 base::AutoLock locker(lock_); | 333 base::AutoLock locker(lock_); |
| 334 add_waiter_call_count_++; | 334 add_awakable_call_count_++; |
| 335 } | 335 } |
| 336 | 336 |
| 337 void CoreTestBase_MockHandleInfo::IncrementRemoveWaiterCallCount() { | 337 void CoreTestBase_MockHandleInfo::IncrementRemoveAwakableCallCount() { |
| 338 base::AutoLock locker(lock_); | 338 base::AutoLock locker(lock_); |
| 339 remove_waiter_call_count_++; | 339 remove_awakable_call_count_++; |
| 340 } | 340 } |
| 341 | 341 |
| 342 void CoreTestBase_MockHandleInfo::IncrementCancelAllWaitersCallCount() { | 342 void CoreTestBase_MockHandleInfo::IncrementCancelAllAwakablesCallCount() { |
| 343 base::AutoLock locker(lock_); | 343 base::AutoLock locker(lock_); |
| 344 cancel_all_waiters_call_count_++; | 344 cancel_all_awakables_call_count_++; |
| 345 } | 345 } |
| 346 | 346 |
| 347 } // namespace test | 347 } // namespace test |
| 348 } // namespace system | 348 } // namespace system |
| 349 } // namespace mojo | 349 } // namespace mojo |
| OLD | NEW |