Chromium Code Reviews| 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 <set> | 5 #include <set> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 new_shell->web_contents()->GetSiteInstance()); | 150 new_shell->web_contents()->GetSiteInstance()); |
| 151 EXPECT_NE(orig_site_instance, new_site_instance); | 151 EXPECT_NE(orig_site_instance, new_site_instance); |
| 152 | 152 |
| 153 // We should no longer have script access to the opened window's location. | 153 // We should no longer have script access to the opened window's location. |
| 154 success = false; | 154 success = false; |
| 155 EXPECT_TRUE(ExecuteScriptAndExtractBool( | 155 EXPECT_TRUE(ExecuteScriptAndExtractBool( |
| 156 shell()->web_contents(), | 156 shell()->web_contents(), |
| 157 "window.domAutomationController.send(testScriptAccessToWindow());", | 157 "window.domAutomationController.send(testScriptAccessToWindow());", |
| 158 &success)); | 158 &success)); |
| 159 EXPECT_FALSE(success); | 159 EXPECT_FALSE(success); |
| 160 | |
| 161 // We now navigate to a blank window. | |
|
Charlie Reis
2014/12/11 00:43:39
nit: We now navigate the window to an about:blank
lfg
2014/12/11 23:55:24
Done.
| |
| 162 success = false; | |
| 163 EXPECT_TRUE(ExecuteScriptAndExtractBool( | |
| 164 shell()->web_contents(), | |
| 165 "window.domAutomationController.send(clickBlankTargetedLink());", | |
| 166 &success)); | |
| 167 EXPECT_TRUE(success); | |
| 168 | |
| 169 // Wait for the navigation in the new window to finish. | |
| 170 WaitForLoadStop(new_shell->web_contents()); | |
| 171 EXPECT_EQ("blank", | |
|
Charlie Reis
2014/12/11 00:43:39
Let's just compare GetLastCommittedURL() to GURL(k
lfg
2014/12/11 23:55:24
Done.
| |
| 172 new_shell->web_contents()->GetLastCommittedURL().path()); | |
| 173 scoped_refptr<SiteInstance> blank_site_instance2( | |
|
Charlie Reis
2014/12/11 00:43:39
This can then be blank_site_instance.
lfg
2014/12/11 23:55:24
Removed, as we don't need to save the reference in
| |
| 174 new_shell->web_contents()->GetSiteInstance()); | |
| 175 EXPECT_EQ(orig_site_instance, blank_site_instance2); | |
| 176 | |
| 177 // We should have access to the opened window's location. | |
| 178 success = false; | |
| 179 EXPECT_TRUE(ExecuteScriptAndExtractBool( | |
| 180 shell()->web_contents(), | |
| 181 "window.domAutomationController.send(testScriptAccessToWindow());", | |
| 182 &success)); | |
| 183 EXPECT_TRUE(success); | |
| 160 } | 184 } |
| 161 | 185 |
| 162 // Test for crbug.com/24447. Following a cross-site link with rel=noreferrer | 186 // Test for crbug.com/24447. Following a cross-site link with rel=noreferrer |
| 163 // and target=_blank should create a new SiteInstance. | 187 // and target=_blank should create a new SiteInstance. |
| 164 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, | 188 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, |
| 165 SwapProcessWithRelNoreferrerAndTargetBlank) { | 189 SwapProcessWithRelNoreferrerAndTargetBlank) { |
| 166 StartServer(); | 190 StartServer(); |
| 167 | 191 |
| 168 // Load a page with links that open in a new window. | 192 // Load a page with links that open in a new window. |
| 169 std::string replacement_path; | 193 std::string replacement_path; |
| (...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1590 EXPECT_TRUE(ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( | 1614 EXPECT_TRUE(ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( |
| 1591 shell()->web_contents()->GetRenderProcessHost()->GetID(), file_path)); | 1615 shell()->web_contents()->GetRenderProcessHost()->GetID(), file_path)); |
| 1592 | 1616 |
| 1593 // Navigate to a same site page to trigger a PageState update and ensure the | 1617 // Navigate to a same site page to trigger a PageState update and ensure the |
| 1594 // renderer is not killed. | 1618 // renderer is not killed. |
| 1595 EXPECT_TRUE( | 1619 EXPECT_TRUE( |
| 1596 NavigateToURL(shell(), test_server()->GetURL("files/title2.html"))); | 1620 NavigateToURL(shell(), test_server()->GetURL("files/title2.html"))); |
| 1597 } | 1621 } |
| 1598 | 1622 |
| 1599 } // namespace content | 1623 } // namespace content |
| OLD | NEW |