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

Side by Side Diff: chrome/browser/password_manager/password_manager_browsertest.cc

Issue 1488763003: [Password Manager] Switch password manager code to use "base/feature_list.h". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses nit. Created 5 years 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
OLDNEW
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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram_samples.h" 8 #include "base/metrics/histogram_samples.h"
9 #include "base/metrics/statistics_recorder.h" 9 #include "base/metrics/statistics_recorder.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 18 matching lines...) Expand all
29 #include "chrome/test/base/test_switches.h" 29 #include "chrome/test/base/test_switches.h"
30 #include "chrome/test/base/ui_test_utils.h" 30 #include "chrome/test/base/ui_test_utils.h"
31 #include "components/autofill/content/common/autofill_messages.h" 31 #include "components/autofill/content/common/autofill_messages.h"
32 #include "components/autofill/core/browser/autofill_test_utils.h" 32 #include "components/autofill/core/browser/autofill_test_utils.h"
33 #include "components/autofill/core/browser/test_autofill_client.h" 33 #include "components/autofill/core/browser/test_autofill_client.h"
34 #include "components/autofill/core/common/password_form.h" 34 #include "components/autofill/core/common/password_form.h"
35 #include "components/password_manager/content/browser/content_password_manager_d river.h" 35 #include "components/password_manager/content/browser/content_password_manager_d river.h"
36 #include "components/password_manager/content/browser/content_password_manager_d river_factory.h" 36 #include "components/password_manager/content/browser/content_password_manager_d river_factory.h"
37 #include "components/password_manager/core/browser/login_model.h" 37 #include "components/password_manager/core/browser/login_model.h"
38 #include "components/password_manager/core/browser/test_password_store.h" 38 #include "components/password_manager/core/browser/test_password_store.h"
39 #include "components/password_manager/core/common/password_manager_features.h"
39 #include "components/password_manager/core/common/password_manager_switches.h" 40 #include "components/password_manager/core/common/password_manager_switches.h"
40 #include "components/version_info/version_info.h" 41 #include "components/version_info/version_info.h"
41 #include "content/public/browser/navigation_controller.h" 42 #include "content/public/browser/navigation_controller.h"
42 #include "content/public/browser/notification_service.h" 43 #include "content/public/browser/notification_service.h"
43 #include "content/public/browser/render_frame_host.h" 44 #include "content/public/browser/render_frame_host.h"
44 #include "content/public/browser/render_process_host.h" 45 #include "content/public/browser/render_process_host.h"
45 #include "content/public/browser/render_view_host.h" 46 #include "content/public/browser/render_view_host.h"
46 #include "content/public/browser/web_contents.h" 47 #include "content/public/browser/web_contents.h"
47 #include "content/public/browser/web_contents_observer.h" 48 #include "content/public/browser/web_contents_observer.h"
48 #include "content/public/common/content_switches.h" 49 #include "content/public/common/content_switches.h"
(...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 DontPromptWhenEnableAutomaticPasswordSavingSwitchIsSet) { 1185 DontPromptWhenEnableAutomaticPasswordSavingSwitchIsSet) {
1185 scoped_refptr<password_manager::TestPasswordStore> password_store = 1186 scoped_refptr<password_manager::TestPasswordStore> password_store =
1186 static_cast<password_manager::TestPasswordStore*>( 1187 static_cast<password_manager::TestPasswordStore*>(
1187 PasswordStoreFactory::GetForProfile( 1188 PasswordStoreFactory::GetForProfile(
1188 browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS).get()); 1189 browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS).get());
1189 1190
1190 EXPECT_TRUE(password_store->IsEmpty()); 1191 EXPECT_TRUE(password_store->IsEmpty());
1191 1192
1192 NavigateToFile("/password/password_form.html"); 1193 NavigateToFile("/password/password_form.html");
1193 1194
1194 // Add the enable-automatic-password-saving switch. 1195 // Add the enable-automatic-password-saving feature.
1195 base::CommandLine::ForCurrentProcess()->AppendSwitch( 1196 base::FeatureList::ClearInstanceForTesting();
1196 password_manager::switches::kEnableAutomaticPasswordSaving); 1197 scoped_ptr<base::FeatureList> feature_list(new base::FeatureList);
1198 feature_list->InitializeFromCommandLine(
1199 password_manager::features::kEnableAutomaticPasswordSaving.name, "");
1200 base::FeatureList::SetInstance(std::move(feature_list));
1197 1201
1198 // Fill a form and submit through a <input type="submit"> button. 1202 // Fill a form and submit through a <input type="submit"> button.
1199 NavigationObserver observer(WebContents()); 1203 NavigationObserver observer(WebContents());
1200 scoped_ptr<PromptObserver> prompt_observer( 1204 scoped_ptr<PromptObserver> prompt_observer(
1201 PromptObserver::Create(WebContents())); 1205 PromptObserver::Create(WebContents()));
1202 // Make sure that the only passwords saved are the auto-saved ones. 1206 // Make sure that the only passwords saved are the auto-saved ones.
1203 std::string fill_and_submit = 1207 std::string fill_and_submit =
1204 "document.getElementById('username_field').value = 'temp';" 1208 "document.getElementById('username_field').value = 'temp';"
1205 "document.getElementById('password_field').value = 'random';" 1209 "document.getElementById('password_field').value = 'random';"
1206 "document.getElementById('input_submit_button').click()"; 1210 "document.getElementById('input_submit_button').click()";
(...skipping 1689 matching lines...) Expand 10 before | Expand all | Expand 10 after
2896 std::string submit = 2900 std::string submit =
2897 "document.getElementById('username').value = 'temp';" 2901 "document.getElementById('username').value = 'temp';"
2898 "document.getElementById('password').value = 'mypassword';" 2902 "document.getElementById('password').value = 'mypassword';"
2899 "document.getElementById('submit').click();"; 2903 "document.getElementById('submit').click();";
2900 VerifyPasswordIsSavedAndFilled( 2904 VerifyPasswordIsSavedAndFilled(
2901 "/password/password_autocomplete_off_test.html", submit, "password", 2905 "/password/password_autocomplete_off_test.html", submit, "password",
2902 "mypassword"); 2906 "mypassword");
2903 } 2907 }
2904 2908
2905 } // namespace password_manager 2909 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698