OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/password_manager_presenter.h" |
| 6 |
5 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> |
6 | 9 |
7 #include "base/macros.h" | 10 #include "base/macros.h" |
8 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
9 #include "build/build_config.h" | 12 #include "build/build_config.h" |
10 #include "chrome/browser/password_manager/password_store_factory.h" | 13 #include "chrome/browser/password_manager/password_store_factory.h" |
11 #include "chrome/browser/ui/passwords/password_manager_presenter.h" | |
12 #include "chrome/browser/ui/passwords/password_ui_view.h" | 14 #include "chrome/browser/ui/passwords/password_ui_view.h" |
13 #include "chrome/test/base/testing_profile.h" | 15 #include "chrome/test/base/testing_profile.h" |
14 #include "components/password_manager/core/browser/mock_password_store.h" | 16 #include "components/password_manager/core/browser/mock_password_store.h" |
15 #include "components/password_manager/core/browser/password_manager_test_utils.h
" | 17 #include "components/password_manager/core/browser/password_manager_test_utils.h
" |
16 #include "content/public/test/test_browser_thread_bundle.h" | 18 #include "content/public/test/test_browser_thread_bundle.h" |
17 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
19 | 21 |
20 using base::ASCIIToUTF16; | 22 using base::ASCIIToUTF16; |
21 using testing::Eq; | 23 using testing::Eq; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 const GURL& origin, | 88 const GURL& origin, |
87 const std::string& user_name, | 89 const std::string& user_name, |
88 const std::string& password) { | 90 const std::string& password) { |
89 scoped_ptr<autofill::PasswordForm> form(new autofill::PasswordForm()); | 91 scoped_ptr<autofill::PasswordForm> form(new autofill::PasswordForm()); |
90 form->origin = origin; | 92 form->origin = origin; |
91 form->username_element = base::ASCIIToUTF16("Email"); | 93 form->username_element = base::ASCIIToUTF16("Email"); |
92 form->username_value = base::ASCIIToUTF16(user_name); | 94 form->username_value = base::ASCIIToUTF16(user_name); |
93 form->password_element = base::ASCIIToUTF16("Passwd"); | 95 form->password_element = base::ASCIIToUTF16("Passwd"); |
94 form->password_value = base::ASCIIToUTF16(password); | 96 form->password_value = base::ASCIIToUTF16(password); |
95 mock_controller_->GetPasswordManagerPresenter()->password_list_.push_back( | 97 mock_controller_->GetPasswordManagerPresenter()->password_list_.push_back( |
96 form.Pass()); | 98 std::move(form)); |
97 } | 99 } |
98 | 100 |
99 void PasswordManagerPresenterTest::AddPasswordException(const GURL& origin) { | 101 void PasswordManagerPresenterTest::AddPasswordException(const GURL& origin) { |
100 scoped_ptr<autofill::PasswordForm> form(new autofill::PasswordForm()); | 102 scoped_ptr<autofill::PasswordForm> form(new autofill::PasswordForm()); |
101 form->origin = origin; | 103 form->origin = origin; |
102 mock_controller_->GetPasswordManagerPresenter() | 104 mock_controller_->GetPasswordManagerPresenter() |
103 ->password_exception_list_.push_back(form.Pass()); | 105 ->password_exception_list_.push_back(std::move(form)); |
104 } | 106 } |
105 | 107 |
106 void PasswordManagerPresenterTest::UpdateLists() { | 108 void PasswordManagerPresenterTest::UpdateLists() { |
107 mock_controller_->GetPasswordManagerPresenter()->SetPasswordList(); | 109 mock_controller_->GetPasswordManagerPresenter()->SetPasswordList(); |
108 mock_controller_->GetPasswordManagerPresenter()->SetPasswordExceptionList(); | 110 mock_controller_->GetPasswordManagerPresenter()->SetPasswordExceptionList(); |
109 } | 111 } |
110 | 112 |
111 namespace { | 113 namespace { |
112 | 114 |
113 TEST_F(PasswordManagerPresenterTest, UIControllerIsCalled) { | 115 TEST_F(PasswordManagerPresenterTest, UIControllerIsCalled) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 Eq(2u)), | 159 Eq(2u)), |
158 testing::_)); | 160 testing::_)); |
159 EXPECT_CALL( | 161 EXPECT_CALL( |
160 *GetUIController(), | 162 *GetUIController(), |
161 SetPasswordExceptionList(Property( | 163 SetPasswordExceptionList(Property( |
162 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(1u)))); | 164 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(1u)))); |
163 UpdateLists(); | 165 UpdateLists(); |
164 } | 166 } |
165 | 167 |
166 } // namespace | 168 } // namespace |
OLD | NEW |