| 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 <deque> | 5 #include <deque> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 } | 1358 } |
| 1359 | 1359 |
| 1360 // Checks that the visibility API works. | 1360 // Checks that the visibility API works. |
| 1361 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderVisibility) { | 1361 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderVisibility) { |
| 1362 PrerenderTestURL("files/prerender/prerender_visibility.html", | 1362 PrerenderTestURL("files/prerender/prerender_visibility.html", |
| 1363 FINAL_STATUS_USED, | 1363 FINAL_STATUS_USED, |
| 1364 1); | 1364 1); |
| 1365 NavigateToDestURL(); | 1365 NavigateToDestURL(); |
| 1366 } | 1366 } |
| 1367 | 1367 |
| 1368 // Checks that the visibility API works when the prerender is quickly opened | 1368 // Checks that the prerendering of a page is canceled correctly when it is |
| 1369 // in a new tab before it stops loading. | 1369 // quickly opened in a new tab before it stops loading. |
| 1370 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderVisibilityQuickSwitch) { | 1370 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderQuickSwitch) { |
| 1371 PrerenderTestURL("files/prerender/prerender_visibility_quick.html", | 1371 PrerenderTestURL("files/prerender/prerender_page.html", |
| 1372 FINAL_STATUS_USED, 0); | 1372 FINAL_STATUS_CANCELLED, 0); |
| 1373 NavigateToDestURL(); | 1373 // Post a task to cancel all the prerenders. |
| 1374 MessageLoop::current()->PostTask( |
| 1375 FROM_HERE, base::Bind(&CancelAllPrerenders, GetPrerenderManager())); |
| 1376 content::RunMessageLoop(); |
| 1377 EXPECT_TRUE(GetPrerenderContents() == NULL); |
| 1374 } | 1378 } |
| 1375 | 1379 |
| 1380 // TODO(creis): Test for 234809, perhaps as a unittest. Commit one URL in |
| 1381 // prerender WebContents, then start a pending navigation. Swap it in, then |
| 1382 // commit the pending navigation. Crashes before this CL, should work now. |
| 1383 // Not sure how to write the test, though. |
| 1384 |
| 1376 // Checks that the prerendering of a page is canceled correctly when a | 1385 // Checks that the prerendering of a page is canceled correctly when a |
| 1377 // Javascript alert is called. | 1386 // Javascript alert is called. |
| 1378 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderAlertBeforeOnload) { | 1387 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderAlertBeforeOnload) { |
| 1379 PrerenderTestURL("files/prerender/prerender_alert_before_onload.html", | 1388 PrerenderTestURL("files/prerender/prerender_alert_before_onload.html", |
| 1380 FINAL_STATUS_JAVASCRIPT_ALERT, | 1389 FINAL_STATUS_JAVASCRIPT_ALERT, |
| 1381 1); | 1390 1); |
| 1382 } | 1391 } |
| 1383 | 1392 |
| 1384 // Checks that the prerendering of a page is canceled correctly when a | 1393 // Checks that the prerendering of a page is canceled correctly when a |
| 1385 // Javascript alert is called. | 1394 // Javascript alert is called. |
| (...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2782 // Checks that non-http/https main page redirects cancel the prerender. | 2791 // Checks that non-http/https main page redirects cancel the prerender. |
| 2783 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 2792 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
| 2784 PrerenderCancelMainFrameRedirectUnsupportedScheme) { | 2793 PrerenderCancelMainFrameRedirectUnsupportedScheme) { |
| 2785 GURL url = test_server()->GetURL( | 2794 GURL url = test_server()->GetURL( |
| 2786 CreateServerRedirect("invalidscheme://www.google.com/test.html")); | 2795 CreateServerRedirect("invalidscheme://www.google.com/test.html")); |
| 2787 PrerenderTestURL(url, FINAL_STATUS_UNSUPPORTED_SCHEME, 1); | 2796 PrerenderTestURL(url, FINAL_STATUS_UNSUPPORTED_SCHEME, 1); |
| 2788 NavigateToDestURL(); | 2797 NavigateToDestURL(); |
| 2789 } | 2798 } |
| 2790 | 2799 |
| 2791 } // namespace prerender | 2800 } // namespace prerender |
| OLD | NEW |