| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <deque> | 6 #include <deque> |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <unordered_map> | 9 #include <unordered_map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 EXPECT_TRUE(IsEmptyPrerenderLinkManager()); | 1278 EXPECT_TRUE(IsEmptyPrerenderLinkManager()); |
| 1279 } | 1279 } |
| 1280 | 1280 |
| 1281 // Checks that the visibility API works. | 1281 // Checks that the visibility API works. |
| 1282 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderVisibility) { | 1282 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderVisibility) { |
| 1283 PrerenderTestURL("/prerender/prerender_visibility.html", FINAL_STATUS_USED, | 1283 PrerenderTestURL("/prerender/prerender_visibility.html", FINAL_STATUS_USED, |
| 1284 1); | 1284 1); |
| 1285 NavigateToDestURL(); | 1285 NavigateToDestURL(); |
| 1286 } | 1286 } |
| 1287 | 1287 |
| 1288 // crbug.com/708158 |
| 1289 #if defined(OS_MACOSX) && defined(ADDRESS_SANITIZER) |
| 1290 #define MAYBE_PrerenderNoCommitNoSwap DISABLED_PrerenderNoCommitNoSwap |
| 1291 #else |
| 1292 #define MAYBE_PrerenderNoCommitNoSwap PrerenderNoCommitNoSwap |
| 1293 #endif |
| 1288 // Checks that the prerendering of a page is canceled correctly if we try to | 1294 // Checks that the prerendering of a page is canceled correctly if we try to |
| 1289 // swap it in before it commits. | 1295 // swap it in before it commits. |
| 1290 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderNoCommitNoSwap) { | 1296 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, MAYBE_PrerenderNoCommitNoSwap) { |
| 1291 // Navigate to a page that triggers a prerender for a URL that never commits. | 1297 // Navigate to a page that triggers a prerender for a URL that never commits. |
| 1292 const GURL kNoCommitUrl("http://never-respond.example.com"); | 1298 const GURL kNoCommitUrl("http://never-respond.example.com"); |
| 1293 base::FilePath file(GetTestPath("prerender_page.html")); | 1299 base::FilePath file(GetTestPath("prerender_page.html")); |
| 1294 | 1300 |
| 1295 base::RunLoop prerender_start_loop; | 1301 base::RunLoop prerender_start_loop; |
| 1296 BrowserThread::PostTask( | 1302 BrowserThread::PostTask( |
| 1297 BrowserThread::IO, FROM_HERE, | 1303 BrowserThread::IO, FROM_HERE, |
| 1298 base::Bind(&CreateHangingFirstRequestInterceptorOnIO, kNoCommitUrl, file, | 1304 base::Bind(&CreateHangingFirstRequestInterceptorOnIO, kNoCommitUrl, file, |
| 1299 prerender_start_loop.QuitClosure())); | 1305 prerender_start_loop.QuitClosure())); |
| 1300 DisableJavascriptCalls(); | 1306 DisableJavascriptCalls(); |
| 1301 PrerenderTestURL(kNoCommitUrl, | 1307 PrerenderTestURL(kNoCommitUrl, |
| 1302 FINAL_STATUS_NAVIGATION_UNCOMMITTED, | 1308 FINAL_STATUS_NAVIGATION_UNCOMMITTED, |
| 1303 0); | 1309 0); |
| 1304 // Wait for the hanging request to be scheduled. | 1310 // Wait for the hanging request to be scheduled. |
| 1305 prerender_start_loop.Run(); | 1311 prerender_start_loop.Run(); |
| 1306 | 1312 |
| 1307 // Navigate to the URL, but assume the contents won't be swapped in. | 1313 // Navigate to the URL, but assume the contents won't be swapped in. |
| 1308 NavigateToDestURLWithDisposition(WindowOpenDisposition::CURRENT_TAB, false); | 1314 NavigateToDestURLWithDisposition(WindowOpenDisposition::CURRENT_TAB, false); |
| 1309 } | 1315 } |
| 1310 | 1316 |
| 1317 // crbug.com/708158 |
| 1318 #if defined(OS_MACOSX) && defined(ADDRESS_SANITIZER) |
| 1319 #define MAYBE_PrerenderNoCommitNoSwap2 DISABLED_PrerenderNoCommitNoSwap2 |
| 1320 #else |
| 1321 #define MAYBE_PrerenderNoCommitNoSwap2 PrerenderNoCommitNoSwap2 |
| 1322 #endif |
| 1311 // Checks that client redirects don't add alias URLs until after they commit. | 1323 // Checks that client redirects don't add alias URLs until after they commit. |
| 1312 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderNoCommitNoSwap2) { | 1324 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, MAYBE_PrerenderNoCommitNoSwap2) { |
| 1313 // Navigate to a page that then navigates to a URL that never commits. | 1325 // Navigate to a page that then navigates to a URL that never commits. |
| 1314 const GURL kNoCommitUrl("http://never-respond.example.com"); | 1326 const GURL kNoCommitUrl("http://never-respond.example.com"); |
| 1315 base::FilePath file(GetTestPath("prerender_page.html")); | 1327 base::FilePath file(GetTestPath("prerender_page.html")); |
| 1316 | 1328 |
| 1317 base::RunLoop prerender_start_loop; | 1329 base::RunLoop prerender_start_loop; |
| 1318 BrowserThread::PostTask( | 1330 BrowserThread::PostTask( |
| 1319 BrowserThread::IO, FROM_HERE, | 1331 BrowserThread::IO, FROM_HERE, |
| 1320 base::Bind(&CreateHangingFirstRequestInterceptorOnIO, kNoCommitUrl, file, | 1332 base::Bind(&CreateHangingFirstRequestInterceptorOnIO, kNoCommitUrl, file, |
| 1321 prerender_start_loop.QuitClosure())); | 1333 prerender_start_loop.QuitClosure())); |
| 1322 DisableJavascriptCalls(); | 1334 DisableJavascriptCalls(); |
| (...skipping 2470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3793 browser()->tab_strip_model()->GetActiveWebContents(); | 3805 browser()->tab_strip_model()->GetActiveWebContents(); |
| 3794 bool display_test_result = false; | 3806 bool display_test_result = false; |
| 3795 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(web_contents, | 3807 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(web_contents, |
| 3796 "DidDisplayReallyPass()", | 3808 "DidDisplayReallyPass()", |
| 3797 &display_test_result)); | 3809 &display_test_result)); |
| 3798 ASSERT_TRUE(display_test_result); | 3810 ASSERT_TRUE(display_test_result); |
| 3799 } | 3811 } |
| 3800 #endif // !defined(DISABLE_NACL) | 3812 #endif // !defined(DISABLE_NACL) |
| 3801 | 3813 |
| 3802 } // namespace prerender | 3814 } // namespace prerender |
| OLD | NEW |