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

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: For review Created 9 years, 5 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 break; 304 break;
305 } 305 }
306 case WAITING_FOR_SYNC_CONFIGURATION: { 306 case WAITING_FOR_SYNC_CONFIGURATION: {
307 VLOG(1) << GetClientInfoString("WAITING_FOR_SYNC_CONFIGURATION"); 307 VLOG(1) << GetClientInfoString("WAITING_FOR_SYNC_CONFIGURATION");
308 if (service()->ShouldPushChanges()) { 308 if (service()->ShouldPushChanges()) {
309 // The Datatype manager is configured and sync is fully initialized. 309 // The Datatype manager is configured and sync is fully initialized.
310 SignalStateCompleteWithNextState(FULLY_SYNCED); 310 SignalStateCompleteWithNextState(FULLY_SYNCED);
311 } 311 }
312 break; 312 break;
313 } 313 }
314 case WAITING_FOR_SYNC_DISABLED: {
315 VLOG(1) << GetClientInfoString("WAITING_FOR_SYNC_DISABLED");
316 if (service()->HasSyncSetupCompleted() == false) {
317 // Sync has been disabled.
318 SignalStateCompleteWithNextState(SYNC_DISABLED);
319 }
320 break;
321 }
314 case SERVER_UNREACHABLE: { 322 case SERVER_UNREACHABLE: {
315 VLOG(1) << GetClientInfoString("SERVER_UNREACHABLE"); 323 VLOG(1) << GetClientInfoString("SERVER_UNREACHABLE");
316 if (GetStatus().server_reachable) { 324 if (GetStatus().server_reachable) {
317 // The client was offline due to the network being disabled, but is now 325 // The client was offline due to the network being disabled, but is now
318 // back online. Wait for the pending sync cycle to complete. 326 // back online. Wait for the pending sync cycle to complete.
319 SignalStateCompleteWithNextState(WAITING_FOR_SYNC_TO_FINISH); 327 SignalStateCompleteWithNextState(WAITING_FOR_SYNC_TO_FINISH);
320 } 328 }
321 break; 329 break;
322 } 330 }
323 case SET_PASSPHRASE_FAILED: { 331 case SET_PASSPHRASE_FAILED: {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 } else if (wait_state_ == SERVER_UNREACHABLE) { 454 } else if (wait_state_ == SERVER_UNREACHABLE) {
447 // Client is offline; sync was unsuccessful. 455 // Client is offline; sync was unsuccessful.
448 LOG(ERROR) << "Client went offline after waiting for sync to finish"; 456 LOG(ERROR) << "Client went offline after waiting for sync to finish";
449 return false; 457 return false;
450 } else { 458 } else {
451 LOG(ERROR) << "Invalid wait state: " << wait_state_; 459 LOG(ERROR) << "Invalid wait state: " << wait_state_;
452 return false; 460 return false;
453 } 461 }
454 } 462 }
455 463
464 bool ProfileSyncServiceHarness::AwaitSyncDisabled(const std::string& reason) {
465 DCHECK(service()->HasSyncSetupCompleted());
466 DCHECK_NE(wait_state_, SYNC_DISABLED);
467 wait_state_ = WAITING_FOR_SYNC_DISABLED;
468 AwaitStatusChangeWithTimeout(kLiveSyncOperationTimeoutMs, reason);
469 return wait_state_ == SYNC_DISABLED;
470 }
471
456 bool ProfileSyncServiceHarness::AwaitMutualSyncCycleCompletion( 472 bool ProfileSyncServiceHarness::AwaitMutualSyncCycleCompletion(
457 ProfileSyncServiceHarness* partner) { 473 ProfileSyncServiceHarness* partner) {
458 VLOG(1) << GetClientInfoString("AwaitMutualSyncCycleCompletion"); 474 VLOG(1) << GetClientInfoString("AwaitMutualSyncCycleCompletion");
459 if (!AwaitSyncCycleCompletion("Sync cycle completion on active client.")) 475 if (!AwaitSyncCycleCompletion("Sync cycle completion on active client."))
460 return false; 476 return false;
461 return partner->WaitUntilTimestampMatches(this, 477 return partner->WaitUntilTimestampMatches(this,
462 "Sync cycle completion on passive client."); 478 "Sync cycle completion on passive client.");
463 } 479 }
464 480
465 bool ProfileSyncServiceHarness::AwaitGroupSyncCycleCompletion( 481 bool ProfileSyncServiceHarness::AwaitGroupSyncCycleCompletion(
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 return true; 824 return true;
809 } 825 }
810 826
811 std::string ProfileSyncServiceHarness::GetServiceStatus() { 827 std::string ProfileSyncServiceHarness::GetServiceStatus() {
812 DictionaryValue value; 828 DictionaryValue value;
813 sync_ui_util::ConstructAboutInformation(service_, &value); 829 sync_ui_util::ConstructAboutInformation(service_, &value);
814 std::string service_status; 830 std::string service_status;
815 base::JSONWriter::Write(&value, true, &service_status); 831 base::JSONWriter::Write(&value, true, &service_status);
816 return service_status; 832 return service_status;
817 } 833 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698