diff options
author | rsimha@chromium.org <rsimha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-02 19:47:43 +0000 |
---|---|---|
committer | rsimha@chromium.org <rsimha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-02 19:47:43 +0000 |
commit | 43c48fb9f34da682482635dae6ebf1b3dcdae560 (patch) | |
tree | 7fbbcf193aaac9e248513fbf96a3264679e047e3 /chrome/browser/sync/sync_ui_util.cc | |
parent | 7c4e90901e7f3b641672f90a9f8080320dbfceec (diff) | |
download | chromium_src-43c48fb9f34da682482635dae6ebf1b3dcdae560.zip chromium_src-43c48fb9f34da682482635dae6ebf1b3dcdae560.tar.gz chromium_src-43c48fb9f34da682482635dae6ebf1b3dcdae560.tar.bz2 |
Refactor sync passphrase setup flow and fix passphrase tests
The passphrase sync integration tests are in a state of disrepair due to
several recent changes to the sync implementation. In particular,
passphrase sync uses two similar methods called OnPassphraseRequired
and OnPassphraseFailed to differentiate between cases where a passphrase is
required for a first attempt at decryption and cases where decryption with a
cached passphrase failed and the user needs to be prompted.
This patch refactors the "for_decryption" boolean flag into an enum called
PassphraseRequiredReason, thereby eliminating the need for OnPassphraseFailed.
It also fixes the tests and updates the test framework to account for
scenarios in which a client is waiting for a passphrase that has been
set by one of its partners, and enables it to exit early when forward
progress is impossible without a call to SetPassphrase.
BUG=78840, 80180, 81018
TEST=sync_integration_tests
Review URL: http://codereview.chromium.org/6902101
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83764 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/sync_ui_util.cc')
-rw-r--r-- | chrome/browser/sync/sync_ui_util.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/chrome/browser/sync/sync_ui_util.cc b/chrome/browser/sync/sync_ui_util.cc index cba3c7c..8a1625f 100644 --- a/chrome/browser/sync/sync_ui_util.cc +++ b/chrome/browser/sync/sync_ui_util.cc @@ -103,7 +103,7 @@ MessageType GetStatusInfo(ProfileSyncService* service, // Either show auth error information with a link to re-login, auth in prog, // or note that everything is OK with the last synced time. - if (status.authenticated && !service->observed_passphrase_required()) { + if (status.authenticated && !service->ObservedPassphraseRequired()) { // Everything is peachy. if (status_label) { status_label->assign(GetSyncedStateStatusLabel(service)); @@ -115,8 +115,11 @@ MessageType GetStatusInfo(ProfileSyncService* service, l10n_util::GetStringUTF16(IDS_SYNC_AUTHENTICATING_LABEL)); } result_type = PRE_SYNCED; - } else if (service->observed_passphrase_required()) { - if (service->passphrase_required_for_decryption()) { + } else if (service->ObservedPassphraseRequired()) { + if (service->passphrase_required_reason() == + sync_api::REASON_DECRYPTION || + service->passphrase_required_reason() == + sync_api::REASON_SET_PASSPHRASE_FAILED) { // NOT first machine. // Show a link ("needs attention"), but still indicate the // current synced status. Return SYNC_PROMO so that @@ -187,8 +190,8 @@ MessageType GetStatusInfoForNewTabPage(ProfileSyncService* service, DCHECK(link_label); if (service->HasSyncSetupCompleted() && - service->observed_passphrase_required()) { - if (!service->passphrase_required_for_decryption()) { + service->ObservedPassphraseRequired()) { + if (service->passphrase_required_reason() == sync_api::REASON_ENCRYPTION) { // First machine migrating to passwords. Show as a promotion. if (status_label && link_label) { status_label->assign( |