Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1157)

Side by Side Diff: chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc

Issue 2090583003: Introduce password_manager::FormSaver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/passwords/manage_passwords_test.cc ('k') | components/components_tests.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <memory> 5 #include <memory>
6 #include <utility> 6 #include <utility>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" 15 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
16 #include "chrome/browser/ui/passwords/manage_passwords_icon_view.h" 16 #include "chrome/browser/ui/passwords/manage_passwords_icon_view.h"
17 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h" 17 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h"
18 #include "chrome/browser/ui/passwords/password_dialog_controller.h" 18 #include "chrome/browser/ui/passwords/password_dialog_controller.h"
19 #include "chrome/browser/ui/passwords/password_dialog_prompts.h" 19 #include "chrome/browser/ui/passwords/password_dialog_prompts.h"
20 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 20 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
21 #include "chrome/test/base/testing_profile.h" 21 #include "chrome/test/base/testing_profile.h"
22 #include "components/autofill/core/common/password_form.h" 22 #include "components/autofill/core/common/password_form.h"
23 #include "components/password_manager/core/browser/password_bubble_experiment.h" 23 #include "components/password_manager/core/browser/password_bubble_experiment.h"
24 #include "components/password_manager/core/browser/password_form_manager.h" 24 #include "components/password_manager/core/browser/password_form_manager.h"
25 #include "components/password_manager/core/browser/password_manager.h" 25 #include "components/password_manager/core/browser/password_manager.h"
26 #include "components/password_manager/core/browser/statistics_table.h" 26 #include "components/password_manager/core/browser/statistics_table.h"
27 #include "components/password_manager/core/browser/stub_form_saver.h"
27 #include "components/password_manager/core/browser/stub_password_manager_client. h" 28 #include "components/password_manager/core/browser/stub_password_manager_client. h"
28 #include "components/password_manager/core/browser/stub_password_manager_driver. h" 29 #include "components/password_manager/core/browser/stub_password_manager_driver. h"
29 #include "components/password_manager/core/common/password_manager_ui.h" 30 #include "components/password_manager/core/common/password_manager_ui.h"
30 #include "components/prefs/pref_service.h" 31 #include "components/prefs/pref_service.h"
31 #include "components/variations/variations_associated_data.h" 32 #include "components/variations/variations_associated_data.h"
32 #include "content/public/browser/navigation_details.h" 33 #include "content/public/browser/navigation_details.h"
33 #include "content/public/test/test_browser_thread_bundle.h" 34 #include "content/public/test/test_browser_thread_bundle.h"
34 #include "content/public/test/web_contents_tester.h" 35 #include "content/public/test/web_contents_tester.h"
35 #include "testing/gmock/include/gmock/gmock.h" 36 #include "testing/gmock/include/gmock/gmock.h"
36 #include "testing/gtest/include/gtest/gtest.h" 37 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 password_manager::ui::State state) { 227 password_manager::ui::State state) {
227 ExpectIconStateIs(state); 228 ExpectIconStateIs(state);
228 EXPECT_EQ(state, controller()->GetState()); 229 EXPECT_EQ(state, controller()->GetState());
229 } 230 }
230 231
231 std::unique_ptr<password_manager::PasswordFormManager> 232 std::unique_ptr<password_manager::PasswordFormManager>
232 ManagePasswordsUIControllerTest::CreateFormManagerWithBestMatches( 233 ManagePasswordsUIControllerTest::CreateFormManagerWithBestMatches(
233 const autofill::PasswordForm& observed_form, 234 const autofill::PasswordForm& observed_form,
234 ScopedVector<autofill::PasswordForm> best_matches) { 235 ScopedVector<autofill::PasswordForm> best_matches) {
235 std::unique_ptr<password_manager::PasswordFormManager> test_form_manager( 236 std::unique_ptr<password_manager::PasswordFormManager> test_form_manager(
236 new password_manager::PasswordFormManager(&password_manager_, &client_, 237 new password_manager::PasswordFormManager(
237 driver_.AsWeakPtr(), 238 &password_manager_, &client_, driver_.AsWeakPtr(), observed_form,
238 observed_form, true)); 239 true, base::WrapUnique(new password_manager::StubFormSaver)));
239 test_form_manager->SimulateFetchMatchingLoginsFromPasswordStore(); 240 test_form_manager->SimulateFetchMatchingLoginsFromPasswordStore();
240 test_form_manager->OnGetPasswordStoreResults(std::move(best_matches)); 241 test_form_manager->OnGetPasswordStoreResults(std::move(best_matches));
241 return test_form_manager; 242 return test_form_manager;
242 } 243 }
243 244
244 std::unique_ptr<password_manager::PasswordFormManager> 245 std::unique_ptr<password_manager::PasswordFormManager>
245 ManagePasswordsUIControllerTest::CreateFormManager() { 246 ManagePasswordsUIControllerTest::CreateFormManager() {
246 ScopedVector<autofill::PasswordForm> stored_forms; 247 ScopedVector<autofill::PasswordForm> stored_forms;
247 stored_forms.push_back(new autofill::PasswordForm(test_local_form())); 248 stored_forms.push_back(new autofill::PasswordForm(test_local_form()));
248 return CreateFormManagerWithBestMatches(test_local_form(), 249 return CreateFormManagerWithBestMatches(test_local_form(),
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 } 736 }
736 737
737 TEST_F(ManagePasswordsUIControllerTest, UpdatePendingStatePasswordAutofilled) { 738 TEST_F(ManagePasswordsUIControllerTest, UpdatePendingStatePasswordAutofilled) {
738 TestNotChangingStateOnAutofill( 739 TestNotChangingStateOnAutofill(
739 password_manager::ui::PENDING_PASSWORD_UPDATE_STATE); 740 password_manager::ui::PENDING_PASSWORD_UPDATE_STATE);
740 } 741 }
741 742
742 TEST_F(ManagePasswordsUIControllerTest, ConfirmationStatePasswordAutofilled) { 743 TEST_F(ManagePasswordsUIControllerTest, ConfirmationStatePasswordAutofilled) {
743 TestNotChangingStateOnAutofill(password_manager::ui::CONFIRMATION_STATE); 744 TestNotChangingStateOnAutofill(password_manager::ui::CONFIRMATION_STATE);
744 } 745 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/passwords/manage_passwords_test.cc ('k') | components/components_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698