Chromium Code Reviews| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 public: | 46 public: |
| 47 MockPasswordManagerDriver() {} | 47 MockPasswordManagerDriver() {} |
| 48 virtual ~MockPasswordManagerDriver() {} | 48 virtual ~MockPasswordManagerDriver() {} |
| 49 | 49 |
| 50 MOCK_METHOD1(FillPasswordForm, void(const autofill::PasswordFormFillData&)); | 50 MOCK_METHOD1(FillPasswordForm, void(const autofill::PasswordFormFillData&)); |
| 51 MOCK_METHOD0(DidLastPageLoadEncounterSSLErrors, bool()); | 51 MOCK_METHOD0(DidLastPageLoadEncounterSSLErrors, bool()); |
| 52 MOCK_METHOD0(IsOffTheRecord, bool()); | 52 MOCK_METHOD0(IsOffTheRecord, bool()); |
| 53 MOCK_METHOD0(GetPasswordGenerationManager, PasswordGenerationManager*()); | 53 MOCK_METHOD0(GetPasswordGenerationManager, PasswordGenerationManager*()); |
| 54 MOCK_METHOD0(GetPasswordManager, PasswordManager*()); | 54 MOCK_METHOD0(GetPasswordManager, PasswordManager*()); |
| 55 MOCK_METHOD0(GetAutofillManager, autofill::AutofillManager*()); | 55 MOCK_METHOD0(GetAutofillManager, autofill::AutofillManager*()); |
| 56 MOCK_METHOD0(GetPasswordAutofillManager, PasswordAutofillManager*()); | |
| 56 MOCK_METHOD1(AllowPasswordGenerationForForm, void(autofill::PasswordForm*)); | 57 MOCK_METHOD1(AllowPasswordGenerationForForm, void(autofill::PasswordForm*)); |
| 57 MOCK_METHOD1(AccountCreationFormsFound, | 58 MOCK_METHOD1(AccountCreationFormsFound, |
| 58 void(const std::vector<autofill::FormData>&)); | 59 void(const std::vector<autofill::FormData>&)); |
| 60 MOCK_METHOD2(AcceptPasswordAutofillSuggestion, | |
| 61 void(const base::string16&, const base::string16&)); | |
|
Ilya Sherman
2014/03/18 00:14:27
nit: Why add these mock methods if they're never u
Patrick Dubroy
2014/03/28 15:44:22
They are currently pure virtuals and need to be ov
Ilya Sherman
2014/03/28 21:33:34
I'd prefer that you simply override the methods wi
| |
| 59 }; | 62 }; |
| 60 | 63 |
| 61 class TestPasswordManagerClient : public PasswordManagerClient { | 64 class TestPasswordManagerClient : public PasswordManagerClient { |
| 62 public: | 65 public: |
| 63 explicit TestPasswordManagerClient(PasswordStore* password_store) | 66 explicit TestPasswordManagerClient(PasswordStore* password_store) |
| 64 : password_store_(password_store) { | 67 : password_store_(password_store) { |
| 65 prefs_.registry()->RegisterBooleanPref(prefs::kPasswordManagerEnabled, | 68 prefs_.registry()->RegisterBooleanPref(prefs::kPasswordManagerEnabled, |
| 66 true); | 69 true); |
| 67 } | 70 } |
| 68 | 71 |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 692 | 695 |
| 693 form_manager.ProvisionallySave( | 696 form_manager.ProvisionallySave( |
| 694 complete_form, PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES); | 697 complete_form, PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES); |
| 695 // By now that form has been used once. | 698 // By now that form has been used once. |
| 696 complete_form.times_used = 1; | 699 complete_form.times_used = 1; |
| 697 | 700 |
| 698 // Check that PasswordStore receives an update request with the complete form. | 701 // Check that PasswordStore receives an update request with the complete form. |
| 699 EXPECT_CALL(*mock_store(), UpdateLogin(complete_form)); | 702 EXPECT_CALL(*mock_store(), UpdateLogin(complete_form)); |
| 700 form_manager.Save(); | 703 form_manager.Save(); |
| 701 } | 704 } |
| OLD | NEW |