| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/password_manager/password_form_data.h" | 5 #include "chrome/browser/password_manager/password_form_data.h" |
| 6 #include "chrome/browser/sync/sessions/session_state.h" | 6 #include "chrome/browser/sync/sessions/session_state.h" |
| 7 #include "chrome/test/live_sync/live_passwords_sync_test.h" | 7 #include "chrome/test/live_sync/live_passwords_sync_test.h" |
| 8 | 8 |
| 9 using webkit_glue::PasswordForm; | 9 using webkit_glue::PasswordForm; |
| 10 | 10 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 ASSERT_TRUE(ContainsSamePasswordForms(actual_zero, actual_one)); | 77 ASSERT_TRUE(ContainsSamePasswordForms(actual_zero, actual_one)); |
| 78 } | 78 } |
| 79 | 79 |
| 80 // TODO(sync): Remove FAILS_ annotation after http://crbug.com/59867 is fixed. | 80 // TODO(sync): Remove FAILS_ annotation after http://crbug.com/59867 is fixed. |
| 81 #if defined(OS_MACOSX) | 81 #if defined(OS_MACOSX) |
| 82 IN_PROC_BROWSER_TEST_F(TwoClientLivePasswordsSyncTest, FAILS_SetPassphrase) { | 82 IN_PROC_BROWSER_TEST_F(TwoClientLivePasswordsSyncTest, FAILS_SetPassphrase) { |
| 83 #else | 83 #else |
| 84 IN_PROC_BROWSER_TEST_F(TwoClientLivePasswordsSyncTest, SetPassphrase) { | 84 IN_PROC_BROWSER_TEST_F(TwoClientLivePasswordsSyncTest, SetPassphrase) { |
| 85 #endif | 85 #endif |
| 86 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 86 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 87 GetClient(0)->service()->SetPassphrase(kValidPassphrase, true); | 87 GetClient(0)->service()->SetPassphrase(kValidPassphrase, true, true); |
| 88 GetClient(0)->AwaitPassphraseAccepted(); | 88 GetClient(0)->AwaitPassphraseAccepted(); |
| 89 GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)); | 89 GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)); |
| 90 ASSERT_TRUE(GetClient(1)->service()->observed_passphrase_required()); | 90 ASSERT_TRUE(GetClient(1)->service()->observed_passphrase_required()); |
| 91 GetClient(1)->service()->SetPassphrase(kValidPassphrase, true); | 91 GetClient(1)->service()->SetPassphrase(kValidPassphrase, true, true); |
| 92 GetClient(1)->AwaitPassphraseAccepted(); | 92 GetClient(1)->AwaitPassphraseAccepted(); |
| 93 ASSERT_FALSE(GetClient(1)->service()->observed_passphrase_required()); | 93 ASSERT_FALSE(GetClient(1)->service()->observed_passphrase_required()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 // TODO(sync): Remove FAILS_ annotation after http://crbug.com/59867 is fixed. | 96 // TODO(sync): Remove FAILS_ annotation after http://crbug.com/59867 is fixed. |
| 97 #if defined(OS_MACOSX) | 97 #if defined(OS_MACOSX) |
| 98 IN_PROC_BROWSER_TEST_F(TwoClientLivePasswordsSyncTest, | 98 IN_PROC_BROWSER_TEST_F(TwoClientLivePasswordsSyncTest, |
| 99 FAILS_SetPassphraseAndAddPassword) { | 99 FAILS_SetPassphraseAndAddPassword) { |
| 100 #else | 100 #else |
| 101 IN_PROC_BROWSER_TEST_F(TwoClientLivePasswordsSyncTest, | 101 IN_PROC_BROWSER_TEST_F(TwoClientLivePasswordsSyncTest, |
| 102 SetPassphraseAndAddPassword) { | 102 SetPassphraseAndAddPassword) { |
| 103 #endif | 103 #endif |
| 104 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 104 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 105 GetClient(0)->service()->SetPassphrase(kValidPassphrase, true); | 105 GetClient(0)->service()->SetPassphrase(kValidPassphrase, true, true); |
| 106 GetClient(0)->AwaitPassphraseAccepted(); | 106 GetClient(0)->AwaitPassphraseAccepted(); |
| 107 | 107 |
| 108 PasswordForm form; | 108 PasswordForm form; |
| 109 form.origin = GURL("http://www.google.com/"); | 109 form.origin = GURL("http://www.google.com/"); |
| 110 form.username_value = ASCIIToUTF16("username"); | 110 form.username_value = ASCIIToUTF16("username"); |
| 111 form.password_value = ASCIIToUTF16("password"); | 111 form.password_value = ASCIIToUTF16("password"); |
| 112 | 112 |
| 113 AddLogin(GetPasswordStore(0), form); | 113 AddLogin(GetPasswordStore(0), form); |
| 114 | 114 |
| 115 GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)); | 115 GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)); |
| 116 ASSERT_TRUE(GetClient(1)->service()->observed_passphrase_required()); | 116 ASSERT_TRUE(GetClient(1)->service()->observed_passphrase_required()); |
| 117 ASSERT_EQ(1, GetClient(1)->GetLastSessionSnapshot()-> | 117 ASSERT_EQ(1, GetClient(1)->GetLastSessionSnapshot()-> |
| 118 num_conflicting_updates); | 118 num_conflicting_updates); |
| 119 | 119 |
| 120 GetClient(1)->service()->SetPassphrase(kValidPassphrase, true); | 120 GetClient(1)->service()->SetPassphrase(kValidPassphrase, true, true); |
| 121 GetClient(1)->AwaitPassphraseAccepted(); | 121 GetClient(1)->AwaitPassphraseAccepted(); |
| 122 ASSERT_FALSE(GetClient(1)->service()->observed_passphrase_required()); | 122 ASSERT_FALSE(GetClient(1)->service()->observed_passphrase_required()); |
| 123 GetClient(1)->AwaitSyncCycleCompletion("Accept passphrase and decrypt."); | 123 GetClient(1)->AwaitSyncCycleCompletion("Accept passphrase and decrypt."); |
| 124 ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()-> | 124 ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()-> |
| 125 num_conflicting_updates); | 125 num_conflicting_updates); |
| 126 } | 126 } |
| 127 | 127 |
| 128 // TODO(sync): Remove DISABLED_ annotation after http://crbug.com/59867 and | 128 // TODO(sync): Remove DISABLED_ annotation after http://crbug.com/59867 and |
| 129 // http://crbug.com/67862 are fixed. | 129 // http://crbug.com/67862 are fixed. |
| 130 IN_PROC_BROWSER_TEST_F(TwoClientLivePasswordsSyncTest, | 130 IN_PROC_BROWSER_TEST_F(TwoClientLivePasswordsSyncTest, |
| 131 DISABLED_SetPassphraseAndThenSetupSync) { | 131 DISABLED_SetPassphraseAndThenSetupSync) { |
| 132 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; | 132 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; |
| 133 ASSERT_TRUE(GetClient(0)->SetupSync()); | 133 ASSERT_TRUE(GetClient(0)->SetupSync()); |
| 134 GetClient(0)->service()->SetPassphrase(kValidPassphrase, true); | 134 GetClient(0)->service()->SetPassphrase(kValidPassphrase, true, true); |
| 135 GetClient(0)->AwaitPassphraseAccepted(); | 135 GetClient(0)->AwaitPassphraseAccepted(); |
| 136 GetClient(0)->AwaitSyncCycleCompletion("Initial sync."); | 136 GetClient(0)->AwaitSyncCycleCompletion("Initial sync."); |
| 137 | 137 |
| 138 ASSERT_TRUE(GetClient(1)->SetupSync()); | 138 ASSERT_TRUE(GetClient(1)->SetupSync()); |
| 139 ASSERT_TRUE(AwaitQuiescence()); | 139 ASSERT_TRUE(AwaitQuiescence()); |
| 140 ASSERT_TRUE(GetClient(1)->service()->observed_passphrase_required()); | 140 ASSERT_TRUE(GetClient(1)->service()->observed_passphrase_required()); |
| 141 GetClient(1)->service()->SetPassphrase(kValidPassphrase, true); | 141 GetClient(1)->service()->SetPassphrase(kValidPassphrase, true, true); |
| 142 GetClient(1)->AwaitPassphraseAccepted(); | 142 GetClient(1)->AwaitPassphraseAccepted(); |
| 143 ASSERT_FALSE(GetClient(1)->service()->observed_passphrase_required()); | 143 ASSERT_FALSE(GetClient(1)->service()->observed_passphrase_required()); |
| 144 } | 144 } |
| 145 | 145 |
| 146 // TODO(sync): Remove DISABLED_ annotation after http://crbug.com/59867 and | 146 // TODO(sync): Remove DISABLED_ annotation after http://crbug.com/59867 and |
| 147 // http://crbug.com/67862 are fixed. | 147 // http://crbug.com/67862 are fixed. |
| 148 IN_PROC_BROWSER_TEST_F(TwoClientLivePasswordsSyncTest, | 148 IN_PROC_BROWSER_TEST_F(TwoClientLivePasswordsSyncTest, |
| 149 DISABLED_SetPassphraseTwice) { | 149 DISABLED_SetPassphraseTwice) { |
| 150 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 150 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 151 | 151 |
| 152 GetClient(0)->service()->SetPassphrase(kValidPassphrase, true); | 152 GetClient(0)->service()->SetPassphrase(kValidPassphrase, true, true); |
| 153 GetClient(0)->AwaitPassphraseAccepted(); | 153 GetClient(0)->AwaitPassphraseAccepted(); |
| 154 GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)); | 154 GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)); |
| 155 ASSERT_TRUE(GetClient(1)->service()->observed_passphrase_required()); | 155 ASSERT_TRUE(GetClient(1)->service()->observed_passphrase_required()); |
| 156 | 156 |
| 157 GetClient(1)->service()->SetPassphrase(kValidPassphrase, true); | 157 GetClient(1)->service()->SetPassphrase(kValidPassphrase, true, true); |
| 158 GetClient(1)->AwaitPassphraseAccepted(); | 158 GetClient(1)->AwaitPassphraseAccepted(); |
| 159 ASSERT_FALSE(GetClient(1)->service()->observed_passphrase_required()); | 159 ASSERT_FALSE(GetClient(1)->service()->observed_passphrase_required()); |
| 160 | 160 |
| 161 GetClient(1)->service()->SetPassphrase(kValidPassphrase, true); | 161 GetClient(1)->service()->SetPassphrase(kValidPassphrase, true, true); |
| 162 GetClient(1)->AwaitPassphraseAccepted(); | 162 GetClient(1)->AwaitPassphraseAccepted(); |
| 163 ASSERT_FALSE(GetClient(1)->service()->observed_passphrase_required()); | 163 ASSERT_FALSE(GetClient(1)->service()->observed_passphrase_required()); |
| 164 } | 164 } |
| OLD | NEW |