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 <string> | 5 #include <string> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/metrics/histogram_samples.h" | 11 #include "base/metrics/histogram_samples.h" |
12 #include "base/metrics/statistics_recorder.h" | 12 #include "base/metrics/statistics_recorder.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "base/test/scoped_feature_list.h" |
18 #include "build/build_config.h" | 19 #include "build/build_config.h" |
19 #include "chrome/browser/chrome_notification_types.h" | 20 #include "chrome/browser/chrome_notification_types.h" |
20 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 21 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
21 #include "chrome/browser/password_manager/password_manager_test_base.h" | 22 #include "chrome/browser/password_manager/password_manager_test_base.h" |
22 #include "chrome/browser/password_manager/password_store_factory.h" | 23 #include "chrome/browser/password_manager/password_store_factory.h" |
23 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
25 #include "chrome/browser/ui/browser_navigator_params.h" | 26 #include "chrome/browser/ui/browser_navigator_params.h" |
26 #include "chrome/browser/ui/login/login_handler.h" | 27 #include "chrome/browser/ui/login/login_handler.h" |
27 #include "chrome/browser/ui/login/login_handler_test_utils.h" | 28 #include "chrome/browser/ui/login/login_handler_test_utils.h" |
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 scoped_refptr<password_manager::TestPasswordStore> password_store = | 1190 scoped_refptr<password_manager::TestPasswordStore> password_store = |
1190 static_cast<password_manager::TestPasswordStore*>( | 1191 static_cast<password_manager::TestPasswordStore*>( |
1191 PasswordStoreFactory::GetForProfile( | 1192 PasswordStoreFactory::GetForProfile( |
1192 browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS).get()); | 1193 browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS).get()); |
1193 | 1194 |
1194 EXPECT_TRUE(password_store->IsEmpty()); | 1195 EXPECT_TRUE(password_store->IsEmpty()); |
1195 | 1196 |
1196 NavigateToFile("/password/password_form.html"); | 1197 NavigateToFile("/password/password_form.html"); |
1197 | 1198 |
1198 // Add the enable-automatic-password-saving feature. | 1199 // Add the enable-automatic-password-saving feature. |
1199 base::FeatureList::ClearInstanceForTesting(); | 1200 base::test::ScopedFeatureList scoped_feature_list; |
1200 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); | 1201 scoped_feature_list.InitAndEnableFeature( |
1201 feature_list->InitializeFromCommandLine( | 1202 password_manager::features::kEnableAutomaticPasswordSaving); |
1202 password_manager::features::kEnableAutomaticPasswordSaving.name, ""); | |
1203 base::FeatureList::SetInstance(std::move(feature_list)); | |
1204 | 1203 |
1205 // Fill a form and submit through a <input type="submit"> button. | 1204 // Fill a form and submit through a <input type="submit"> button. |
1206 NavigationObserver observer(WebContents()); | 1205 NavigationObserver observer(WebContents()); |
1207 std::unique_ptr<BubbleObserver> prompt_observer( | 1206 std::unique_ptr<BubbleObserver> prompt_observer( |
1208 new BubbleObserver(WebContents())); | 1207 new BubbleObserver(WebContents())); |
1209 // Make sure that the only passwords saved are the auto-saved ones. | 1208 // Make sure that the only passwords saved are the auto-saved ones. |
1210 std::string fill_and_submit = | 1209 std::string fill_and_submit = |
1211 "document.getElementById('username_field').value = 'temp';" | 1210 "document.getElementById('username_field').value = 'temp';" |
1212 "document.getElementById('password_field').value = 'random';" | 1211 "document.getElementById('password_field').value = 'random';" |
1213 "document.getElementById('input_submit_button').click()"; | 1212 "document.getElementById('input_submit_button').click()"; |
(...skipping 1864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3078 // about all frames, not just the main one. The factories should receive | 3077 // about all frames, not just the main one. The factories should receive |
3079 // messages for non-main frames, in particular | 3078 // messages for non-main frames, in particular |
3080 // AutofillHostMsg_PasswordFormsParsed. If that were the first time the | 3079 // AutofillHostMsg_PasswordFormsParsed. If that were the first time the |
3081 // factories hear about such frames, this would crash. | 3080 // factories hear about such frames, this would crash. |
3082 tab_strip_model->AddWebContents(detached_web_contents.release(), -1, | 3081 tab_strip_model->AddWebContents(detached_web_contents.release(), -1, |
3083 ::ui::PAGE_TRANSITION_AUTO_TOPLEVEL, | 3082 ::ui::PAGE_TRANSITION_AUTO_TOPLEVEL, |
3084 TabStripModel::ADD_ACTIVE); | 3083 TabStripModel::ADD_ACTIVE); |
3085 } | 3084 } |
3086 | 3085 |
3087 } // namespace password_manager | 3086 } // namespace password_manager |
OLD | NEW |