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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/prefs/pref_registry_simple.h" | 7 #include "base/prefs/pref_registry_simple.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/prefs/testing_pref_service.h" | 9 #include "base/prefs/testing_pref_service.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 autofill::PasswordForm form_to_filter_; | 118 autofill::PasswordForm form_to_filter_; |
119 | 119 |
120 TestingPrefServiceSimple prefs_; | 120 TestingPrefServiceSimple prefs_; |
121 PasswordStore* password_store_; | 121 PasswordStore* password_store_; |
122 NiceMock<MockPasswordManagerDriver> driver_; | 122 NiceMock<MockPasswordManagerDriver> driver_; |
123 }; | 123 }; |
124 | 124 |
125 class TestPasswordManager : public PasswordManager { | 125 class TestPasswordManager : public PasswordManager { |
126 public: | 126 public: |
127 explicit TestPasswordManager(PasswordManagerClient* client) | 127 explicit TestPasswordManager(PasswordManagerClient* client) |
128 : PasswordManager(client) {} | 128 : PasswordManager(client, client->GetDriver()) {} |
129 | 129 |
130 void Autofill(const autofill::PasswordForm& form_for_autofill, | 130 void Autofill(const autofill::PasswordForm& form_for_autofill, |
131 const autofill::PasswordFormMap& best_matches, | 131 const autofill::PasswordFormMap& best_matches, |
132 const autofill::PasswordForm& preferred_match, | 132 const autofill::PasswordForm& preferred_match, |
133 bool wait_for_username) const override { | 133 bool wait_for_username) const override { |
134 best_matches_ = best_matches; | 134 best_matches_ = best_matches; |
135 } | 135 } |
136 | 136 |
137 const autofill::PasswordFormMap& GetLatestBestMatches() { | 137 const autofill::PasswordFormMap& GetLatestBestMatches() { |
138 return best_matches_; | 138 return best_matches_; |
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1286 PasswordStore::ALLOW_PROMPT); | 1286 PasswordStore::ALLOW_PROMPT); |
1287 RunAllPendingTasks(); | 1287 RunAllPendingTasks(); |
1288 | 1288 |
1289 // Make sure that the preferred match is updated appropriately. | 1289 // Make sure that the preferred match is updated appropriately. |
1290 EXPECT_EQ(ASCIIToUTF16("password"), | 1290 EXPECT_EQ(ASCIIToUTF16("password"), |
1291 retrieving_manager.preferred_match()->password_value); | 1291 retrieving_manager.preferred_match()->password_value); |
1292 password_store->Shutdown(); | 1292 password_store->Shutdown(); |
1293 } | 1293 } |
1294 | 1294 |
1295 } // namespace password_manager | 1295 } // namespace password_manager |
OLD | NEW |