Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 356 } | 356 } |
| 357 break; | 357 break; |
| 358 } | 358 } |
| 359 case WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION: { | 359 case WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION: { |
| 360 VLOG(1) << GetClientInfoString( | 360 VLOG(1) << GetClientInfoString( |
| 361 "WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION"); | 361 "WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION"); |
| 362 const browser_sync::sessions::SyncSessionSnapshot *snap = | 362 const browser_sync::sessions::SyncSessionSnapshot *snap = |
| 363 GetLastSessionSnapshot(); | 363 GetLastSessionSnapshot(); |
| 364 CHECK(snap); | 364 CHECK(snap); |
| 365 retry_verifier_.VerifyRetryInterval(*snap); | 365 retry_verifier_.VerifyRetryInterval(*snap); |
| 366 if (retry_verifier_.done()) | 366 if (retry_verifier_.done()) |
|
Raghu Simha
2011/09/16 04:01:02
While you're at it: Add a comment here that briefl
lipalani1
2011/09/19 18:59:13
Done.
| |
| 367 SignalStateCompleteWithNextState(WAITING_FOR_NOTHING); | 367 SignalStateCompleteWithNextState(WAITING_FOR_NOTHING); |
| 368 break; | 368 break; |
| 369 } | 369 } |
| 370 case WAITING_FOR_MIGRATION_TO_START: { | 370 case WAITING_FOR_MIGRATION_TO_START: { |
| 371 VLOG(1) << GetClientInfoString("WAITING_FOR_MIGRATION_TO_START"); | 371 VLOG(1) << GetClientInfoString("WAITING_FOR_MIGRATION_TO_START"); |
| 372 if (HasPendingBackendMigration()) { | 372 if (HasPendingBackendMigration()) { |
| 373 SignalStateCompleteWithNextState(WAITING_FOR_MIGRATION_TO_FINISH); | 373 SignalStateCompleteWithNextState(WAITING_FOR_MIGRATION_TO_FINISH); |
|
Raghu Simha
2011/09/16 04:01:02
While you're at it: Add a comment here that briefl
lipalani1
2011/09/19 18:59:13
Done.
| |
| 374 } | 374 } |
| 375 break; | 375 break; |
| 376 } | 376 } |
| 377 case WAITING_FOR_MIGRATION_TO_FINISH: { | 377 case WAITING_FOR_MIGRATION_TO_FINISH: { |
| 378 VLOG(1) << GetClientInfoString("WAITING_FOR_MIGRATION_TO_FINISH"); | 378 VLOG(1) << GetClientInfoString("WAITING_FOR_MIGRATION_TO_FINISH"); |
| 379 if (!HasPendingBackendMigration()) { | 379 if (!HasPendingBackendMigration()) { |
|
Raghu Simha
2011/09/16 04:01:02
While you're at it: Add a comment here that briefl
lipalani1
2011/09/19 18:59:13
Done.
| |
| 380 SignalStateCompleteWithNextState(WAITING_FOR_NOTHING); | 380 SignalStateCompleteWithNextState(WAITING_FOR_NOTHING); |
| 381 } | 381 } |
| 382 break; | 382 break; |
| 383 } | 383 } |
| 384 case WAITING_FOR_ACTIONABLE_ERROR: { | |
| 385 VLOG(1) << GetClientInfoString("WAITING_FOR_ACTIONABLE_ERROR"); | |
| 386 ProfileSyncService::Status status = GetStatus(); | |
| 387 if (status.sync_protocol_error.action != browser_sync::UNKNOWN_ACTION && | |
| 388 service_->unrecoverable_error_detected() == true) { | |
|
Raghu Simha
2011/09/16 04:01:02
Add a comment here that briefly explains why we ar
lipalani1
2011/09/19 18:59:13
Done.
| |
| 389 SignalStateCompleteWithNextState(WAITING_FOR_NOTHING); | |
| 390 } | |
| 391 break; | |
| 392 } | |
| 384 case SERVER_UNREACHABLE: { | 393 case SERVER_UNREACHABLE: { |
| 385 VLOG(1) << GetClientInfoString("SERVER_UNREACHABLE"); | 394 VLOG(1) << GetClientInfoString("SERVER_UNREACHABLE"); |
| 386 if (GetStatus().server_reachable) { | 395 if (GetStatus().server_reachable) { |
| 387 // The client was offline due to the network being disabled, but is now | 396 // The client was offline due to the network being disabled, but is now |
| 388 // back online. Wait for the pending sync cycle to complete. | 397 // back online. Wait for the pending sync cycle to complete. |
| 389 SignalStateCompleteWithNextState(WAITING_FOR_SYNC_TO_FINISH); | 398 SignalStateCompleteWithNextState(WAITING_FOR_SYNC_TO_FINISH); |
| 390 } | 399 } |
| 391 break; | 400 break; |
| 392 } | 401 } |
| 393 case SET_PASSPHRASE_FAILED: { | 402 case SET_PASSPHRASE_FAILED: { |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 575 const browser_sync::sessions::SyncSessionSnapshot *snap = | 584 const browser_sync::sessions::SyncSessionSnapshot *snap = |
| 576 GetLastSessionSnapshot(); | 585 GetLastSessionSnapshot(); |
| 577 CHECK(snap); | 586 CHECK(snap); |
| 578 retry_verifier_.Initialize(*snap); | 587 retry_verifier_.Initialize(*snap); |
| 579 wait_state_ = WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION; | 588 wait_state_ = WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION; |
| 580 AwaitStatusChangeWithTimeout(kExponentialBackoffVerificationTimeoutMs, | 589 AwaitStatusChangeWithTimeout(kExponentialBackoffVerificationTimeoutMs, |
| 581 "Verify Exponential backoff"); | 590 "Verify Exponential backoff"); |
| 582 return (retry_verifier_.Succeeded()); | 591 return (retry_verifier_.Succeeded()); |
| 583 } | 592 } |
| 584 | 593 |
| 594 bool ProfileSyncServiceHarness::AwaitActionableError() { | |
| 595 ProfileSyncService::Status status = GetStatus(); | |
| 596 DCHECK(status.sync_protocol_error.action == browser_sync::UNKNOWN_ACTION); | |
|
Raghu Simha
2011/09/16 04:01:02
DCHECKs won't get executed on the main waterfall,
lipalani1
2011/09/19 18:59:13
Done.
| |
| 597 wait_state_ = WAITING_FOR_ACTIONABLE_ERROR; | |
| 598 AwaitStatusChangeWithTimeout(kLiveSyncOperationTimeoutMs, | |
| 599 "Waiting for actionable error"); | |
| 600 status = GetStatus(); | |
| 601 return (status.sync_protocol_error.action != browser_sync::UNKNOWN_ACTION && | |
| 602 status.summary == | |
| 603 browser_sync::SyncBackendHost::Status::OFFLINE_UNUSABLE); | |
|
Raghu Simha
2011/09/16 04:01:02
Curious: This success conditions here seem to be d
lipalani1
2011/09/19 18:59:13
Checking for unrecoverable error is the right thin
| |
| 604 } | |
| 605 | |
| 585 bool ProfileSyncServiceHarness::AwaitMigration( | 606 bool ProfileSyncServiceHarness::AwaitMigration( |
| 586 const syncable::ModelTypeSet& expected_migrated_types) { | 607 const syncable::ModelTypeSet& expected_migrated_types) { |
| 587 VLOG(1) << GetClientInfoString("AwaitMigration"); | 608 VLOG(1) << GetClientInfoString("AwaitMigration"); |
| 588 VLOG(1) << profile_debug_name_ << ": waiting until migration is done for " | 609 VLOG(1) << profile_debug_name_ << ": waiting until migration is done for " |
| 589 << syncable::ModelTypeSetToString(expected_migrated_types); | 610 << syncable::ModelTypeSetToString(expected_migrated_types); |
| 590 while (true) { | 611 while (true) { |
| 591 bool migration_finished = | 612 bool migration_finished = |
| 592 std::includes(migrated_types_.begin(), migrated_types_.end(), | 613 std::includes(migrated_types_.begin(), migrated_types_.end(), |
| 593 expected_migrated_types.begin(), | 614 expected_migrated_types.begin(), |
| 594 expected_migrated_types.end()); | 615 expected_migrated_types.end()); |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1040 return (synced_types.count(type) != 0); | 1061 return (synced_types.count(type) != 0); |
| 1041 } | 1062 } |
| 1042 | 1063 |
| 1043 std::string ProfileSyncServiceHarness::GetServiceStatus() { | 1064 std::string ProfileSyncServiceHarness::GetServiceStatus() { |
| 1044 DictionaryValue value; | 1065 DictionaryValue value; |
| 1045 sync_ui_util::ConstructAboutInformation(service_, &value); | 1066 sync_ui_util::ConstructAboutInformation(service_, &value); |
| 1046 std::string service_status; | 1067 std::string service_status; |
| 1047 base::JSONWriter::Write(&value, true, &service_status); | 1068 base::JSONWriter::Write(&value, true, &service_status); |
| 1048 return service_status; | 1069 return service_status; |
| 1049 } | 1070 } |
| OLD | NEW |