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 | 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" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
16 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 16 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
17 #include "chrome/browser/password_manager/password_manager_test_base.h" | 17 #include "chrome/browser/password_manager/password_manager_test_base.h" |
18 #include "chrome/browser/password_manager/password_store_factory.h" | 18 #include "chrome/browser/password_manager/password_store_factory.h" |
19 #include "chrome/browser/password_manager/test_password_store_service.h" | 19 #include "chrome/browser/password_manager/test_password_store_service.h" |
20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
22 #include "chrome/browser/ui/login/login_prompt.h" | 22 #include "chrome/browser/ui/login/login_prompt.h" |
23 #include "chrome/browser/ui/login/login_prompt_test_utils.h" | 23 #include "chrome/browser/ui/login/login_prompt_test_utils.h" |
24 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 24 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 25 #include "chrome/common/channel_info.h" |
25 #include "chrome/common/chrome_paths.h" | 26 #include "chrome/common/chrome_paths.h" |
26 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/common/chrome_version_info.h" | |
28 #include "chrome/test/base/test_switches.h" | 28 #include "chrome/test/base/test_switches.h" |
29 #include "chrome/test/base/ui_test_utils.h" | 29 #include "chrome/test/base/ui_test_utils.h" |
30 #include "components/autofill/content/common/autofill_messages.h" | 30 #include "components/autofill/content/common/autofill_messages.h" |
31 #include "components/autofill/core/browser/autofill_test_utils.h" | 31 #include "components/autofill/core/browser/autofill_test_utils.h" |
32 #include "components/autofill/core/browser/test_autofill_client.h" | 32 #include "components/autofill/core/browser/test_autofill_client.h" |
33 #include "components/autofill/core/common/password_form.h" | 33 #include "components/autofill/core/common/password_form.h" |
34 #include "components/password_manager/content/browser/content_password_manager_d
river.h" | 34 #include "components/password_manager/content/browser/content_password_manager_d
river.h" |
35 #include "components/password_manager/content/browser/content_password_manager_d
river_factory.h" | 35 #include "components/password_manager/content/browser/content_password_manager_d
river_factory.h" |
36 #include "components/password_manager/core/browser/test_password_store.h" | 36 #include "components/password_manager/core/browser/test_password_store.h" |
37 #include "components/password_manager/core/common/password_manager_switches.h" | 37 #include "components/password_manager/core/common/password_manager_switches.h" |
| 38 #include "components/version_info/version_info.h" |
38 #include "content/public/browser/navigation_controller.h" | 39 #include "content/public/browser/navigation_controller.h" |
39 #include "content/public/browser/notification_service.h" | 40 #include "content/public/browser/notification_service.h" |
40 #include "content/public/browser/render_frame_host.h" | 41 #include "content/public/browser/render_frame_host.h" |
41 #include "content/public/browser/render_process_host.h" | 42 #include "content/public/browser/render_process_host.h" |
42 #include "content/public/browser/render_view_host.h" | 43 #include "content/public/browser/render_view_host.h" |
43 #include "content/public/browser/web_contents.h" | 44 #include "content/public/browser/web_contents.h" |
44 #include "content/public/browser/web_contents_observer.h" | 45 #include "content/public/browser/web_contents_observer.h" |
45 #include "content/public/common/content_switches.h" | 46 #include "content/public/common/content_switches.h" |
46 #include "content/public/test/browser_test_utils.h" | 47 #include "content/public/test/browser_test_utils.h" |
47 #include "content/public/test/test_utils.h" | 48 #include "content/public/test/test_utils.h" |
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1117 NavigationObserver observer(WebContents()); | 1118 NavigationObserver observer(WebContents()); |
1118 scoped_ptr<PromptObserver> prompt_observer( | 1119 scoped_ptr<PromptObserver> prompt_observer( |
1119 PromptObserver::Create(WebContents())); | 1120 PromptObserver::Create(WebContents())); |
1120 // Make sure that the only passwords saved are the auto-saved ones. | 1121 // Make sure that the only passwords saved are the auto-saved ones. |
1121 std::string fill_and_submit = | 1122 std::string fill_and_submit = |
1122 "document.getElementById('username_field').value = 'temp';" | 1123 "document.getElementById('username_field').value = 'temp';" |
1123 "document.getElementById('password_field').value = 'random';" | 1124 "document.getElementById('password_field').value = 'random';" |
1124 "document.getElementById('input_submit_button').click()"; | 1125 "document.getElementById('input_submit_button').click()"; |
1125 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit)); | 1126 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit)); |
1126 observer.Wait(); | 1127 observer.Wait(); |
1127 if (chrome::VersionInfo::GetChannel() == | 1128 if (chrome::GetChannel() == version_info::Channel::UNKNOWN) { |
1128 version_info::Channel::UNKNOWN) { | |
1129 // Passwords getting auto-saved, no prompt. | 1129 // Passwords getting auto-saved, no prompt. |
1130 EXPECT_FALSE(prompt_observer->IsShowingPrompt()); | 1130 EXPECT_FALSE(prompt_observer->IsShowingPrompt()); |
1131 EXPECT_FALSE(password_store->IsEmpty()); | 1131 EXPECT_FALSE(password_store->IsEmpty()); |
1132 } else { | 1132 } else { |
1133 // Prompt shown, and no passwords saved automatically. | 1133 // Prompt shown, and no passwords saved automatically. |
1134 EXPECT_TRUE(prompt_observer->IsShowingPrompt()); | 1134 EXPECT_TRUE(prompt_observer->IsShowingPrompt()); |
1135 EXPECT_TRUE(password_store->IsEmpty()); | 1135 EXPECT_TRUE(password_store->IsEmpty()); |
1136 } | 1136 } |
1137 } | 1137 } |
1138 | 1138 |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2015 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); | 2015 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); |
2016 | 2016 |
2017 IPC::IpcSecurityTestUtil::PwnMessageReceived( | 2017 IPC::IpcSecurityTestUtil::PwnMessageReceived( |
2018 iframe->GetProcess()->GetChannel(), illegal_forms_parsed); | 2018 iframe->GetProcess()->GetChannel(), illegal_forms_parsed); |
2019 | 2019 |
2020 iframe_killed.Wait(); | 2020 iframe_killed.Wait(); |
2021 } | 2021 } |
2022 | 2022 |
2023 } // namespace password_manager | 2023 } // namespace password_manager |
2024 | 2024 |
OLD | NEW |