summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorrsimha@chromium.org <rsimha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-16 23:57:52 +0000
committerrsimha@chromium.org <rsimha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-16 23:57:52 +0000
commitf1657fa68aeeea977c74b7dffe3a157e0bd91906 (patch)
treeaafca5de2aa9f04e23d6aeddbdc75a570ce8a2e1 /chrome
parent15b2c6a9a738c3445d8525075a73f36dd8f2cdbc (diff)
downloadchromium_src-f1657fa68aeeea977c74b7dffe3a157e0bd91906.zip
chromium_src-f1657fa68aeeea977c74b7dffe3a157e0bd91906.tar.gz
chromium_src-f1657fa68aeeea977c74b7dffe3a157e0bd91906.tar.bz2
Update constraints for the detection of encryption in ProfileSyncServiceHarness
A couple of the sync integration tests that encrypt a datatype and wait on the completion of encryption are flaky on the sync buildbots. It turns out that the conditions they were waiting on are necessary, but not sufficient. This patch adds a couple of extra checks to the function that waits for the completion of encryption, and updates the tests that call the method. BUG=82246 TEST=sync_integration_tests Review URL: http://codereview.chromium.org/7030028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85565 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/sync/profile_sync_service_harness.cc24
-rw-r--r--chrome/test/live_sync/two_client_live_sessions_sync_test.cc24
2 files changed, 19 insertions, 29 deletions
diff --git a/chrome/browser/sync/profile_sync_service_harness.cc b/chrome/browser/sync/profile_sync_service_harness.cc
index 0b5a2da..d45a937 100644
--- a/chrome/browser/sync/profile_sync_service_harness.cc
+++ b/chrome/browser/sync/profile_sync_service_harness.cc
@@ -286,14 +286,20 @@ bool ProfileSyncServiceHarness::RunStateChangeMachine() {
break;
}
case WAITING_FOR_ENCRYPTION: {
- // If the type whose encryption we are waiting for is now complete, there
- // is nothing to do. Encryption can take multiple sync cycles, but we only
- // exit out if we are fully synced or can't connect to the server.
LogClientInfo("WAITING_FOR_ENCRYPTION", 1);
- if (IsSynced() && IsTypeEncrypted(waiting_for_encryption_type_))
+ if (IsSynced() &&
+ IsTypeEncrypted(waiting_for_encryption_type_) &&
+ GetLastSessionSnapshot()->num_conflicting_updates == 0) {
+ // Encryption is now complete for the the type in which we were waiting.
SignalStateCompleteWithNextState(FULLY_SYNCED);
- else if (!GetStatus().server_reachable)
+ break;
+ }
+ if (!GetStatus().server_reachable) {
+ // The client cannot reach the sync server because the network is
+ // disabled. There is no need to wait anymore.
SignalStateCompleteWithNextState(SERVER_UNREACHABLE);
+ break;
+ }
break;
}
case WAITING_FOR_SYNC_CONFIGURATION: {
@@ -761,7 +767,13 @@ bool ProfileSyncServiceHarness::EnableEncryptionForType(
bool ProfileSyncServiceHarness::WaitForTypeEncryption(
syncable::ModelType type) {
- // Wait some time to let the enryption finish.
+ if (IsSynced() &&
+ IsTypeEncrypted(type) &&
+ GetLastSessionSnapshot()->num_conflicting_updates == 0) {
+ // Encryption is already complete for |type|; do not wait.
+ return true;
+ }
+
std::string reason = "Waiting for encryption.";
wait_state_ = WAITING_FOR_ENCRYPTION;
waiting_for_encryption_type_ = type;
diff --git a/chrome/test/live_sync/two_client_live_sessions_sync_test.cc b/chrome/test/live_sync/two_client_live_sessions_sync_test.cc
index 3c7926b..6e0c09a 100644
--- a/chrome/test/live_sync/two_client_live_sessions_sync_test.cc
+++ b/chrome/test/live_sync/two_client_live_sessions_sync_test.cc
@@ -140,10 +140,6 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveSessionsSyncTest,
GetClient(1)->service()->SetPassphrase(kValidPassphrase, true, true);
ASSERT_TRUE(GetClient(1)->AwaitPassphraseAccepted());
ASSERT_TRUE(GetClient(1)->WaitForTypeEncryption(syncable::SESSIONS));
- ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
- num_blocking_conflicting_updates);
- ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
- num_conflicting_updates);
ASSERT_TRUE(IsEncrypted(0));
ASSERT_TRUE(IsEncrypted(1));
@@ -188,10 +184,6 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveSessionsSyncTest,
GetClient(1)->service()->SetPassphrase(kValidPassphrase, true, true);
ASSERT_TRUE(GetClient(1)->AwaitPassphraseAccepted());
ASSERT_TRUE(GetClient(1)->WaitForTypeEncryption(syncable::SESSIONS));
- ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
- num_blocking_conflicting_updates);
- ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
- num_conflicting_updates);
ASSERT_TRUE(IsEncrypted(0));
ASSERT_TRUE(IsEncrypted(1));
@@ -240,10 +232,6 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveSessionsSyncTest,
GetClient(1)->service()->SetPassphrase(kValidPassphrase, true, true);
ASSERT_TRUE(GetClient(1)->AwaitPassphraseAccepted());
ASSERT_TRUE(GetClient(1)->WaitForTypeEncryption(syncable::SESSIONS));
- ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
- num_blocking_conflicting_updates);
- ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
- num_conflicting_updates);
ASSERT_TRUE(IsEncrypted(0));
ASSERT_TRUE(IsEncrypted(1));
@@ -286,10 +274,6 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveSessionsSyncTest,
GetClient(1)->service()->SetPassphrase(kValidPassphrase, true, true);
ASSERT_TRUE(GetClient(1)->AwaitPassphraseAccepted());
ASSERT_TRUE(GetClient(1)->WaitForTypeEncryption(syncable::SESSIONS));
- ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
- num_blocking_conflicting_updates);
- ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
- num_conflicting_updates);
ASSERT_TRUE(IsEncrypted(0));
ASSERT_TRUE(IsEncrypted(1));
@@ -303,10 +287,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveSessionsSyncTest,
ASSERT_TRUE(WindowsMatch(sessions0[0]->windows, *client1_windows));
}
-// TODO(lipalani): Bug 82246. Fix the test case to wait for sync completion
-// before checking the count of conflicting items.
IN_PROC_BROWSER_TEST_F(TwoClientLiveSessionsSyncTest,
- FLAKY_BothChangeWithEncryptionAndPassphrase) {
+ BothChangeWithEncryptionAndPassphrase) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_TRUE(CheckInitialState(0));
@@ -335,10 +317,6 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveSessionsSyncTest,
ASSERT_TRUE(GetClient(1)->AwaitPassphraseAccepted());
ASSERT_FALSE(GetClient(1)->service()->IsPassphraseRequired());
ASSERT_TRUE(GetClient(1)->WaitForTypeEncryption(syncable::SESSIONS));
- ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
- num_blocking_conflicting_updates);
- ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
- num_conflicting_updates);
// Open windows on client 1, which should automatically be encrypted.
std::vector<SessionWindow*>* client1_windows =