| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/guid.h" | 9 #include "base/guid.h" |
| 10 #include "base/hash.h" | 10 #include "base/hash.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 form1.password_value = base::ASCIIToUTF16("new_password"); | 76 form1.password_value = base::ASCIIToUTF16("new_password"); |
| 77 AddLogin(GetPasswordStore(1), form1); | 77 AddLogin(GetPasswordStore(1), form1); |
| 78 | 78 |
| 79 ASSERT_TRUE(AwaitAllProfilesContainSamePasswordForms()); | 79 ASSERT_TRUE(AwaitAllProfilesContainSamePasswordForms()); |
| 80 } | 80 } |
| 81 | 81 |
| 82 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, | 82 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, |
| 83 E2E_ENABLED(SetPassphraseAndAddPassword)) { | 83 E2E_ENABLED(SetPassphraseAndAddPassword)) { |
| 84 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 84 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 85 | 85 |
| 86 SetEncryptionPassphrase(0, kValidPassphrase, ProfileSyncService::EXPLICIT); | 86 SetEncryptionPassphrase(0, kValidPassphrase, |
| 87 browser_sync::ProfileSyncService::EXPLICIT); |
| 87 ASSERT_TRUE(AwaitPassphraseAccepted(GetSyncService((0)))); | 88 ASSERT_TRUE(AwaitPassphraseAccepted(GetSyncService((0)))); |
| 88 | 89 |
| 89 ASSERT_TRUE(AwaitPassphraseRequired(GetSyncService((1)))); | 90 ASSERT_TRUE(AwaitPassphraseRequired(GetSyncService((1)))); |
| 90 ASSERT_TRUE(SetDecryptionPassphrase(1, kValidPassphrase)); | 91 ASSERT_TRUE(SetDecryptionPassphrase(1, kValidPassphrase)); |
| 91 ASSERT_TRUE(AwaitPassphraseAccepted(GetSyncService((1)))); | 92 ASSERT_TRUE(AwaitPassphraseAccepted(GetSyncService((1)))); |
| 92 | 93 |
| 93 PasswordForm form = CreateTestPasswordForm(0); | 94 PasswordForm form = CreateTestPasswordForm(0); |
| 94 AddLogin(GetPasswordStore(0), form); | 95 AddLogin(GetPasswordStore(0), form); |
| 95 ASSERT_EQ(1, GetPasswordCount(0)); | 96 ASSERT_EQ(1, GetPasswordCount(0)); |
| 96 | 97 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // Wait for deletion from client 1 to propagate. | 142 // Wait for deletion from client 1 to propagate. |
| 142 ASSERT_TRUE(AwaitProfileContainsSamePasswordFormsAsVerifier(0)); | 143 ASSERT_TRUE(AwaitProfileContainsSamePasswordFormsAsVerifier(0)); |
| 143 ASSERT_TRUE(AllProfilesContainSamePasswordFormsAsVerifier()); | 144 ASSERT_TRUE(AllProfilesContainSamePasswordFormsAsVerifier()); |
| 144 } | 145 } |
| 145 | 146 |
| 146 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, | 147 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, |
| 147 SetPassphraseAndThenSetupSync) { | 148 SetPassphraseAndThenSetupSync) { |
| 148 ASSERT_TRUE(SetupClients()); | 149 ASSERT_TRUE(SetupClients()); |
| 149 | 150 |
| 150 ASSERT_TRUE(GetClient(0)->SetupSync()); | 151 ASSERT_TRUE(GetClient(0)->SetupSync()); |
| 151 SetEncryptionPassphrase(0, kValidPassphrase, ProfileSyncService::EXPLICIT); | 152 SetEncryptionPassphrase(0, kValidPassphrase, |
| 153 browser_sync::ProfileSyncService::EXPLICIT); |
| 152 ASSERT_TRUE(AwaitPassphraseAccepted(GetSyncService(0))); | 154 ASSERT_TRUE(AwaitPassphraseAccepted(GetSyncService(0))); |
| 153 | 155 |
| 154 // When client 1 hits a passphrase required state, we can infer that | 156 // When client 1 hits a passphrase required state, we can infer that |
| 155 // client 0's passphrase has been committed. to the server. | 157 // client 0's passphrase has been committed. to the server. |
| 156 ASSERT_FALSE(GetClient(1)->SetupSync()); | 158 ASSERT_FALSE(GetClient(1)->SetupSync()); |
| 157 ASSERT_TRUE(AwaitPassphraseRequired(GetSyncService(1))); | 159 ASSERT_TRUE(AwaitPassphraseRequired(GetSyncService(1))); |
| 158 | 160 |
| 159 // Get client 1 out of the passphrase required state. | 161 // Get client 1 out of the passphrase required state. |
| 160 ASSERT_TRUE(SetDecryptionPassphrase(1, kValidPassphrase)); | 162 ASSERT_TRUE(SetDecryptionPassphrase(1, kValidPassphrase)); |
| 161 ASSERT_TRUE(AwaitPassphraseAccepted(GetSyncService(1))); | 163 ASSERT_TRUE(AwaitPassphraseAccepted(GetSyncService(1))); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 | 260 |
| 259 // Blocks and waits for password forms in all profiles to match. | 261 // Blocks and waits for password forms in all profiles to match. |
| 260 ASSERT_TRUE(AwaitAllProfilesContainSamePasswordForms()); | 262 ASSERT_TRUE(AwaitAllProfilesContainSamePasswordForms()); |
| 261 | 263 |
| 262 // Check that total number of passwords is as expected. | 264 // Check that total number of passwords is as expected. |
| 263 for (int i = 0; i < num_clients(); ++i) { | 265 for (int i = 0; i < num_clients(); ++i) { |
| 264 ASSERT_EQ(GetPasswordCount(i), init_password_count + num_clients()) << | 266 ASSERT_EQ(GetPasswordCount(i), init_password_count + num_clients()) << |
| 265 "Total password count is wrong."; | 267 "Total password count is wrong."; |
| 266 } | 268 } |
| 267 } | 269 } |
| OLD | NEW |