OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ui/passwords/manage_passwords_state.h" | 5 #include "chrome/browser/ui/passwords/manage_passwords_state.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "components/password_manager/core/browser/password_form_manager.h" | 12 #include "components/password_manager/core/browser/password_form_manager.h" |
13 #include "components/password_manager/core/browser/password_manager.h" | 13 #include "components/password_manager/core/browser/password_manager.h" |
| 14 #include "components/password_manager/core/browser/stub_form_saver.h" |
14 #include "components/password_manager/core/browser/stub_password_manager_client.
h" | 15 #include "components/password_manager/core/browser/stub_password_manager_client.
h" |
15 #include "components/password_manager/core/browser/stub_password_manager_driver.
h" | 16 #include "components/password_manager/core/browser/stub_password_manager_driver.
h" |
16 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "url/gurl.h" | 19 #include "url/gurl.h" |
19 #include "url/origin.h" | 20 #include "url/origin.h" |
20 | 21 |
21 using ::testing::_; | 22 using ::testing::_; |
22 using ::testing::Contains; | 23 using ::testing::Contains; |
23 using ::testing::ElementsAre; | 24 using ::testing::ElementsAre; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 std::unique_ptr<password_manager::PasswordFormManager> | 112 std::unique_ptr<password_manager::PasswordFormManager> |
112 ManagePasswordsStateTest::CreateFormManagerWithFederation() { | 113 ManagePasswordsStateTest::CreateFormManagerWithFederation() { |
113 return CreateFormManagerInternal(true); | 114 return CreateFormManagerInternal(true); |
114 } | 115 } |
115 | 116 |
116 std::unique_ptr<password_manager::PasswordFormManager> | 117 std::unique_ptr<password_manager::PasswordFormManager> |
117 ManagePasswordsStateTest::CreateFormManagerInternal(bool include_federated) { | 118 ManagePasswordsStateTest::CreateFormManagerInternal(bool include_federated) { |
118 std::unique_ptr<password_manager::PasswordFormManager> test_form_manager( | 119 std::unique_ptr<password_manager::PasswordFormManager> test_form_manager( |
119 new password_manager::PasswordFormManager( | 120 new password_manager::PasswordFormManager( |
120 &password_manager_, &stub_client_, driver_.AsWeakPtr(), | 121 &password_manager_, &stub_client_, driver_.AsWeakPtr(), |
121 test_local_form(), false)); | 122 test_local_form(), false, |
| 123 base::WrapUnique(new password_manager::StubFormSaver))); |
122 test_form_manager->SimulateFetchMatchingLoginsFromPasswordStore(); | 124 test_form_manager->SimulateFetchMatchingLoginsFromPasswordStore(); |
123 if (include_federated) { | 125 if (include_federated) { |
124 test_stored_forms_.push_back( | 126 test_stored_forms_.push_back( |
125 new autofill::PasswordForm(test_local_federated_form())); | 127 new autofill::PasswordForm(test_local_federated_form())); |
126 } | 128 } |
127 test_form_manager->OnGetPasswordStoreResults(std::move(test_stored_forms_)); | 129 test_form_manager->OnGetPasswordStoreResults(std::move(test_stored_forms_)); |
128 EXPECT_EQ(include_federated ? 1u : 0u, | 130 EXPECT_EQ(include_federated ? 1u : 0u, |
129 test_form_manager->federated_matches().size()); | 131 test_form_manager->federated_matches().size()); |
130 if (include_federated) { | 132 if (include_federated) { |
131 EXPECT_EQ(test_local_federated_form(), | 133 EXPECT_EQ(test_local_federated_form(), |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 passwords_data().OnRequestCredentials(ScopedVector<autofill::PasswordForm>(), | 678 passwords_data().OnRequestCredentials(ScopedVector<autofill::PasswordForm>(), |
677 ScopedVector<autofill::PasswordForm>(), | 679 ScopedVector<autofill::PasswordForm>(), |
678 test_local_form().origin); | 680 test_local_form().origin); |
679 passwords_data().set_credentials_callback(base::Bind( | 681 passwords_data().set_credentials_callback(base::Bind( |
680 &ManagePasswordsStateTest::CredentialCallback, base::Unretained(this))); | 682 &ManagePasswordsStateTest::CredentialCallback, base::Unretained(this))); |
681 EXPECT_CALL(*this, CredentialCallback(&test_local_federated_form())); | 683 EXPECT_CALL(*this, CredentialCallback(&test_local_federated_form())); |
682 passwords_data().ChooseCredential(&test_local_federated_form()); | 684 passwords_data().ChooseCredential(&test_local_federated_form()); |
683 } | 685 } |
684 | 686 |
685 } // namespace | 687 } // namespace |
OLD | NEW |