Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: mojo/edk/system/core_test_base.cc

Issue 795593004: Update mojo sdk to rev cc531b32182099a5a034a99daff35ed5d38a61c8 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More workarounds for MSVC Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/edk/system/core_test_base.h ('k') | mojo/edk/system/core_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 AddAwakableImplNoLock(Awakable* /*awakable*/, 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_->IncrementAddAwakableCallCount(); 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 if (info_->IsAddAwakableAllowed()) {
135 info_->AwakableWasAdded(awakable);
136 return MOJO_RESULT_OK;
137 }
138
134 return MOJO_RESULT_FAILED_PRECONDITION; 139 return MOJO_RESULT_FAILED_PRECONDITION;
135 } 140 }
136 141
137 void RemoveAwakableImplNoLock(Awakable* /*awakable*/, 142 void RemoveAwakableImplNoLock(Awakable* /*awakable*/,
138 HandleSignalsState* signals_state) override { 143 HandleSignalsState* signals_state) override {
139 info_->IncrementRemoveAwakableCallCount(); 144 info_->IncrementRemoveAwakableCallCount();
140 lock().AssertAcquired(); 145 lock().AssertAcquired();
141 if (signals_state) 146 if (signals_state)
142 *signals_state = HandleSignalsState(); 147 *signals_state = HandleSignalsState();
143 } 148 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 write_message_call_count_(0), 196 write_message_call_count_(0),
192 read_message_call_count_(0), 197 read_message_call_count_(0),
193 write_data_call_count_(0), 198 write_data_call_count_(0),
194 begin_write_data_call_count_(0), 199 begin_write_data_call_count_(0),
195 end_write_data_call_count_(0), 200 end_write_data_call_count_(0),
196 read_data_call_count_(0), 201 read_data_call_count_(0),
197 begin_read_data_call_count_(0), 202 begin_read_data_call_count_(0),
198 end_read_data_call_count_(0), 203 end_read_data_call_count_(0),
199 add_awakable_call_count_(0), 204 add_awakable_call_count_(0),
200 remove_awakable_call_count_(0), 205 remove_awakable_call_count_(0),
201 cancel_all_awakables_call_count_(0) { 206 cancel_all_awakables_call_count_(0),
207 add_awakable_allowed_(false) {
202 } 208 }
203 209
204 CoreTestBase_MockHandleInfo::~CoreTestBase_MockHandleInfo() { 210 CoreTestBase_MockHandleInfo::~CoreTestBase_MockHandleInfo() {
205 } 211 }
206 212
207 unsigned CoreTestBase_MockHandleInfo::GetCtorCallCount() const { 213 unsigned CoreTestBase_MockHandleInfo::GetCtorCallCount() const {
208 base::AutoLock locker(lock_); 214 base::AutoLock locker(lock_);
209 return ctor_call_count_; 215 return ctor_call_count_;
210 } 216 }
211 217
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 unsigned CoreTestBase_MockHandleInfo::GetRemoveAwakableCallCount() const { 273 unsigned CoreTestBase_MockHandleInfo::GetRemoveAwakableCallCount() const {
268 base::AutoLock locker(lock_); 274 base::AutoLock locker(lock_);
269 return remove_awakable_call_count_; 275 return remove_awakable_call_count_;
270 } 276 }
271 277
272 unsigned CoreTestBase_MockHandleInfo::GetCancelAllAwakablesCallCount() const { 278 unsigned CoreTestBase_MockHandleInfo::GetCancelAllAwakablesCallCount() const {
273 base::AutoLock locker(lock_); 279 base::AutoLock locker(lock_);
274 return cancel_all_awakables_call_count_; 280 return cancel_all_awakables_call_count_;
275 } 281 }
276 282
283 size_t CoreTestBase_MockHandleInfo::GetAddedAwakableSize() const {
284 base::AutoLock locker(lock_);
285 return added_awakables_.size();
286 }
287
288 Awakable* CoreTestBase_MockHandleInfo::GetAddedAwakableAt(unsigned i) const {
289 base::AutoLock locker(lock_);
290 return added_awakables_[i];
291 }
292
277 void CoreTestBase_MockHandleInfo::IncrementCtorCallCount() { 293 void CoreTestBase_MockHandleInfo::IncrementCtorCallCount() {
278 base::AutoLock locker(lock_); 294 base::AutoLock locker(lock_);
279 ctor_call_count_++; 295 ctor_call_count_++;
280 } 296 }
281 297
282 void CoreTestBase_MockHandleInfo::IncrementDtorCallCount() { 298 void CoreTestBase_MockHandleInfo::IncrementDtorCallCount() {
283 base::AutoLock locker(lock_); 299 base::AutoLock locker(lock_);
284 dtor_call_count_++; 300 dtor_call_count_++;
285 } 301 }
286 302
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 void CoreTestBase_MockHandleInfo::IncrementRemoveAwakableCallCount() { 353 void CoreTestBase_MockHandleInfo::IncrementRemoveAwakableCallCount() {
338 base::AutoLock locker(lock_); 354 base::AutoLock locker(lock_);
339 remove_awakable_call_count_++; 355 remove_awakable_call_count_++;
340 } 356 }
341 357
342 void CoreTestBase_MockHandleInfo::IncrementCancelAllAwakablesCallCount() { 358 void CoreTestBase_MockHandleInfo::IncrementCancelAllAwakablesCallCount() {
343 base::AutoLock locker(lock_); 359 base::AutoLock locker(lock_);
344 cancel_all_awakables_call_count_++; 360 cancel_all_awakables_call_count_++;
345 } 361 }
346 362
363 void CoreTestBase_MockHandleInfo::AllowAddAwakable(bool alllow) {
364 base::AutoLock locker(lock_);
365 add_awakable_allowed_ = alllow;
366 }
367
368 bool CoreTestBase_MockHandleInfo::IsAddAwakableAllowed() const {
369 base::AutoLock locker(lock_);
370 return add_awakable_allowed_;
371 }
372
373 void CoreTestBase_MockHandleInfo::AwakableWasAdded(Awakable* awakable) {
374 base::AutoLock locker(lock_);
375 added_awakables_.push_back(awakable);
376 }
377
347 } // namespace test 378 } // namespace test
348 } // namespace system 379 } // namespace system
349 } // namespace mojo 380 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/core_test_base.h ('k') | mojo/edk/system/core_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698