| 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 class AutofillManager; | 30 class AutofillManager; |
| 31 } | 31 } |
| 32 | 32 |
| 33 namespace { | 33 namespace { |
| 34 | 34 |
| 35 class MockPasswordManagerDriver : public PasswordManagerDriver { | 35 class MockPasswordManagerDriver : public PasswordManagerDriver { |
| 36 public: | 36 public: |
| 37 MockPasswordManagerDriver() {} | 37 MockPasswordManagerDriver() {} |
| 38 virtual ~MockPasswordManagerDriver() {} | 38 virtual ~MockPasswordManagerDriver() {} |
| 39 | 39 |
| 40 MOCK_METHOD1(FillPasswordForm, | 40 MOCK_METHOD1(FillPasswordForm, void(const autofill::PasswordFormFillData&)); |
| 41 void(const autofill::PasswordFormFillData& form_data)); | |
| 42 MOCK_METHOD0(DidLastPageLoadEncounterSSLErrors, bool()); | 41 MOCK_METHOD0(DidLastPageLoadEncounterSSLErrors, bool()); |
| 43 MOCK_METHOD0(IsOffTheRecord, bool()); | 42 MOCK_METHOD0(IsOffTheRecord, bool()); |
| 44 MOCK_METHOD0(GetPasswordGenerationManager, PasswordGenerationManager*()); | 43 MOCK_METHOD0(GetPasswordGenerationManager, PasswordGenerationManager*()); |
| 45 MOCK_METHOD0(GetPasswordManager, PasswordManager*()); | 44 MOCK_METHOD0(GetPasswordManager, PasswordManager*()); |
| 46 MOCK_METHOD0(GetAutofillManager, autofill::AutofillManager*()); | 45 MOCK_METHOD0(GetAutofillManager, autofill::AutofillManager*()); |
| 47 MOCK_METHOD1(AllowPasswordGenerationForForm, | 46 MOCK_METHOD1(AllowPasswordGenerationForForm, void(autofill::PasswordForm*)); |
| 48 void(autofill::PasswordForm* form)); | 47 MOCK_METHOD1(AccountCreationFormsFound, |
| 48 void(const std::vector<autofill::FormData>&)); |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 class TestPasswordManagerClient : public PasswordManagerClient { | 51 class TestPasswordManagerClient : public PasswordManagerClient { |
| 52 public: | 52 public: |
| 53 explicit TestPasswordManagerClient(Profile* profile, | 53 explicit TestPasswordManagerClient(Profile* profile, |
| 54 PasswordStore* password_store) | 54 PasswordStore* password_store) |
| 55 : profile_(profile), | 55 : profile_(profile), |
| 56 password_store_(password_store) {} | 56 password_store_(password_store) {} |
| 57 | 57 |
| 58 virtual void PromptUserToSavePassword(PasswordFormManager* form_to_save) | 58 virtual void PromptUserToSavePassword(PasswordFormManager* form_to_save) |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 | 653 |
| 654 SanitizePossibleUsernames(manager.get(), &credentials); | 654 SanitizePossibleUsernames(manager.get(), &credentials); |
| 655 | 655 |
| 656 // SSN, duplicate in |other_possible_usernames| and duplicate of | 656 // SSN, duplicate in |other_possible_usernames| and duplicate of |
| 657 // |username_value| all removed. | 657 // |username_value| all removed. |
| 658 expected.clear(); | 658 expected.clear(); |
| 659 expected.push_back(ASCIIToUTF16("duplicate")); | 659 expected.push_back(ASCIIToUTF16("duplicate")); |
| 660 expected.push_back(ASCIIToUTF16("random")); | 660 expected.push_back(ASCIIToUTF16("random")); |
| 661 EXPECT_THAT(credentials.other_possible_usernames, Eq(expected)); | 661 EXPECT_THAT(credentials.other_possible_usernames, Eq(expected)); |
| 662 } | 662 } |
| OLD | NEW |