OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.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 "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
16 #include "content/browser/frame_host/cross_process_frame_connector.h" | 16 #include "content/browser/frame_host/cross_process_frame_connector.h" |
17 #include "content/browser/frame_host/frame_tree.h" | 17 #include "content/browser/frame_host/frame_tree.h" |
18 #include "content/browser/frame_host/navigator.h" | 18 #include "content/browser/frame_host/navigator.h" |
19 #include "content/browser/frame_host/render_frame_proxy_host.h" | 19 #include "content/browser/frame_host/render_frame_proxy_host.h" |
20 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 20 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
21 #include "content/browser/renderer_host/render_view_host_impl.h" | 21 #include "content/browser/renderer_host/render_view_host_impl.h" |
22 #include "content/browser/web_contents/web_contents_impl.h" | 22 #include "content/browser/web_contents/web_contents_impl.h" |
23 #include "content/common/frame_messages.h" | 23 #include "content/common/frame_messages.h" |
24 #include "content/public/browser/notification_observer.h" | 24 #include "content/public/browser/notification_observer.h" |
25 #include "content/public/browser/notification_service.h" | 25 #include "content/public/browser/notification_service.h" |
26 #include "content/public/browser/notification_types.h" | 26 #include "content/public/browser/notification_types.h" |
27 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
| 28 #include "content/public/common/site_isolation_policy.h" |
28 #include "content/public/test/browser_test_utils.h" | 29 #include "content/public/test/browser_test_utils.h" |
29 #include "content/public/test/content_browser_test_utils.h" | 30 #include "content/public/test/content_browser_test_utils.h" |
30 #include "content/public/test/test_navigation_observer.h" | 31 #include "content/public/test/test_navigation_observer.h" |
31 #include "content/public/test/test_utils.h" | 32 #include "content/public/test/test_utils.h" |
32 #include "content/shell/browser/shell.h" | 33 #include "content/shell/browser/shell.h" |
33 #include "content/test/content_browser_test_utils_internal.h" | 34 #include "content/test/content_browser_test_utils_internal.h" |
34 #include "content/test/test_frame_navigation_observer.h" | 35 #include "content/test/test_frame_navigation_observer.h" |
35 #include "ipc/ipc_security_test_util.h" | 36 #include "ipc/ipc_security_test_util.h" |
36 #include "net/dns/mock_host_resolver.h" | 37 #include "net/dns/mock_host_resolver.h" |
37 #include "net/test/embedded_test_server/embedded_test_server.h" | 38 #include "net/test/embedded_test_server/embedded_test_server.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 270 |
270 void SitePerProcessBrowserTest::StartFrameAtDataURL() { | 271 void SitePerProcessBrowserTest::StartFrameAtDataURL() { |
271 std::string data_url_script = | 272 std::string data_url_script = |
272 "var iframes = document.getElementById('test');iframes.src=" | 273 "var iframes = document.getElementById('test');iframes.src=" |
273 "'data:text/html,dataurl';"; | 274 "'data:text/html,dataurl';"; |
274 ASSERT_TRUE(ExecuteScript(shell()->web_contents(), data_url_script)); | 275 ASSERT_TRUE(ExecuteScript(shell()->web_contents(), data_url_script)); |
275 } | 276 } |
276 | 277 |
277 void SitePerProcessBrowserTest::SetUpCommandLine( | 278 void SitePerProcessBrowserTest::SetUpCommandLine( |
278 base::CommandLine* command_line) { | 279 base::CommandLine* command_line) { |
279 command_line->AppendSwitch(switches::kSitePerProcess); | 280 SiteIsolationPolicy::IsolateAllSitesForTesting(command_line); |
280 }; | 281 }; |
281 | 282 |
282 void SitePerProcessBrowserTest::SetUpOnMainThread() { | 283 void SitePerProcessBrowserTest::SetUpOnMainThread() { |
283 host_resolver()->AddRule("*", "127.0.0.1"); | 284 host_resolver()->AddRule("*", "127.0.0.1"); |
284 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 285 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
285 SetupCrossSiteRedirector(embedded_test_server()); | 286 SetupCrossSiteRedirector(embedded_test_server()); |
286 } | 287 } |
287 | 288 |
288 // Ensure that navigating subframes in --site-per-process mode works and the | 289 // Ensure that navigating subframes in --site-per-process mode works and the |
289 // correct documents are committed. | 290 // correct documents are committed. |
(...skipping 2399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2689 " |--Site A\n" | 2690 " |--Site A\n" |
2690 " +--Site A\n" | 2691 " +--Site A\n" |
2691 " |--Site A\n" | 2692 " |--Site A\n" |
2692 " +--Site A\n" | 2693 " +--Site A\n" |
2693 " +--Site A\n" | 2694 " +--Site A\n" |
2694 "Where A = http://127.0.0.1/", | 2695 "Where A = http://127.0.0.1/", |
2695 DepictFrameTree(root)); | 2696 DepictFrameTree(root)); |
2696 } | 2697 } |
2697 | 2698 |
2698 } // namespace content | 2699 } // namespace content |
OLD | NEW |