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" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
25 #include "chrome/browser/ui/browser_navigator_params.h" | 25 #include "chrome/browser/ui/browser_navigator_params.h" |
26 #include "chrome/browser/ui/login/login_handler.h" | 26 #include "chrome/browser/ui/login/login_handler.h" |
27 #include "chrome/browser/ui/login/login_handler_test_utils.h" | 27 #include "chrome/browser/ui/login/login_handler_test_utils.h" |
28 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" | 28 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
29 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 29 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
30 #include "chrome/common/channel_info.h" | 30 #include "chrome/common/channel_info.h" |
31 #include "chrome/common/chrome_paths.h" | 31 #include "chrome/common/chrome_paths.h" |
32 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
33 #include "chrome/test/base/ui_test_utils.h" | 33 #include "chrome/test/base/ui_test_utils.h" |
34 #include "components/autofill/content/common/autofill_messages.h" | |
35 #include "components/autofill/core/browser/autofill_test_utils.h" | 34 #include "components/autofill/core/browser/autofill_test_utils.h" |
36 #include "components/autofill/core/browser/test_autofill_client.h" | 35 #include "components/autofill/core/browser/test_autofill_client.h" |
37 #include "components/autofill/core/common/password_form.h" | 36 #include "components/autofill/core/common/password_form.h" |
38 #include "components/password_manager/content/browser/content_password_manager_d
river.h" | 37 #include "components/password_manager/content/browser/content_password_manager_d
river.h" |
39 #include "components/password_manager/content/browser/content_password_manager_d
river_factory.h" | 38 #include "components/password_manager/content/browser/content_password_manager_d
river_factory.h" |
40 #include "components/password_manager/core/browser/login_model.h" | 39 #include "components/password_manager/core/browser/login_model.h" |
41 #include "components/password_manager/core/browser/test_password_store.h" | 40 #include "components/password_manager/core/browser/test_password_store.h" |
42 #include "components/password_manager/core/common/password_manager_features.h" | 41 #include "components/password_manager/core/common/password_manager_features.h" |
43 #include "components/version_info/version_info.h" | 42 #include "components/version_info/version_info.h" |
44 #include "content/public/browser/navigation_controller.h" | 43 #include "content/public/browser/navigation_controller.h" |
45 #include "content/public/browser/notification_service.h" | 44 #include "content/public/browser/notification_service.h" |
46 #include "content/public/browser/render_frame_host.h" | 45 #include "content/public/browser/render_frame_host.h" |
47 #include "content/public/browser/render_process_host.h" | 46 #include "content/public/browser/render_process_host.h" |
48 #include "content/public/browser/render_view_host.h" | 47 #include "content/public/browser/render_view_host.h" |
49 #include "content/public/browser/web_contents.h" | 48 #include "content/public/browser/web_contents.h" |
50 #include "content/public/browser/web_contents_observer.h" | 49 #include "content/public/browser/web_contents_observer.h" |
51 #include "content/public/common/content_switches.h" | 50 #include "content/public/common/content_switches.h" |
52 #include "content/public/test/browser_test_utils.h" | 51 #include "content/public/test/browser_test_utils.h" |
53 #include "content/public/test/test_utils.h" | 52 #include "content/public/test/test_utils.h" |
54 #include "ipc/ipc_security_test_util.h" | |
55 #include "net/base/filename_util.h" | 53 #include "net/base/filename_util.h" |
56 #include "net/dns/mock_host_resolver.h" | 54 #include "net/dns/mock_host_resolver.h" |
57 #include "net/test/embedded_test_server/embedded_test_server.h" | 55 #include "net/test/embedded_test_server/embedded_test_server.h" |
58 #include "net/test/embedded_test_server/http_request.h" | 56 #include "net/test/embedded_test_server/http_request.h" |
59 #include "net/test/embedded_test_server/http_response.h" | 57 #include "net/test/embedded_test_server/http_response.h" |
60 #include "net/url_request/test_url_fetcher_factory.h" | 58 #include "net/url_request/test_url_fetcher_factory.h" |
61 #include "testing/gmock/include/gmock/gmock.h" | 59 #include "testing/gmock/include/gmock/gmock.h" |
62 #include "third_party/WebKit/public/web/WebInputEvent.h" | 60 #include "third_party/WebKit/public/web/WebInputEvent.h" |
63 #include "ui/events/keycodes/keyboard_codes.h" | 61 #include "ui/events/keycodes/keyboard_codes.h" |
64 #include "ui/gfx/geometry/point.h" | 62 #include "ui/gfx/geometry/point.h" |
(...skipping 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2046 iframe_observer.Wait(); | 2044 iframe_observer.Wait(); |
2047 | 2045 |
2048 // The iframe should get its own process. | 2046 // The iframe should get its own process. |
2049 content::RenderFrameHost* main_frame = WebContents()->GetMainFrame(); | 2047 content::RenderFrameHost* main_frame = WebContents()->GetMainFrame(); |
2050 content::RenderFrameHost* iframe = iframe_observer.render_frame_host(); | 2048 content::RenderFrameHost* iframe = iframe_observer.render_frame_host(); |
2051 content::SiteInstance* main_site_instance = main_frame->GetSiteInstance(); | 2049 content::SiteInstance* main_site_instance = main_frame->GetSiteInstance(); |
2052 content::SiteInstance* iframe_site_instance = iframe->GetSiteInstance(); | 2050 content::SiteInstance* iframe_site_instance = iframe->GetSiteInstance(); |
2053 EXPECT_NE(main_site_instance, iframe_site_instance); | 2051 EXPECT_NE(main_site_instance, iframe_site_instance); |
2054 EXPECT_NE(main_frame->GetProcess(), iframe->GetProcess()); | 2052 EXPECT_NE(main_frame->GetProcess(), iframe->GetProcess()); |
2055 | 2053 |
| 2054 content::RenderProcessHostWatcher iframe_killed( |
| 2055 iframe->GetProcess(), |
| 2056 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); |
| 2057 |
2056 // Try to get cross-site passwords from the subframe's process and wait for it | 2058 // Try to get cross-site passwords from the subframe's process and wait for it |
2057 // to be killed. | 2059 // to be killed. |
2058 std::vector<autofill::PasswordForm> password_forms; | 2060 std::vector<autofill::PasswordForm> password_forms; |
2059 password_forms.push_back(autofill::PasswordForm()); | 2061 password_forms.push_back(autofill::PasswordForm()); |
2060 password_forms.back().origin = main_frame_url; | 2062 password_forms.back().origin = main_frame_url; |
2061 AutofillHostMsg_PasswordFormsParsed illegal_forms_parsed( | 2063 ContentPasswordManagerDriverFactory* factory = |
2062 iframe->GetRoutingID(), password_forms); | 2064 ContentPasswordManagerDriverFactory::FromWebContents(WebContents()); |
2063 | 2065 EXPECT_TRUE(factory); |
2064 content::RenderProcessHostWatcher iframe_killed( | 2066 ContentPasswordManagerDriver* driver = factory->GetDriverForFrame(iframe); |
2065 iframe->GetProcess(), | 2067 EXPECT_TRUE(driver); |
2066 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); | 2068 driver->PasswordFormsParsed(password_forms); |
2067 | |
2068 IPC::IpcSecurityTestUtil::PwnMessageReceived( | |
2069 iframe->GetProcess()->GetChannel(), illegal_forms_parsed); | |
2070 | 2069 |
2071 iframe_killed.Wait(); | 2070 iframe_killed.Wait(); |
2072 } | 2071 } |
2073 | 2072 |
2074 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, | 2073 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, |
2075 ChangePwdNoAccountStored) { | 2074 ChangePwdNoAccountStored) { |
2076 NavigateToFile("/password/password_form.html"); | 2075 NavigateToFile("/password/password_form.html"); |
2077 | 2076 |
2078 // Fill a form and submit through a <input type="submit"> button. | 2077 // Fill a form and submit through a <input type="submit"> button. |
2079 NavigationObserver observer(WebContents()); | 2078 NavigationObserver observer(WebContents()); |
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3046 // about all frames, not just the main one. The factories should receive | 3045 // about all frames, not just the main one. The factories should receive |
3047 // messages for non-main frames, in particular | 3046 // messages for non-main frames, in particular |
3048 // AutofillHostMsg_PasswordFormsParsed. If that were the first time the | 3047 // AutofillHostMsg_PasswordFormsParsed. If that were the first time the |
3049 // factories hear about such frames, this would crash. | 3048 // factories hear about such frames, this would crash. |
3050 tab_strip_model->AddWebContents(detached_web_contents.release(), -1, | 3049 tab_strip_model->AddWebContents(detached_web_contents.release(), -1, |
3051 ::ui::PAGE_TRANSITION_AUTO_TOPLEVEL, | 3050 ::ui::PAGE_TRANSITION_AUTO_TOPLEVEL, |
3052 TabStripModel::ADD_ACTIVE); | 3051 TabStripModel::ADD_ACTIVE); |
3053 } | 3052 } |
3054 | 3053 |
3055 } // namespace password_manager | 3054 } // namespace password_manager |
OLD | NEW |