| 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 "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
| 6 #include "chrome/browser/sync/engine/model_safe_worker.h" | 6 #include "chrome/browser/sync/engine/model_safe_worker.h" |
| 7 #include "chrome/browser/sync/profile_sync_service_harness.h" | 7 #include "chrome/browser/sync/profile_sync_service_harness.h" |
| 8 #include "chrome/browser/sync/sessions/session_state.h" | 8 #include "chrome/browser/sync/sessions/session_state.h" |
| 9 #include "chrome/browser/sync/test/integration/sync_test.h" | 9 #include "chrome/browser/sync/test/integration/sync_test.h" |
| 10 #include "chrome/browser/sync/test/integration/passwords_helper.h" | 10 #include "chrome/browser/sync/test/integration/passwords_helper.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 113 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 114 ASSERT_TRUE(AllProfilesContainSamePasswordFormsAsVerifier()); | 114 ASSERT_TRUE(AllProfilesContainSamePasswordFormsAsVerifier()); |
| 115 | 115 |
| 116 ASSERT_TRUE(GetClient(1)->DisableSyncForAllDatatypes()); | 116 ASSERT_TRUE(GetClient(1)->DisableSyncForAllDatatypes()); |
| 117 PasswordForm form = CreateTestPasswordForm(0); | 117 PasswordForm form = CreateTestPasswordForm(0); |
| 118 AddLogin(GetVerifierPasswordStore(), form); | 118 AddLogin(GetVerifierPasswordStore(), form); |
| 119 ASSERT_EQ(1, GetVerifierPasswordCount()); | 119 ASSERT_EQ(1, GetVerifierPasswordCount()); |
| 120 AddLogin(GetPasswordStore(0), form); | 120 AddLogin(GetPasswordStore(0), form); |
| 121 ASSERT_EQ(1, GetPasswordCount(0)); | 121 ASSERT_EQ(1, GetPasswordCount(0)); |
| 122 | 122 |
| 123 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion("Added a password.")); | 123 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Added a password.")); |
| 124 ASSERT_TRUE(ProfileContainsSamePasswordFormsAsVerifier(0)); | 124 ASSERT_TRUE(ProfileContainsSamePasswordFormsAsVerifier(0)); |
| 125 ASSERT_FALSE(ProfileContainsSamePasswordFormsAsVerifier(1)); | 125 ASSERT_FALSE(ProfileContainsSamePasswordFormsAsVerifier(1)); |
| 126 | 126 |
| 127 ASSERT_TRUE(GetClient(1)->EnableSyncForAllDatatypes()); | 127 ASSERT_TRUE(GetClient(1)->EnableSyncForAllDatatypes()); |
| 128 ASSERT_TRUE(AwaitQuiescence()); | 128 ASSERT_TRUE(AwaitQuiescence()); |
| 129 ASSERT_TRUE(AllProfilesContainSamePasswordFormsAsVerifier()); | 129 ASSERT_TRUE(AllProfilesContainSamePasswordFormsAsVerifier()); |
| 130 ASSERT_EQ(1, GetPasswordCount(1)); | 130 ASSERT_EQ(1, GetPasswordCount(1)); |
| 131 } | 131 } |
| 132 | 132 |
| 133 // TODO(sync): Enable after MockKeychain is fixed. http://crbug.com/89808. | 133 // TODO(sync): Enable after MockKeychain is fixed. http://crbug.com/89808. |
| 134 #if defined(OS_MACOSX) | 134 #if defined(OS_MACOSX) |
| 135 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, DISABLED_SetPassphrase) { | 135 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, DISABLED_SetPassphrase) { |
| 136 #else | 136 #else |
| 137 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, SetPassphrase) { | 137 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, SetPassphrase) { |
| 138 #endif | 138 #endif |
| 139 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 139 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 140 | 140 |
| 141 SetPassphrase(0, kValidPassphrase); | 141 SetPassphrase(0, kValidPassphrase); |
| 142 ASSERT_TRUE(GetClient(0)->AwaitPassphraseAccepted()); | 142 ASSERT_TRUE(GetClient(0)->AwaitPassphraseAccepted()); |
| 143 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 143 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 144 | 144 |
| 145 SetPassphrase(1, kValidPassphrase); | 145 SetPassphrase(1, kValidPassphrase); |
| 146 ASSERT_TRUE(GetClient(1)->AwaitPassphraseAccepted()); | 146 ASSERT_TRUE(GetClient(1)->AwaitPassphraseAccepted()); |
| 147 ASSERT_TRUE(GetClient(1)->AwaitSyncCycleCompletion("Set passphrase.")); | 147 ASSERT_TRUE(GetClient(1)->AwaitFullSyncCompletion("Set passphrase.")); |
| 148 } | 148 } |
| 149 | 149 |
| 150 // TODO(sync): Enable after MockKeychain is fixed. http://crbug.com/89808. | 150 // TODO(sync): Enable after MockKeychain is fixed. http://crbug.com/89808. |
| 151 #if defined(OS_MACOSX) | 151 #if defined(OS_MACOSX) |
| 152 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, | 152 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, |
| 153 DISABLED_SetPassphraseAndAddPassword) { | 153 DISABLED_SetPassphraseAndAddPassword) { |
| 154 #else | 154 #else |
| 155 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, | 155 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, |
| 156 SetPassphraseAndAddPassword) { | 156 SetPassphraseAndAddPassword) { |
| 157 #endif | 157 #endif |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 DISABLED_SetPassphraseAndThenSetupSync) { | 276 DISABLED_SetPassphraseAndThenSetupSync) { |
| 277 #else | 277 #else |
| 278 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, | 278 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, |
| 279 SetPassphraseAndThenSetupSync) { | 279 SetPassphraseAndThenSetupSync) { |
| 280 #endif | 280 #endif |
| 281 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; | 281 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; |
| 282 | 282 |
| 283 ASSERT_TRUE(GetClient(0)->SetupSync()); | 283 ASSERT_TRUE(GetClient(0)->SetupSync()); |
| 284 SetPassphrase(0, kValidPassphrase); | 284 SetPassphrase(0, kValidPassphrase); |
| 285 ASSERT_TRUE(GetClient(0)->AwaitPassphraseAccepted()); | 285 ASSERT_TRUE(GetClient(0)->AwaitPassphraseAccepted()); |
| 286 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion("Initial sync.")); | 286 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Initial sync.")); |
| 287 | 287 |
| 288 ASSERT_FALSE(GetClient(1)->SetupSync()); | 288 ASSERT_FALSE(GetClient(1)->SetupSync()); |
| 289 SetPassphrase(1, kValidPassphrase); | 289 SetPassphrase(1, kValidPassphrase); |
| 290 ASSERT_TRUE(GetClient(1)->AwaitPassphraseAccepted()); | 290 ASSERT_TRUE(GetClient(1)->AwaitPassphraseAccepted()); |
| 291 ASSERT_TRUE(GetClient(1)->AwaitSyncCycleCompletion("Initial sync.")); | 291 ASSERT_TRUE(GetClient(1)->AwaitFullSyncCompletion("Initial sync.")); |
| 292 | 292 |
| 293 // Following ensures types are enabled and active (see bug 87572). | 293 // Following ensures types are enabled and active (see bug 87572). |
| 294 browser_sync::ModelSafeRoutingInfo routes; | 294 browser_sync::ModelSafeRoutingInfo routes; |
| 295 GetClient(0)->service()->GetModelSafeRoutingInfo(&routes); | 295 GetClient(0)->service()->GetModelSafeRoutingInfo(&routes); |
| 296 ASSERT_EQ(browser_sync::GROUP_PASSWORD, routes[syncable::PASSWORDS]); | 296 ASSERT_EQ(browser_sync::GROUP_PASSWORD, routes[syncable::PASSWORDS]); |
| 297 routes.clear(); | 297 routes.clear(); |
| 298 GetClient(1)->service()->GetModelSafeRoutingInfo(&routes); | 298 GetClient(1)->service()->GetModelSafeRoutingInfo(&routes); |
| 299 ASSERT_EQ(browser_sync::GROUP_PASSWORD, routes[syncable::PASSWORDS]); | 299 ASSERT_EQ(browser_sync::GROUP_PASSWORD, routes[syncable::PASSWORDS]); |
| 300 } | 300 } |
| 301 | 301 |
| 302 // TODO(sync): Enable after MockKeychain is fixed. http://crbug.com/89808. | 302 // TODO(sync): Enable after MockKeychain is fixed. http://crbug.com/89808. |
| 303 #if defined(OS_MACOSX) | 303 #if defined(OS_MACOSX) |
| 304 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, | 304 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, |
| 305 DISABLED_SetPassphraseTwice) { | 305 DISABLED_SetPassphraseTwice) { |
| 306 #else | 306 #else |
| 307 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, | 307 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, |
| 308 SetPassphraseTwice) { | 308 SetPassphraseTwice) { |
| 309 #endif | 309 #endif |
| 310 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 310 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 311 | 311 |
| 312 SetPassphrase(0, kValidPassphrase); | 312 SetPassphrase(0, kValidPassphrase); |
| 313 ASSERT_TRUE(GetClient(0)->AwaitPassphraseAccepted()); | 313 ASSERT_TRUE(GetClient(0)->AwaitPassphraseAccepted()); |
| 314 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 314 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 315 | 315 |
| 316 SetPassphrase(1, kValidPassphrase); | 316 SetPassphrase(1, kValidPassphrase); |
| 317 ASSERT_TRUE(GetClient(1)->AwaitPassphraseAccepted()); | 317 ASSERT_TRUE(GetClient(1)->AwaitPassphraseAccepted()); |
| 318 ASSERT_TRUE(GetClient(1)->AwaitSyncCycleCompletion("Set passphrase.")); | 318 ASSERT_TRUE(GetClient(1)->AwaitFullSyncCompletion("Set passphrase.")); |
| 319 | 319 |
| 320 SetPassphrase(1, kValidPassphrase); | 320 SetPassphrase(1, kValidPassphrase); |
| 321 ASSERT_TRUE(GetClient(1)->AwaitPassphraseAccepted()); | 321 ASSERT_TRUE(GetClient(1)->AwaitPassphraseAccepted()); |
| 322 ASSERT_TRUE(GetClient(1)->AwaitSyncCycleCompletion("Set passphrase again.")); | 322 ASSERT_TRUE(GetClient(1)->AwaitFullSyncCompletion("Set passphrase again.")); |
| 323 } | 323 } |
| OLD | NEW |