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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "content/browser/frame_host/cross_site_transferring_request.h" | 9 #include "content/browser/frame_host/cross_site_transferring_request.h" |
10 #include "content/browser/frame_host/navigation_before_commit_info.h" | 10 #include "content/browser/frame_host/navigation_before_commit_info.h" |
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 // Disown the opener from rfh2. | 1183 // Disown the opener from rfh2. |
1184 rfh2->DidDisownOpener(); | 1184 rfh2->DidDisownOpener(); |
1185 | 1185 |
1186 // Ensure the opener is cleared. | 1186 // Ensure the opener is cleared. |
1187 EXPECT_FALSE(contents()->HasOpener()); | 1187 EXPECT_FALSE(contents()->HasOpener()); |
1188 } | 1188 } |
1189 | 1189 |
1190 // Test that a page can disown a same-site opener of the WebContents. | 1190 // Test that a page can disown a same-site opener of the WebContents. |
1191 TEST_F(RenderFrameHostManagerTest, DisownSameSiteOpener) { | 1191 TEST_F(RenderFrameHostManagerTest, DisownSameSiteOpener) { |
1192 const GURL kUrl1("http://www.google.com/"); | 1192 const GURL kUrl1("http://www.google.com/"); |
1193 const GURL kUrl2("http://www.chromium.org/"); | |
1194 | 1193 |
1195 // Navigate to an initial URL. | 1194 // Navigate to an initial URL. |
1196 contents()->NavigateAndCommit(kUrl1); | 1195 contents()->NavigateAndCommit(kUrl1); |
1197 TestRenderFrameHost* rfh1 = main_test_rfh(); | 1196 TestRenderFrameHost* rfh1 = main_test_rfh(); |
1198 | 1197 |
1199 // Create a new tab and simulate having it be the opener for the main tab. | 1198 // Create a new tab and simulate having it be the opener for the main tab. |
1200 scoped_ptr<TestWebContents> opener1( | 1199 scoped_ptr<TestWebContents> opener1( |
1201 TestWebContents::Create(browser_context(), rfh1->GetSiteInstance())); | 1200 TestWebContents::Create(browser_context(), rfh1->GetSiteInstance())); |
1202 contents()->SetOpener(opener1.get()); | 1201 contents()->SetOpener(opener1.get()); |
1203 EXPECT_TRUE(contents()->HasOpener()); | 1202 EXPECT_TRUE(contents()->HasOpener()); |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1788 ASSERT_TRUE(main_request); | 1787 ASSERT_TRUE(main_request); |
1789 | 1788 |
1790 NavigationBeforeCommitInfo commit_info; | 1789 NavigationBeforeCommitInfo commit_info; |
1791 commit_info.navigation_url = kUrl2; | 1790 commit_info.navigation_url = kUrl2; |
1792 render_manager->CommitNavigation(commit_info); | 1791 render_manager->CommitNavigation(commit_info); |
1793 main_request = GetNavigationRequestForRenderFrameManager(render_manager); | 1792 main_request = GetNavigationRequestForRenderFrameManager(render_manager); |
1794 EXPECT_NE(main_test_rfh(), rfh); | 1793 EXPECT_NE(main_test_rfh(), rfh); |
1795 } | 1794 } |
1796 | 1795 |
1797 } // namespace content | 1796 } // namespace content |
OLD | NEW |