OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/test_password_store.h" | 5 #include "chrome/browser/password_manager/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 // static | 9 // static |
10 scoped_refptr<RefcountedBrowserContextKeyedService> TestPasswordStore::Create( | 10 scoped_refptr<RefcountedBrowserContextKeyedService> TestPasswordStore::Create( |
11 content::BrowserContext* profile) { | 11 content::BrowserContext* profile) { |
12 return make_scoped_refptr(new TestPasswordStore); | 12 return make_scoped_refptr(new TestPasswordStore); |
13 } | 13 } |
14 | 14 |
15 TestPasswordStore::TestPasswordStore() : PasswordStore() {} | 15 TestPasswordStore::TestPasswordStore() |
| 16 : PasswordStore(base::MessageLoopProxy::current(), |
| 17 base::MessageLoopProxy::current()) { |
| 18 } |
| 19 |
16 TestPasswordStore::~TestPasswordStore() {} | 20 TestPasswordStore::~TestPasswordStore() {} |
17 | 21 |
18 TestPasswordStore::PasswordMap TestPasswordStore::stored_passwords() { | 22 TestPasswordStore::PasswordMap TestPasswordStore::stored_passwords() { |
19 return stored_passwords_; | 23 return stored_passwords_; |
20 } | 24 } |
21 | 25 |
22 void TestPasswordStore::Clear() { | 26 void TestPasswordStore::Clear() { |
23 stored_passwords_.clear(); | 27 stored_passwords_.clear(); |
24 } | 28 } |
25 | 29 |
26 bool TestPasswordStore::FormsAreEquivalent(const autofill::PasswordForm& lhs, | 30 bool TestPasswordStore::FormsAreEquivalent(const autofill::PasswordForm& lhs, |
27 const autofill::PasswordForm& rhs) { | 31 const autofill::PasswordForm& rhs) { |
28 return lhs.origin == rhs.origin && | 32 return lhs.origin == rhs.origin && |
29 lhs.username_element == rhs.username_element && | 33 lhs.username_element == rhs.username_element && |
30 lhs.username_value == rhs.username_value && | 34 lhs.username_value == rhs.username_value && |
31 lhs.password_element == rhs.password_element && | 35 lhs.password_element == rhs.password_element && |
32 lhs.signon_realm == rhs.signon_realm; | 36 lhs.signon_realm == rhs.signon_realm; |
33 } | 37 } |
34 | 38 |
35 scoped_refptr<base::SequencedTaskRunner> TestPasswordStore::GetTaskRunner() { | |
36 return base::MessageLoopProxy::current(); | |
37 } | |
38 | |
39 void TestPasswordStore::WrapModificationTask(base::Closure task) { | 39 void TestPasswordStore::WrapModificationTask(base::Closure task) { |
40 task.Run(); | 40 task.Run(); |
41 } | 41 } |
42 | 42 |
43 void TestPasswordStore::AddLoginImpl(const autofill::PasswordForm& form) { | 43 void TestPasswordStore::AddLoginImpl(const autofill::PasswordForm& form) { |
44 stored_passwords_[form.signon_realm].push_back(form); | 44 stored_passwords_[form.signon_realm].push_back(form); |
45 } | 45 } |
46 | 46 |
47 void TestPasswordStore::UpdateLoginImpl(const autofill::PasswordForm& form) { | 47 void TestPasswordStore::UpdateLoginImpl(const autofill::PasswordForm& form) { |
48 std::vector<autofill::PasswordForm>& forms = | 48 std::vector<autofill::PasswordForm>& forms = |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 bool TestPasswordStore::FillAutofillableLogins( | 84 bool TestPasswordStore::FillAutofillableLogins( |
85 std::vector<autofill::PasswordForm*>* forms) { | 85 std::vector<autofill::PasswordForm*>* forms) { |
86 return true; | 86 return true; |
87 } | 87 } |
88 | 88 |
89 bool TestPasswordStore::FillBlacklistLogins( | 89 bool TestPasswordStore::FillBlacklistLogins( |
90 std::vector<autofill::PasswordForm*>* forms) { | 90 std::vector<autofill::PasswordForm*>* forms) { |
91 return true; | 91 return true; |
92 } | 92 } |
OLD | NEW |