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/content/browser/credential_manager_impl.h" | 5 #include "components/password_manager/content/browser/credential_manager_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 explicit MockPasswordManagerClient(PasswordStore* store) : store_(store) { | 75 explicit MockPasswordManagerClient(PasswordStore* store) : store_(store) { |
76 prefs_.registry()->RegisterBooleanPref(prefs::kCredentialsEnableAutosignin, | 76 prefs_.registry()->RegisterBooleanPref(prefs::kCredentialsEnableAutosignin, |
77 true); | 77 true); |
78 prefs_.registry()->RegisterBooleanPref( | 78 prefs_.registry()->RegisterBooleanPref( |
79 prefs::kWasAutoSignInFirstRunExperienceShown, true); | 79 prefs::kWasAutoSignInFirstRunExperienceShown, true); |
80 } | 80 } |
81 ~MockPasswordManagerClient() override {} | 81 ~MockPasswordManagerClient() override {} |
82 | 82 |
83 bool PromptUserToSaveOrUpdatePassword( | 83 bool PromptUserToSaveOrUpdatePassword( |
84 std::unique_ptr<PasswordFormManager> manager, | 84 scoped_refptr<PasswordFormManager> manager, |
85 bool update_password) override { | 85 bool update_password) override { |
86 manager_.swap(manager); | 86 manager_.swap(manager); |
87 PromptUserToSavePasswordPtr(manager_.get()); | 87 PromptUserToSavePasswordPtr(manager_.get()); |
88 return true; | 88 return true; |
89 } | 89 } |
90 | 90 |
91 void NotifyUserCouldBeAutoSignedIn( | 91 void NotifyUserCouldBeAutoSignedIn( |
92 std::unique_ptr<autofill::PasswordForm> form) override { | 92 std::unique_ptr<autofill::PasswordForm> form) override { |
93 NotifyUserCouldBeAutoSignedInPtr(form.get()); | 93 NotifyUserCouldBeAutoSignedInPtr(form.get()); |
94 } | 94 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 129 } |
130 | 130 |
131 void set_first_run_seen(bool first_run_seen) { | 131 void set_first_run_seen(bool first_run_seen) { |
132 prefs_.SetBoolean(prefs::kWasAutoSignInFirstRunExperienceShown, | 132 prefs_.SetBoolean(prefs::kWasAutoSignInFirstRunExperienceShown, |
133 first_run_seen); | 133 first_run_seen); |
134 } | 134 } |
135 | 135 |
136 private: | 136 private: |
137 TestingPrefServiceSimple prefs_; | 137 TestingPrefServiceSimple prefs_; |
138 PasswordStore* store_; | 138 PasswordStore* store_; |
139 std::unique_ptr<PasswordFormManager> manager_; | 139 scoped_refptr<PasswordFormManager> manager_; |
140 | 140 |
141 DISALLOW_COPY_AND_ASSIGN(MockPasswordManagerClient); | 141 DISALLOW_COPY_AND_ASSIGN(MockPasswordManagerClient); |
142 }; | 142 }; |
143 | 143 |
144 class TestCredentialManagerImpl : public CredentialManagerImpl { | 144 class TestCredentialManagerImpl : public CredentialManagerImpl { |
145 public: | 145 public: |
146 TestCredentialManagerImpl(content::WebContents* web_contents, | 146 TestCredentialManagerImpl(content::WebContents* web_contents, |
147 PasswordManagerClient* client, | 147 PasswordManagerClient* client, |
148 PasswordManagerDriver* driver); | 148 PasswordManagerDriver* driver); |
149 | 149 |
(...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1621 EXPECT_CALL(*client_, PromptUserToSavePasswordPtr(_)); | 1621 EXPECT_CALL(*client_, PromptUserToSavePasswordPtr(_)); |
1622 CallStore(info, base::Bind(&RespondCallback, &called)); | 1622 CallStore(info, base::Bind(&RespondCallback, &called)); |
1623 // Allow the PasswordFormManager to talk to the password store | 1623 // Allow the PasswordFormManager to talk to the password store |
1624 RunAllPendingTasks(); | 1624 RunAllPendingTasks(); |
1625 | 1625 |
1626 ASSERT_TRUE(client_->pending_manager()); | 1626 ASSERT_TRUE(client_->pending_manager()); |
1627 EXPECT_TRUE(client_->pending_manager()->IsBlacklisted()); | 1627 EXPECT_TRUE(client_->pending_manager()->IsBlacklisted()); |
1628 } | 1628 } |
1629 | 1629 |
1630 } // namespace password_manager | 1630 } // namespace password_manager |
OLD | NEW |