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

Side by Side Diff: chrome/test/sync/engine/mock_connection_manager.cc

Issue 6142009: Upating the app, ceee, chrome, ipc, media, and net directories to use the correct lock.h file. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Unified patch updating all references to the new base/synchronization/lock.h Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 // Mock ServerConnectionManager class for use in client regression tests. 5 // Mock ServerConnectionManager class for use in client regression tests.
6 6
7 #include "chrome/test/sync/engine/mock_connection_manager.h" 7 #include "chrome/test/sync/engine/mock_connection_manager.h"
8 8
9 #include "chrome/browser/sync/engine/syncer_proto_util.h" 9 #include "chrome/browser/sync/engine/syncer_proto_util.h"
10 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" 10 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 ProcessClearData(&post, &response); 131 ProcessClearData(&post, &response);
132 } else { 132 } else {
133 EXPECT_TRUE(false) << "Unknown/unsupported ClientToServerMessage"; 133 EXPECT_TRUE(false) << "Unknown/unsupported ClientToServerMessage";
134 return false; 134 return false;
135 } 135 }
136 if (client_command_.get()) { 136 if (client_command_.get()) {
137 response.mutable_client_command()->CopyFrom(*client_command_.get()); 137 response.mutable_client_command()->CopyFrom(*client_command_.get());
138 } 138 }
139 139
140 { 140 {
141 AutoLock lock(response_code_override_lock_); 141 base::AutoLock lock(response_code_override_lock_);
142 if (throttling_) { 142 if (throttling_) {
143 response.set_error_code(ClientToServerResponse::THROTTLED); 143 response.set_error_code(ClientToServerResponse::THROTTLED);
144 throttling_ = false; 144 throttling_ = false;
145 } 145 }
146 146
147 if (fail_with_auth_invalid_) 147 if (fail_with_auth_invalid_)
148 response.set_error_code(ClientToServerResponse::AUTH_INVALID); 148 response.set_error_code(ClientToServerResponse::AUTH_INVALID);
149 } 149 }
150 150
151 response.SerializeToString(params->buffer_out); 151 response.SerializeToString(params->buffer_out);
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 return *commit_messages_->back(); 494 return *commit_messages_->back();
495 } 495 }
496 496
497 const CommitResponse& MockConnectionManager::last_commit_response() const { 497 const CommitResponse& MockConnectionManager::last_commit_response() const {
498 EXPECT_TRUE(!commit_responses_.empty()); 498 EXPECT_TRUE(!commit_responses_.empty());
499 return *commit_responses_->back(); 499 return *commit_responses_->back();
500 } 500 }
501 501
502 void MockConnectionManager::ThrottleNextRequest( 502 void MockConnectionManager::ThrottleNextRequest(
503 ResponseCodeOverrideRequestor* visitor) { 503 ResponseCodeOverrideRequestor* visitor) {
504 AutoLock lock(response_code_override_lock_); 504 base::AutoLock lock(response_code_override_lock_);
505 throttling_ = true; 505 throttling_ = true;
506 if (visitor) 506 if (visitor)
507 visitor->OnOverrideComplete(); 507 visitor->OnOverrideComplete();
508 } 508 }
509 509
510 void MockConnectionManager::FailWithAuthInvalid( 510 void MockConnectionManager::FailWithAuthInvalid(
511 ResponseCodeOverrideRequestor* visitor) { 511 ResponseCodeOverrideRequestor* visitor) {
512 AutoLock lock(response_code_override_lock_); 512 base::AutoLock lock(response_code_override_lock_);
513 fail_with_auth_invalid_ = true; 513 fail_with_auth_invalid_ = true;
514 if (visitor) 514 if (visitor)
515 visitor->OnOverrideComplete(); 515 visitor->OnOverrideComplete();
516 } 516 }
517 517
518 void MockConnectionManager::StopFailingWithAuthInvalid( 518 void MockConnectionManager::StopFailingWithAuthInvalid(
519 ResponseCodeOverrideRequestor* visitor) { 519 ResponseCodeOverrideRequestor* visitor) {
520 AutoLock lock(response_code_override_lock_); 520 base::AutoLock lock(response_code_override_lock_);
521 fail_with_auth_invalid_ = false; 521 fail_with_auth_invalid_ = false;
522 if (visitor) 522 if (visitor)
523 visitor->OnOverrideComplete(); 523 visitor->OnOverrideComplete();
524 } 524 }
525 525
526 bool MockConnectionManager::IsModelTypePresentInSpecifics( 526 bool MockConnectionManager::IsModelTypePresentInSpecifics(
527 const sync_pb::EntitySpecifics& filter, syncable::ModelType value) { 527 const sync_pb::EntitySpecifics& filter, syncable::ModelType value) {
528 // This implementation is a little contorted; it's done this way 528 // This implementation is a little contorted; it's done this way
529 // to avoid having to switch on the ModelType. We're basically doing 529 // to avoid having to switch on the ModelType. We're basically doing
530 // the protobuf equivalent of ((value & filter) == filter). 530 // the protobuf equivalent of ((value & filter) == filter).
(...skipping 15 matching lines...) Expand all
546 546
547 void MockConnectionManager::SetServerNotReachable() { 547 void MockConnectionManager::SetServerNotReachable() {
548 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE; 548 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE;
549 server_reachable_ = false; 549 server_reachable_ = false;
550 browser_sync::ServerConnectionEvent event = { 550 browser_sync::ServerConnectionEvent event = {
551 browser_sync::ServerConnectionEvent::STATUS_CHANGED, 551 browser_sync::ServerConnectionEvent::STATUS_CHANGED,
552 server_status_, 552 server_status_,
553 server_reachable_ }; 553 server_reachable_ };
554 channel_->NotifyListeners(event); 554 channel_->NotifyListeners(event);
555 } 555 }
OLDNEW
« no previous file with comments | « chrome/test/sync/engine/mock_connection_manager.h ('k') | chrome/test/webdriver/session_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698