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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 23 matching lines...) Expand all Loading... | |
34 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" | 34 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" |
35 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 35 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
36 #include "content/browser/web_contents/web_contents_impl.h" | 36 #include "content/browser/web_contents/web_contents_impl.h" |
37 #include "content/common/child_process_messages.h" | 37 #include "content/common/child_process_messages.h" |
38 #include "content/common/frame_messages.h" | 38 #include "content/common/frame_messages.h" |
39 #include "content/common/input/synthetic_tap_gesture_params.h" | 39 #include "content/common/input/synthetic_tap_gesture_params.h" |
40 #include "content/common/input_messages.h" | 40 #include "content/common/input_messages.h" |
41 #include "content/common/renderer.mojom.h" | 41 #include "content/common/renderer.mojom.h" |
42 #include "content/common/view_messages.h" | 42 #include "content/common/view_messages.h" |
43 #include "content/public/browser/interstitial_page_delegate.h" | 43 #include "content/public/browser/interstitial_page_delegate.h" |
44 #include "content/public/browser/navigation_handle.h" | |
44 #include "content/public/browser/notification_observer.h" | 45 #include "content/public/browser/notification_observer.h" |
45 #include "content/public/browser/notification_service.h" | 46 #include "content/public/browser/notification_service.h" |
46 #include "content/public/browser/notification_types.h" | 47 #include "content/public/browser/notification_types.h" |
47 #include "content/public/browser/resource_dispatcher_host.h" | 48 #include "content/public/browser/resource_dispatcher_host.h" |
48 #include "content/public/common/browser_side_navigation_policy.h" | 49 #include "content/public/common/browser_side_navigation_policy.h" |
49 #include "content/public/common/content_switches.h" | 50 #include "content/public/common/content_switches.h" |
50 #include "content/public/common/url_constants.h" | 51 #include "content/public/common/url_constants.h" |
51 #include "content/public/test/browser_test_utils.h" | 52 #include "content/public/test/browser_test_utils.h" |
52 #include "content/public/test/content_browser_test_utils.h" | 53 #include "content/public/test/content_browser_test_utils.h" |
53 #include "content/public/test/test_navigation_observer.h" | 54 #include "content/public/test/test_navigation_observer.h" |
(...skipping 8285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8339 | 8340 |
8340 // Now have the cross-process navigation commit and mark the current RFH as | 8341 // Now have the cross-process navigation commit and mark the current RFH as |
8341 // pending deletion. | 8342 // pending deletion. |
8342 cross_site_manager.WaitForNavigationFinished(); | 8343 cross_site_manager.WaitForNavigationFinished(); |
8343 | 8344 |
8344 // Resume the navigation in the previous RFH that has just been marked as | 8345 // Resume the navigation in the previous RFH that has just been marked as |
8345 // pending deletion. We should not crash. | 8346 // pending deletion. We should not crash. |
8346 transfer_manager.WaitForNavigationFinished(); | 8347 transfer_manager.WaitForNavigationFinished(); |
8347 } | 8348 } |
8348 | 8349 |
8350 class NavigatigationHandleWatcher : public WebContentsObserver { | |
8351 public: | |
8352 NavigatigationHandleWatcher(WebContents* web_contents) | |
8353 : WebContentsObserver(web_contents) {} | |
8354 void DidStartNavigation(NavigationHandle* navigation_handle) override { | |
8355 DCHECK_EQ("http://b.com/", | |
8356 navigation_handle->GetCreatorSiteInstance()->GetSiteURL().spec()); | |
8357 } | |
8358 }; | |
8359 | |
8360 // Verifies that the site instance of a navigation handle correctly identifies | |
alexmos
2016/10/12 23:13:28
nit: s/site instance/SiteInstance/, s/navigation h
jam
2016/10/13 00:14:46
Done.
| |
8361 // the RenderFrameHost that started the navigation (and not the destination | |
8362 // RFH). | |
8363 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigationHandleSiteIntance) { | |
alexmos
2016/10/12 23:13:28
nit: s/Intance/Instance/
jam
2016/10/13 00:14:46
Done.
| |
8364 // Navigate to a page with a cross-site iframe. | |
8365 GURL main_url(embedded_test_server()->GetURL( | |
8366 "a.com", "/cross_site_iframe_factory.html?a(b)")); | |
8367 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | |
8368 | |
8369 // Navigate the iframe cross-site. | |
8370 NavigatigationHandleWatcher watcher(shell()->web_contents()); | |
8371 TestNavigationObserver load_observer(shell()->web_contents()); | |
8372 GURL frame_url = embedded_test_server()->GetURL("c.com", "/title1.html"); | |
8373 EXPECT_TRUE(ExecuteScript( | |
8374 shell()->web_contents(), | |
8375 "window.frames[0].location = \"" + frame_url.spec() + "\";")); | |
8376 load_observer.Wait(); | |
8377 } | |
8378 | |
8349 } // namespace content | 8379 } // namespace content |
OLD | NEW |