| 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 <sstream> | 7 #include <sstream> |
| 8 #include <string> |
| 8 #include <utility> | 9 #include <utility> |
| 9 | 10 |
| 10 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/synchronization/waitable_event.h" | 15 #include "base/synchronization/waitable_event.h" |
| 15 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 16 #include "chrome/browser/password_manager/password_store_factory.h" | 17 #include "chrome/browser/password_manager/password_store_factory.h" |
| 17 #include "chrome/browser/sync/profile_sync_service_factory.h" | 18 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 wait_event.Wait(); | 117 wait_event.Wait(); |
| 117 } | 118 } |
| 118 | 119 |
| 119 void RemoveLogins(PasswordStore* store) { | 120 void RemoveLogins(PasswordStore* store) { |
| 120 std::vector<std::unique_ptr<PasswordForm>> forms = GetLogins(store); | 121 std::vector<std::unique_ptr<PasswordForm>> forms = GetLogins(store); |
| 121 for (const auto& form : forms) { | 122 for (const auto& form : forms) { |
| 122 RemoveLogin(store, *form); | 123 RemoveLogin(store, *form); |
| 123 } | 124 } |
| 124 } | 125 } |
| 125 | 126 |
| 126 void SetEncryptionPassphrase( | |
| 127 int index, | |
| 128 const std::string& passphrase, | |
| 129 browser_sync::ProfileSyncService::PassphraseType type) { | |
| 130 ProfileSyncServiceFactory::GetForProfile( | |
| 131 test()->GetProfile(index))->SetEncryptionPassphrase(passphrase, type); | |
| 132 } | |
| 133 | |
| 134 bool SetDecryptionPassphrase(int index, const std::string& passphrase) { | |
| 135 return ProfileSyncServiceFactory::GetForProfile( | |
| 136 test()->GetProfile(index))->SetDecryptionPassphrase(passphrase); | |
| 137 } | |
| 138 | |
| 139 PasswordStore* GetPasswordStore(int index) { | 127 PasswordStore* GetPasswordStore(int index) { |
| 140 return PasswordStoreFactory::GetForProfile(test()->GetProfile(index), | 128 return PasswordStoreFactory::GetForProfile(test()->GetProfile(index), |
| 141 ServiceAccessType::IMPLICIT_ACCESS) | 129 ServiceAccessType::IMPLICIT_ACCESS) |
| 142 .get(); | 130 .get(); |
| 143 } | 131 } |
| 144 | 132 |
| 145 PasswordStore* GetVerifierPasswordStore() { | 133 PasswordStore* GetVerifierPasswordStore() { |
| 146 return PasswordStoreFactory::GetForProfile( | 134 return PasswordStoreFactory::GetForProfile( |
| 147 test()->verifier(), ServiceAccessType::IMPLICIT_ACCESS).get(); | 135 test()->verifier(), ServiceAccessType::IMPLICIT_ACCESS).get(); |
| 148 } | 136 } |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 form.origin = GURL(base::StringPrintf(kIndexedFakeOrigin, index)); | 342 form.origin = GURL(base::StringPrintf(kIndexedFakeOrigin, index)); |
| 355 form.username_value = | 343 form.username_value = |
| 356 base::ASCIIToUTF16(base::StringPrintf("username%d", index)); | 344 base::ASCIIToUTF16(base::StringPrintf("username%d", index)); |
| 357 form.password_value = | 345 form.password_value = |
| 358 base::ASCIIToUTF16(base::StringPrintf("password%d", index)); | 346 base::ASCIIToUTF16(base::StringPrintf("password%d", index)); |
| 359 form.date_created = base::Time::Now(); | 347 form.date_created = base::Time::Now(); |
| 360 return form; | 348 return form; |
| 361 } | 349 } |
| 362 | 350 |
| 363 } // namespace passwords_helper | 351 } // namespace passwords_helper |
| OLD | NEW |