| 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 "chrome/browser/sync/test/integration/passwords_helper.h" | 5 #include "chrome/browser/sync/test/integration/passwords_helper.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 test()->GetProfile(index))->SetEncryptionPassphrase(passphrase, type); | 121 test()->GetProfile(index))->SetEncryptionPassphrase(passphrase, type); |
| 122 } | 122 } |
| 123 | 123 |
| 124 bool SetDecryptionPassphrase(int index, const std::string& passphrase) { | 124 bool SetDecryptionPassphrase(int index, const std::string& passphrase) { |
| 125 return ProfileSyncServiceFactory::GetForProfile( | 125 return ProfileSyncServiceFactory::GetForProfile( |
| 126 test()->GetProfile(index))->SetDecryptionPassphrase(passphrase); | 126 test()->GetProfile(index))->SetDecryptionPassphrase(passphrase); |
| 127 } | 127 } |
| 128 | 128 |
| 129 PasswordStore* GetPasswordStore(int index) { | 129 PasswordStore* GetPasswordStore(int index) { |
| 130 return PasswordStoreFactory::GetForProfile(test()->GetProfile(index), | 130 return PasswordStoreFactory::GetForProfile(test()->GetProfile(index), |
| 131 Profile::IMPLICIT_ACCESS); | 131 Profile::IMPLICIT_ACCESS).get(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 PasswordStore* GetVerifierPasswordStore() { | 134 PasswordStore* GetVerifierPasswordStore() { |
| 135 return PasswordStoreFactory::GetForProfile(test()->verifier(), | 135 return PasswordStoreFactory::GetForProfile(test()->verifier(), |
| 136 Profile::IMPLICIT_ACCESS); | 136 Profile::IMPLICIT_ACCESS).get(); |
| 137 } | 137 } |
| 138 | 138 |
| 139 bool ProfileContainsSamePasswordFormsAsVerifier(int index) { | 139 bool ProfileContainsSamePasswordFormsAsVerifier(int index) { |
| 140 std::vector<PasswordForm> verifier_forms; | 140 std::vector<PasswordForm> verifier_forms; |
| 141 std::vector<PasswordForm> forms; | 141 std::vector<PasswordForm> forms; |
| 142 GetLogins(GetVerifierPasswordStore(), verifier_forms); | 142 GetLogins(GetVerifierPasswordStore(), verifier_forms); |
| 143 GetLogins(GetPasswordStore(index), forms); | 143 GetLogins(GetPasswordStore(index), forms); |
| 144 bool result = ContainsSamePasswordForms(verifier_forms, forms); | 144 bool result = ContainsSamePasswordForms(verifier_forms, forms); |
| 145 if (!result) { | 145 if (!result) { |
| 146 LOG(ERROR) << "Password forms in Verifier Profile:"; | 146 LOG(ERROR) << "Password forms in Verifier Profile:"; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 PasswordForm form; | 216 PasswordForm form; |
| 217 form.signon_realm = kFakeSignonRealm; | 217 form.signon_realm = kFakeSignonRealm; |
| 218 form.origin = GURL(base::StringPrintf(kIndexedFakeOrigin, index)); | 218 form.origin = GURL(base::StringPrintf(kIndexedFakeOrigin, index)); |
| 219 form.username_value = ASCIIToUTF16(base::StringPrintf("username%d", index)); | 219 form.username_value = ASCIIToUTF16(base::StringPrintf("username%d", index)); |
| 220 form.password_value = ASCIIToUTF16(base::StringPrintf("password%d", index)); | 220 form.password_value = ASCIIToUTF16(base::StringPrintf("password%d", index)); |
| 221 form.date_created = base::Time::Now(); | 221 form.date_created = base::Time::Now(); |
| 222 return form; | 222 return form; |
| 223 } | 223 } |
| 224 | 224 |
| 225 } // namespace passwords_helper | 225 } // namespace passwords_helper |
| OLD | NEW |