| 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/test/live_sync/live_sync_test.h" | 9 #include "chrome/test/live_sync/live_sync_test.h" |
| 10 #include "chrome/test/live_sync/passwords_helper.h" | 10 #include "chrome/test/live_sync/passwords_helper.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, true); | 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, false); | 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)->AwaitSyncCycleCompletion("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 |
| 158 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 158 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 159 | 159 |
| 160 SetPassphrase(0, kValidPassphrase, true); | 160 SetPassphrase(0, kValidPassphrase); |
| 161 ASSERT_TRUE(GetClient(0)->AwaitPassphraseAccepted()); | 161 ASSERT_TRUE(GetClient(0)->AwaitPassphraseAccepted()); |
| 162 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 162 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 163 | 163 |
| 164 SetPassphrase(1, kValidPassphrase, false); | 164 SetPassphrase(1, kValidPassphrase); |
| 165 ASSERT_TRUE(GetClient(1)->AwaitPassphraseAccepted()); | 165 ASSERT_TRUE(GetClient(1)->AwaitPassphraseAccepted()); |
| 166 | 166 |
| 167 PasswordForm form = CreateTestPasswordForm(0); | 167 PasswordForm form = CreateTestPasswordForm(0); |
| 168 AddLogin(GetPasswordStore(0), form); | 168 AddLogin(GetPasswordStore(0), form); |
| 169 ASSERT_EQ(1, GetPasswordCount(0)); | 169 ASSERT_EQ(1, GetPasswordCount(0)); |
| 170 | 170 |
| 171 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 171 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 172 ASSERT_EQ(1, GetPasswordCount(1)); | 172 ASSERT_EQ(1, GetPasswordCount(1)); |
| 173 } | 173 } |
| 174 | 174 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 #if defined(OS_MACOSX) | 274 #if defined(OS_MACOSX) |
| 275 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, | 275 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, |
| 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, true); | 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)->AwaitSyncCycleCompletion("Initial sync.")); |
| 287 | 287 |
| 288 ASSERT_FALSE(GetClient(1)->SetupSync()); | 288 ASSERT_FALSE(GetClient(1)->SetupSync()); |
| 289 SetPassphrase(1, kValidPassphrase, false); | 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)->AwaitSyncCycleCompletion("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, true); | 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, false); | 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)->AwaitSyncCycleCompletion("Set passphrase.")); |
| 319 | 319 |
| 320 SetPassphrase(1, kValidPassphrase, false); | 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)->AwaitSyncCycleCompletion("Set passphrase again.")); |
| 323 } | 323 } |
| OLD | NEW |