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

Side by Side Diff: chrome/browser/sync/profile_sync_service_harness.cc

Issue 7481009: Test birtday error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Upload before commit. Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/sync/profile_sync_service_harness.h" 5 #include "chrome/browser/sync/profile_sync_service_harness.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <iterator> 9 #include <iterator>
10 #include <ostream> 10 #include <ostream>
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 break; 312 break;
313 } 313 }
314 case WAITING_FOR_SYNC_CONFIGURATION: { 314 case WAITING_FOR_SYNC_CONFIGURATION: {
315 VLOG(1) << GetClientInfoString("WAITING_FOR_SYNC_CONFIGURATION"); 315 VLOG(1) << GetClientInfoString("WAITING_FOR_SYNC_CONFIGURATION");
316 if (service()->ShouldPushChanges()) { 316 if (service()->ShouldPushChanges()) {
317 // The Datatype manager is configured and sync is fully initialized. 317 // The Datatype manager is configured and sync is fully initialized.
318 SignalStateCompleteWithNextState(FULLY_SYNCED); 318 SignalStateCompleteWithNextState(FULLY_SYNCED);
319 } 319 }
320 break; 320 break;
321 } 321 }
322 case WAITING_FOR_SYNC_DISABLED: {
323 VLOG(1) << GetClientInfoString("WAITING_FOR_SYNC_DISABLED");
324 if (service()->HasSyncSetupCompleted() == false) {
325 // Sync has been disabled.
326 SignalStateCompleteWithNextState(SYNC_DISABLED);
327 }
328 break;
329 }
322 case SERVER_UNREACHABLE: { 330 case SERVER_UNREACHABLE: {
323 VLOG(1) << GetClientInfoString("SERVER_UNREACHABLE"); 331 VLOG(1) << GetClientInfoString("SERVER_UNREACHABLE");
324 if (GetStatus().server_reachable) { 332 if (GetStatus().server_reachable) {
325 // The client was offline due to the network being disabled, but is now 333 // The client was offline due to the network being disabled, but is now
326 // back online. Wait for the pending sync cycle to complete. 334 // back online. Wait for the pending sync cycle to complete.
327 SignalStateCompleteWithNextState(WAITING_FOR_SYNC_TO_FINISH); 335 SignalStateCompleteWithNextState(WAITING_FOR_SYNC_TO_FINISH);
328 } 336 }
329 break; 337 break;
330 } 338 }
331 case SET_PASSPHRASE_FAILED: { 339 case SET_PASSPHRASE_FAILED: {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 } else if (wait_state_ == SERVER_UNREACHABLE) { 462 } else if (wait_state_ == SERVER_UNREACHABLE) {
455 // Client is offline; sync was unsuccessful. 463 // Client is offline; sync was unsuccessful.
456 LOG(ERROR) << "Client went offline after waiting for sync to finish"; 464 LOG(ERROR) << "Client went offline after waiting for sync to finish";
457 return false; 465 return false;
458 } else { 466 } else {
459 LOG(ERROR) << "Invalid wait state: " << wait_state_; 467 LOG(ERROR) << "Invalid wait state: " << wait_state_;
460 return false; 468 return false;
461 } 469 }
462 } 470 }
463 471
472 bool ProfileSyncServiceHarness::AwaitSyncDisabled(const std::string& reason) {
473 DCHECK(service()->HasSyncSetupCompleted());
474 DCHECK_NE(wait_state_, SYNC_DISABLED);
475 wait_state_ = WAITING_FOR_SYNC_DISABLED;
476 AwaitStatusChangeWithTimeout(kLiveSyncOperationTimeoutMs, reason);
477 return wait_state_ == SYNC_DISABLED;
478 }
479
464 bool ProfileSyncServiceHarness::AwaitMutualSyncCycleCompletion( 480 bool ProfileSyncServiceHarness::AwaitMutualSyncCycleCompletion(
465 ProfileSyncServiceHarness* partner) { 481 ProfileSyncServiceHarness* partner) {
466 VLOG(1) << GetClientInfoString("AwaitMutualSyncCycleCompletion"); 482 VLOG(1) << GetClientInfoString("AwaitMutualSyncCycleCompletion");
467 if (!AwaitSyncCycleCompletion("Sync cycle completion on active client.")) 483 if (!AwaitSyncCycleCompletion("Sync cycle completion on active client."))
468 return false; 484 return false;
469 return partner->WaitUntilTimestampMatches(this, 485 return partner->WaitUntilTimestampMatches(this,
470 "Sync cycle completion on passive client."); 486 "Sync cycle completion on passive client.");
471 } 487 }
472 488
473 bool ProfileSyncServiceHarness::AwaitGroupSyncCycleCompletion( 489 bool ProfileSyncServiceHarness::AwaitGroupSyncCycleCompletion(
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 return true; 832 return true;
817 } 833 }
818 834
819 std::string ProfileSyncServiceHarness::GetServiceStatus() { 835 std::string ProfileSyncServiceHarness::GetServiceStatus() {
820 DictionaryValue value; 836 DictionaryValue value;
821 sync_ui_util::ConstructAboutInformation(service_, &value); 837 sync_ui_util::ConstructAboutInformation(service_, &value);
822 std::string service_status; 838 std::string service_status;
823 base::JSONWriter::Write(&value, true, &service_status); 839 base::JSONWriter::Write(&value, true, &service_status);
824 return service_status; 840 return service_status;
825 } 841 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_harness.h ('k') | chrome/browser/sync/protocol/sync.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698