Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/password_manager/core/browser/test_password_store.h" | 5 #include "components/password_manager/core/browser/test_password_store.h" |
| 6 | 6 |
| 7 #include "components/autofill/core/common/password_form.h" | 7 #include "components/autofill/core/common/password_form.h" |
| 8 | 8 |
| 9 namespace password_manager { | 9 namespace password_manager { |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 bool TestPasswordStore::FormsAreEquivalent(const autofill::PasswordForm& lhs, | 39 bool TestPasswordStore::FormsAreEquivalent(const autofill::PasswordForm& lhs, |
| 40 const autofill::PasswordForm& rhs) { | 40 const autofill::PasswordForm& rhs) { |
| 41 return lhs.origin == rhs.origin && | 41 return lhs.origin == rhs.origin && |
| 42 lhs.username_element == rhs.username_element && | 42 lhs.username_element == rhs.username_element && |
| 43 lhs.username_value == rhs.username_value && | 43 lhs.username_value == rhs.username_value && |
| 44 lhs.password_element == rhs.password_element && | 44 lhs.password_element == rhs.password_element && |
| 45 lhs.signon_realm == rhs.signon_realm; | 45 lhs.signon_realm == rhs.signon_realm; |
| 46 } | 46 } |
| 47 | 47 |
| 48 void TestPasswordStore::GetAutofillableLoginsImpl( | 48 void TestPasswordStore::GetAutofillableLoginsImpl( |
| 49 PasswordStore::GetLoginsRequest* request) { | 49 scoped_ptr<GetLoginsRequest> request) { |
| 50 for (auto& forms_for_realm : stored_passwords_) { | 50 for (auto& forms_for_realm : stored_passwords_) { |
|
vasilii
2015/02/09 10:08:35
const auto&
vabr (Chromium)
2015/02/09 11:36:06
Done.
| |
| 51 for (const autofill::PasswordForm& form : forms_for_realm.second) | 51 for (const autofill::PasswordForm& form : forms_for_realm.second) |
| 52 request->result()->push_back(new autofill::PasswordForm(form)); | 52 request->result()->push_back(new autofill::PasswordForm(form)); |
| 53 } | 53 } |
| 54 ForwardLoginsResult(request); | 54 ForwardLoginsResult(request.Pass()); |
| 55 } | 55 } |
| 56 | 56 |
| 57 PasswordStoreChangeList TestPasswordStore::AddLoginImpl( | 57 PasswordStoreChangeList TestPasswordStore::AddLoginImpl( |
| 58 const autofill::PasswordForm& form) { | 58 const autofill::PasswordForm& form) { |
| 59 PasswordStoreChangeList changes; | 59 PasswordStoreChangeList changes; |
| 60 stored_passwords_[form.signon_realm].push_back(form); | 60 stored_passwords_[form.signon_realm].push_back(form); |
| 61 changes.push_back(PasswordStoreChange(PasswordStoreChange::ADD, form)); | 61 changes.push_back(PasswordStoreChange(PasswordStoreChange::ADD, form)); |
| 62 return changes; | 62 return changes; |
| 63 } | 63 } |
| 64 | 64 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 const PasswordStore::ConsumerCallbackRunner& runner) { | 100 const PasswordStore::ConsumerCallbackRunner& runner) { |
| 101 ScopedVector<autofill::PasswordForm> matched_forms; | 101 ScopedVector<autofill::PasswordForm> matched_forms; |
| 102 std::vector<autofill::PasswordForm> forms = | 102 std::vector<autofill::PasswordForm> forms = |
| 103 stored_passwords_[form.signon_realm]; | 103 stored_passwords_[form.signon_realm]; |
| 104 for (const auto& stored_form : forms) { | 104 for (const auto& stored_form : forms) { |
| 105 matched_forms.push_back(new autofill::PasswordForm(stored_form)); | 105 matched_forms.push_back(new autofill::PasswordForm(stored_form)); |
| 106 } | 106 } |
| 107 runner.Run(matched_forms.Pass()); | 107 runner.Run(matched_forms.Pass()); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void TestPasswordStore::ReportMetricsImpl(const std::string& sync_username, | |
| 111 bool custom_passphrase_sync_enabled) { | |
| 112 } | |
| 113 | |
| 110 PasswordStoreChangeList TestPasswordStore::RemoveLoginsCreatedBetweenImpl( | 114 PasswordStoreChangeList TestPasswordStore::RemoveLoginsCreatedBetweenImpl( |
| 111 base::Time begin, | 115 base::Time begin, |
| 112 base::Time end) { | 116 base::Time end) { |
| 113 PasswordStoreChangeList changes; | 117 PasswordStoreChangeList changes; |
| 114 return changes; | 118 return changes; |
| 115 } | 119 } |
| 116 | 120 |
| 117 PasswordStoreChangeList TestPasswordStore::RemoveLoginsSyncedBetweenImpl( | 121 PasswordStoreChangeList TestPasswordStore::RemoveLoginsSyncedBetweenImpl( |
| 118 base::Time begin, | 122 base::Time begin, |
| 119 base::Time end) { | 123 base::Time end) { |
| 120 PasswordStoreChangeList changes; | 124 PasswordStoreChangeList changes; |
| 121 return changes; | 125 return changes; |
| 122 } | 126 } |
| 123 | 127 |
| 128 void TestPasswordStore::GetBlacklistLoginsImpl( | |
| 129 scoped_ptr<GetLoginsRequest> request) { | |
| 130 } | |
| 131 | |
| 124 bool TestPasswordStore::FillAutofillableLogins( | 132 bool TestPasswordStore::FillAutofillableLogins( |
| 125 ScopedVector<autofill::PasswordForm>* forms) { | 133 ScopedVector<autofill::PasswordForm>* forms) { |
| 126 return true; | 134 return true; |
| 127 } | 135 } |
| 128 | 136 |
| 129 bool TestPasswordStore::FillBlacklistLogins( | 137 bool TestPasswordStore::FillBlacklistLogins( |
| 130 ScopedVector<autofill::PasswordForm>* forms) { | 138 ScopedVector<autofill::PasswordForm>* forms) { |
| 131 return true; | 139 return true; |
| 132 } | 140 } |
| 133 | 141 |
| 134 } // namespace password_manager | 142 } // namespace password_manager |
| OLD | NEW |