| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/stringprintf.h" | 6 #include "base/stringprintf.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "content/browser/web_contents/web_contents_impl.h" | 8 #include "content/browser/web_contents/web_contents_impl.h" |
| 9 #include "content/public/browser/notification_observer.h" | 9 #include "content/public/browser/notification_observer.h" |
| 10 #include "content/public/browser/notification_service.h" | 10 #include "content/public/browser/notification_service.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 bool result = ExecuteScript(window->web_contents(), script); | 155 bool result = ExecuteScript(window->web_contents(), script); |
| 156 load_observer.Wait(); | 156 load_observer.Wait(); |
| 157 return result; | 157 return result; |
| 158 } | 158 } |
| 159 | 159 |
| 160 void SetUpCommandLine(CommandLine* command_line) { | 160 void SetUpCommandLine(CommandLine* command_line) { |
| 161 command_line->AppendSwitch(switches::kSitePerProcess); | 161 command_line->AppendSwitch(switches::kSitePerProcess); |
| 162 } | 162 } |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframe) { | 165 // TODO(nasko): Disable this test until out-of-process iframes is ready and the |
| 166 // security checks are back in place. |
| 167 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DISABLED_CrossSiteIframe) { |
| 166 ASSERT_TRUE(test_server()->Start()); | 168 ASSERT_TRUE(test_server()->Start()); |
| 167 net::TestServer https_server( | 169 net::TestServer https_server( |
| 168 net::TestServer::TYPE_HTTPS, | 170 net::TestServer::TYPE_HTTPS, |
| 169 net::TestServer::kLocalhost, | 171 net::TestServer::kLocalhost, |
| 170 FilePath(FILE_PATH_LITERAL("content/test/data"))); | 172 FilePath(FILE_PATH_LITERAL("content/test/data"))); |
| 171 ASSERT_TRUE(https_server.Start()); | 173 ASSERT_TRUE(https_server.Start()); |
| 172 GURL main_url(test_server()->GetURL("files/site_per_process_main.html")); | 174 GURL main_url(test_server()->GetURL("files/site_per_process_main.html")); |
| 173 | 175 |
| 174 NavigateToURL(shell(), main_url); | 176 NavigateToURL(shell(), main_url); |
| 175 | 177 |
| 176 SitePerProcessWebContentsObserver observer(shell()->web_contents()); | 178 SitePerProcessWebContentsObserver observer(shell()->web_contents()); |
| 177 { | 179 { |
| 178 // Load same-site page into Iframe. | 180 // Load same-site page into Iframe. |
| 179 GURL http_url(test_server()->GetURL("files/title1.html")); | 181 GURL http_url(test_server()->GetURL("files/title1.html")); |
| 180 EXPECT_TRUE(NavigateIframeToURL(shell(), http_url, "test")); | 182 EXPECT_TRUE(NavigateIframeToURL(shell(), http_url, "test")); |
| 181 EXPECT_EQ(observer.navigation_url(), http_url); | 183 EXPECT_EQ(observer.navigation_url(), http_url); |
| 182 EXPECT_TRUE(observer.navigation_succeeded()); | 184 EXPECT_TRUE(observer.navigation_succeeded()); |
| 183 } | 185 } |
| 184 | 186 |
| 185 { | 187 { |
| 186 // Load cross-site page into Iframe. | 188 // Load cross-site page into Iframe. |
| 187 GURL https_url(https_server.GetURL("files/title1.html")); | 189 GURL https_url(https_server.GetURL("files/title1.html")); |
| 188 EXPECT_TRUE(NavigateIframeToURL(shell(), https_url, "test")); | 190 EXPECT_TRUE(NavigateIframeToURL(shell(), https_url, "test")); |
| 189 EXPECT_EQ(observer.navigation_url(), https_url); | 191 EXPECT_EQ(observer.navigation_url(), https_url); |
| 190 EXPECT_FALSE(observer.navigation_succeeded()); | 192 EXPECT_FALSE(observer.navigation_succeeded()); |
| 191 } | 193 } |
| 192 } | 194 } |
| 193 | 195 |
| 194 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframeRedirectOnce) { | 196 // TODO(nasko): Disable this test until out-of-process iframes is ready and the |
| 197 // security checks are back in place. |
| 198 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 199 DISABLED_CrossSiteIframeRedirectOnce) { |
| 195 ASSERT_TRUE(test_server()->Start()); | 200 ASSERT_TRUE(test_server()->Start()); |
| 196 net::TestServer https_server( | 201 net::TestServer https_server( |
| 197 net::TestServer::TYPE_HTTPS, | 202 net::TestServer::TYPE_HTTPS, |
| 198 net::TestServer::kLocalhost, | 203 net::TestServer::kLocalhost, |
| 199 FilePath(FILE_PATH_LITERAL("content/test/data"))); | 204 FilePath(FILE_PATH_LITERAL("content/test/data"))); |
| 200 ASSERT_TRUE(https_server.Start()); | 205 ASSERT_TRUE(https_server.Start()); |
| 201 | 206 |
| 202 GURL main_url(test_server()->GetURL("files/site_per_process_main.html")); | 207 GURL main_url(test_server()->GetURL("files/site_per_process_main.html")); |
| 203 GURL http_url(test_server()->GetURL("files/title1.html")); | 208 GURL http_url(test_server()->GetURL("files/title1.html")); |
| 204 GURL https_url(https_server.GetURL("files/title1.html")); | 209 GURL https_url(https_server.GetURL("files/title1.html")); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 EXPECT_EQ(observer.navigation_url(), client_redirect_http_url); | 310 EXPECT_EQ(observer.navigation_url(), client_redirect_http_url); |
| 306 EXPECT_TRUE(observer.navigation_succeeded()); | 311 EXPECT_TRUE(observer.navigation_succeeded()); |
| 307 | 312 |
| 308 // Redirecting to Same-site Page should be loaded successfully. | 313 // Redirecting to Same-site Page should be loaded successfully. |
| 309 load_observer2.Wait(); | 314 load_observer2.Wait(); |
| 310 EXPECT_EQ(observer.navigation_url(), http_url); | 315 EXPECT_EQ(observer.navigation_url(), http_url); |
| 311 EXPECT_TRUE(observer.navigation_succeeded()); | 316 EXPECT_TRUE(observer.navigation_succeeded()); |
| 312 } | 317 } |
| 313 } | 318 } |
| 314 | 319 |
| 320 // TODO(nasko): Disable this test until out-of-process iframes is ready and the |
| 321 // security checks are back in place. |
| 315 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 322 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 316 CrossSiteIframeRedirectTwice) { | 323 DISABLED_CrossSiteIframeRedirectTwice) { |
| 317 ASSERT_TRUE(test_server()->Start()); | 324 ASSERT_TRUE(test_server()->Start()); |
| 318 net::TestServer https_server( | 325 net::TestServer https_server( |
| 319 net::TestServer::TYPE_HTTPS, | 326 net::TestServer::TYPE_HTTPS, |
| 320 net::TestServer::kLocalhost, | 327 net::TestServer::kLocalhost, |
| 321 FilePath(FILE_PATH_LITERAL("content/test/data"))); | 328 FilePath(FILE_PATH_LITERAL("content/test/data"))); |
| 322 ASSERT_TRUE(https_server.Start()); | 329 ASSERT_TRUE(https_server.Start()); |
| 323 | 330 |
| 324 GURL main_url(test_server()->GetURL("files/site_per_process_main.html")); | 331 GURL main_url(test_server()->GetURL("files/site_per_process_main.html")); |
| 325 GURL http_url(test_server()->GetURL("files/title1.html")); | 332 GURL http_url(test_server()->GetURL("files/title1.html")); |
| 326 GURL https_url(https_server.GetURL("files/title1.html")); | 333 GURL https_url(https_server.GetURL("files/title1.html")); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 "server-redirect?" + client_redirect_http_url.spec())); | 393 "server-redirect?" + client_redirect_http_url.spec())); |
| 387 EXPECT_TRUE(NavigateIframeToURL(shell(), server_redirect_http_url, "test")); | 394 EXPECT_TRUE(NavigateIframeToURL(shell(), server_redirect_http_url, "test")); |
| 388 | 395 |
| 389 // DidFailProvisionalLoad when navigating to client_redirect_http_url. | 396 // DidFailProvisionalLoad when navigating to client_redirect_http_url. |
| 390 EXPECT_EQ(observer.navigation_url(), client_redirect_http_url); | 397 EXPECT_EQ(observer.navigation_url(), client_redirect_http_url); |
| 391 EXPECT_FALSE(observer.navigation_succeeded()); | 398 EXPECT_FALSE(observer.navigation_succeeded()); |
| 392 } | 399 } |
| 393 } | 400 } |
| 394 | 401 |
| 395 } | 402 } |
| OLD | NEW |