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" |
| 12 #include "base/single_thread_task_runner.h" |
11 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
12 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/thread_task_runner_handle.h" |
13 #include "content/browser/frame_host/cross_process_frame_connector.h" | 16 #include "content/browser/frame_host/cross_process_frame_connector.h" |
14 #include "content/browser/frame_host/frame_tree.h" | 17 #include "content/browser/frame_host/frame_tree.h" |
15 #include "content/browser/frame_host/navigator.h" | 18 #include "content/browser/frame_host/navigator.h" |
16 #include "content/browser/frame_host/render_frame_proxy_host.h" | 19 #include "content/browser/frame_host/render_frame_proxy_host.h" |
17 #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" |
18 #include "content/browser/renderer_host/render_view_host_impl.h" | 21 #include "content/browser/renderer_host/render_view_host_impl.h" |
19 #include "content/browser/web_contents/web_contents_impl.h" | 22 #include "content/browser/web_contents/web_contents_impl.h" |
20 #include "content/common/frame_messages.h" | 23 #include "content/common/frame_messages.h" |
21 #include "content/public/browser/notification_observer.h" | 24 #include "content/public/browser/notification_observer.h" |
22 #include "content/public/browser/notification_service.h" | 25 #include "content/public/browser/notification_service.h" |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | 427 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), |
425 child_node->current_frame_host()->GetSiteInstance()); | 428 child_node->current_frame_host()->GetSiteInstance()); |
426 RenderWidgetHostViewBase* rwhv_base = static_cast<RenderWidgetHostViewBase*>( | 429 RenderWidgetHostViewBase* rwhv_base = static_cast<RenderWidgetHostViewBase*>( |
427 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); | 430 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); |
428 | 431 |
429 // Wait for OnSwapCompositorFrame message. | 432 // Wait for OnSwapCompositorFrame message. |
430 while (rwhv_base->RendererFrameNumber() <= 0) { | 433 while (rwhv_base->RendererFrameNumber() <= 0) { |
431 // TODO(lazyboy): Find a better way to avoid sleeping like this. See | 434 // TODO(lazyboy): Find a better way to avoid sleeping like this. See |
432 // http://crbug.com/405282 for details. | 435 // http://crbug.com/405282 for details. |
433 base::RunLoop run_loop; | 436 base::RunLoop run_loop; |
434 base::MessageLoop::current()->PostDelayedTask( | 437 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
435 FROM_HERE, run_loop.QuitClosure(), | 438 FROM_HERE, run_loop.QuitClosure(), |
436 base::TimeDelta::FromMilliseconds(10)); | 439 base::TimeDelta::FromMilliseconds(10)); |
437 run_loop.Run(); | 440 run_loop.Run(); |
438 } | 441 } |
439 } | 442 } |
440 | 443 |
441 // Ensure that OOPIFs are deleted after navigating to a new main frame. | 444 // Ensure that OOPIFs are deleted after navigating to a new main frame. |
442 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CleanupCrossSiteIframe) { | 445 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CleanupCrossSiteIframe) { |
443 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); | 446 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); |
444 NavigateToURL(shell(), main_url); | 447 NavigateToURL(shell(), main_url); |
(...skipping 2083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2528 " |--Site A\n" | 2531 " |--Site A\n" |
2529 " +--Site A\n" | 2532 " +--Site A\n" |
2530 " |--Site A\n" | 2533 " |--Site A\n" |
2531 " +--Site A\n" | 2534 " +--Site A\n" |
2532 " +--Site A\n" | 2535 " +--Site A\n" |
2533 "Where A = http://127.0.0.1/", | 2536 "Where A = http://127.0.0.1/", |
2534 DepictFrameTree(root)); | 2537 DepictFrameTree(root)); |
2535 } | 2538 } |
2536 | 2539 |
2537 } // namespace content | 2540 } // namespace content |
OLD | NEW |