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 "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
8 #include "components/autofill/core/common/password_form.h" | 8 #include "components/autofill/core/common/password_form.h" |
9 | 9 |
10 namespace password_manager { | 10 namespace password_manager { |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 bool TestPasswordStore::FormsAreEquivalent(const autofill::PasswordForm& lhs, | 40 bool TestPasswordStore::FormsAreEquivalent(const autofill::PasswordForm& lhs, |
41 const autofill::PasswordForm& rhs) { | 41 const autofill::PasswordForm& rhs) { |
42 return lhs.origin == rhs.origin && | 42 return lhs.origin == rhs.origin && |
43 lhs.username_element == rhs.username_element && | 43 lhs.username_element == rhs.username_element && |
44 lhs.username_value == rhs.username_value && | 44 lhs.username_value == rhs.username_value && |
45 lhs.password_element == rhs.password_element && | 45 lhs.password_element == rhs.password_element && |
46 lhs.signon_realm == rhs.signon_realm; | 46 lhs.signon_realm == rhs.signon_realm; |
47 } | 47 } |
48 | 48 |
49 void TestPasswordStore::GetAutofillableLoginsImpl( | |
50 scoped_ptr<GetLoginsRequest> request) { | |
51 ScopedVector<autofill::PasswordForm> results; | |
52 for (const auto& forms_for_realm : stored_passwords_) { | |
53 for (const autofill::PasswordForm& form : forms_for_realm.second) | |
54 results.push_back(new autofill::PasswordForm(form)); | |
55 } | |
56 request->NotifyConsumerWithResults(results.Pass()); | |
57 } | |
58 | |
59 PasswordStoreChangeList TestPasswordStore::AddLoginImpl( | 49 PasswordStoreChangeList TestPasswordStore::AddLoginImpl( |
60 const autofill::PasswordForm& form) { | 50 const autofill::PasswordForm& form) { |
61 PasswordStoreChangeList changes; | 51 PasswordStoreChangeList changes; |
62 stored_passwords_[form.signon_realm].push_back(form); | 52 stored_passwords_[form.signon_realm].push_back(form); |
63 changes.push_back(PasswordStoreChange(PasswordStoreChange::ADD, form)); | 53 changes.push_back(PasswordStoreChange(PasswordStoreChange::ADD, form)); |
64 return changes; | 54 return changes; |
65 } | 55 } |
66 | 56 |
67 PasswordStoreChangeList TestPasswordStore::UpdateLoginImpl( | 57 PasswordStoreChangeList TestPasswordStore::UpdateLoginImpl( |
68 const autofill::PasswordForm& form) { | 58 const autofill::PasswordForm& form) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 return changes; | 109 return changes; |
120 } | 110 } |
121 | 111 |
122 PasswordStoreChangeList TestPasswordStore::RemoveLoginsSyncedBetweenImpl( | 112 PasswordStoreChangeList TestPasswordStore::RemoveLoginsSyncedBetweenImpl( |
123 base::Time begin, | 113 base::Time begin, |
124 base::Time end) { | 114 base::Time end) { |
125 PasswordStoreChangeList changes; | 115 PasswordStoreChangeList changes; |
126 return changes; | 116 return changes; |
127 } | 117 } |
128 | 118 |
129 void TestPasswordStore::GetBlacklistLoginsImpl( | |
130 scoped_ptr<GetLoginsRequest> request) { | |
131 } | |
132 | |
133 bool TestPasswordStore::FillAutofillableLogins( | 119 bool TestPasswordStore::FillAutofillableLogins( |
134 ScopedVector<autofill::PasswordForm>* forms) { | 120 ScopedVector<autofill::PasswordForm>* forms) { |
| 121 for (const auto& forms_for_realm : stored_passwords_) { |
| 122 for (const autofill::PasswordForm& form : forms_for_realm.second) |
| 123 forms->push_back(new autofill::PasswordForm(form)); |
| 124 } |
135 return true; | 125 return true; |
136 } | 126 } |
137 | 127 |
138 bool TestPasswordStore::FillBlacklistLogins( | 128 bool TestPasswordStore::FillBlacklistLogins( |
139 ScopedVector<autofill::PasswordForm>* forms) { | 129 ScopedVector<autofill::PasswordForm>* forms) { |
140 return true; | 130 return true; |
141 } | 131 } |
142 | 132 |
143 void TestPasswordStore::AddSiteStatsImpl(const InteractionsStats& stats) { | 133 void TestPasswordStore::AddSiteStatsImpl(const InteractionsStats& stats) { |
144 } | 134 } |
145 | 135 |
146 void TestPasswordStore::RemoveSiteStatsImpl(const GURL& origin_domain) { | 136 void TestPasswordStore::RemoveSiteStatsImpl(const GURL& origin_domain) { |
147 } | 137 } |
148 | 138 |
149 scoped_ptr<InteractionsStats> TestPasswordStore::GetSiteStatsImpl( | 139 scoped_ptr<InteractionsStats> TestPasswordStore::GetSiteStatsImpl( |
150 const GURL& origin_domain) { | 140 const GURL& origin_domain) { |
151 return scoped_ptr<InteractionsStats>(); | 141 return scoped_ptr<InteractionsStats>(); |
152 } | 142 } |
153 | 143 |
154 } // namespace password_manager | 144 } // namespace password_manager |
OLD | NEW |