| 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 3349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3360 base::string16 expected_title(base::UTF8ToUTF16("LOADEDLOADED")); | 3360 base::string16 expected_title(base::UTF8ToUTF16("LOADEDLOADED")); |
| 3361 TitleWatcher title_watcher(shell()->web_contents(), expected_title); | 3361 TitleWatcher title_watcher(shell()->web_contents(), expected_title); |
| 3362 TestNavigationObserver observer(shell()->web_contents()); | 3362 TestNavigationObserver observer(shell()->web_contents()); |
| 3363 NavigateFrameToURL(root->child_at(0), foo_url); | 3363 NavigateFrameToURL(root->child_at(0), foo_url); |
| 3364 EXPECT_TRUE(observer.last_navigation_succeeded()); | 3364 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 3365 EXPECT_EQ(foo_url, observer.last_navigation_url()); | 3365 EXPECT_EQ(foo_url, observer.last_navigation_url()); |
| 3366 EXPECT_EQ(title_watcher.WaitAndGetTitle(), expected_title); | 3366 EXPECT_EQ(title_watcher.WaitAndGetTitle(), expected_title); |
| 3367 } | 3367 } |
| 3368 } | 3368 } |
| 3369 | 3369 |
| 3370 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, SetCookieInSubframeUnload) { |
| 3371 GURL url = embedded_test_server()->GetURL( |
| 3372 "a.com", "/onunload_cookie_wrapper_wrapper.html"); |
| 3373 EXPECT_TRUE(NavigateToURL(shell(), url)); |
| 3374 |
| 3375 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3376 EXPECT_EQ( |
| 3377 " Site A ------------ proxies for B\n" |
| 3378 " +--Site B ------- proxies for A\n" |
| 3379 " +--Site B -- proxies for A\n" |
| 3380 "Where A = http://a.com/\n" |
| 3381 " B = http://b.com/", |
| 3382 DepictFrameTree(root)); |
| 3383 |
| 3384 NavigateFrameToURL(root->child_at(0), |
| 3385 embedded_test_server()->GetURL("c.com", "/title1.html")); |
| 3386 |
| 3387 EXPECT_EQ( |
| 3388 " Site A ------------ proxies for C\n" |
| 3389 " +--Site C ------- proxies for A\n" |
| 3390 "Where A = http://a.com/\n" |
| 3391 " C = http://c.com/", |
| 3392 DepictFrameTree(root)); |
| 3393 EXPECT_EQ("", |
| 3394 content::GetCookies(shell()->web_contents()->GetBrowserContext(), |
| 3395 embedded_test_server()->GetURL( |
| 3396 "b.com", "/onunload_cookie.html"))); |
| 3397 } |
| 3398 |
| 3370 // Check that postMessage can be routed between cross-site iframes. | 3399 // Check that postMessage can be routed between cross-site iframes. |
| 3371 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, SubframePostMessage) { | 3400 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, SubframePostMessage) { |
| 3372 GURL main_url(embedded_test_server()->GetURL( | 3401 GURL main_url(embedded_test_server()->GetURL( |
| 3373 "/frame_tree/page_with_post_message_frames.html")); | 3402 "/frame_tree/page_with_post_message_frames.html")); |
| 3374 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 3403 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 3375 | 3404 |
| 3376 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3405 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3377 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); | 3406 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3378 | 3407 |
| 3379 ASSERT_EQ(2U, root->child_count()); | 3408 ASSERT_EQ(2U, root->child_count()); |
| (...skipping 2707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6087 EXPECT_EQ(b_url, root->current_url()); | 6116 EXPECT_EQ(b_url, root->current_url()); |
| 6088 | 6117 |
| 6089 // Verify that the same RenderViewHost is preserved and that it is no longer | 6118 // Verify that the same RenderViewHost is preserved and that it is no longer |
| 6090 // in swapped out state. | 6119 // in swapped out state. |
| 6091 EXPECT_EQ(rvh, contents->GetFrameTree()->GetRenderViewHost( | 6120 EXPECT_EQ(rvh, contents->GetFrameTree()->GetRenderViewHost( |
| 6092 root->current_frame_host()->GetSiteInstance())); | 6121 root->current_frame_host()->GetSiteInstance())); |
| 6093 EXPECT_FALSE(rvh->is_swapped_out_); | 6122 EXPECT_FALSE(rvh->is_swapped_out_); |
| 6094 } | 6123 } |
| 6095 | 6124 |
| 6096 } // namespace content | 6125 } // namespace content |
| OLD | NEW |