| 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 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 final_status() != expected_final_status_) { | 187 final_status() != expected_final_status_) { |
| 188 expected_final_status_ = FINAL_STATUS_RENDERER_CRASHED; | 188 expected_final_status_ = FINAL_STATUS_RENDERER_CRASHED; |
| 189 } | 189 } |
| 190 | 190 |
| 191 PrerenderContents::RenderViewGone(status); | 191 PrerenderContents::RenderViewGone(status); |
| 192 } | 192 } |
| 193 | 193 |
| 194 virtual bool AddAliasURL(const GURL& url) OVERRIDE { | 194 virtual bool AddAliasURL(const GURL& url) OVERRIDE { |
| 195 // Prevent FINAL_STATUS_UNSUPPORTED_SCHEME when navigating to about:crash in | 195 // Prevent FINAL_STATUS_UNSUPPORTED_SCHEME when navigating to about:crash in |
| 196 // the PrerenderRendererCrash test. | 196 // the PrerenderRendererCrash test. |
| 197 if (url.spec() != chrome::kAboutCrashURL) | 197 if (url.spec() != chrome::kChromeUICrashURL) |
| 198 return PrerenderContents::AddAliasURL(url); | 198 return PrerenderContents::AddAliasURL(url); |
| 199 return true; | 199 return true; |
| 200 } | 200 } |
| 201 | 201 |
| 202 virtual void DidStopLoading() OVERRIDE { | 202 virtual void DidStopLoading() OVERRIDE { |
| 203 PrerenderContents::DidStopLoading(); | 203 PrerenderContents::DidStopLoading(); |
| 204 ++number_of_loads_; | 204 ++number_of_loads_; |
| 205 if (ShouldRenderPrerenderedPageCorrectly(expected_final_status_) && | 205 if (ShouldRenderPrerenderedPageCorrectly(expected_final_status_) && |
| 206 number_of_loads_ == expected_number_of_loads_) { | 206 number_of_loads_ == expected_number_of_loads_) { |
| 207 MessageLoopForUI::current()->Quit(); | 207 MessageLoopForUI::current()->Quit(); |
| (...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderRendererCrash) { | 1366 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderRendererCrash) { |
| 1367 PrerenderTestURL("files/prerender/prerender_page.html", | 1367 PrerenderTestURL("files/prerender/prerender_page.html", |
| 1368 FINAL_STATUS_RENDERER_CRASHED, | 1368 FINAL_STATUS_RENDERER_CRASHED, |
| 1369 1); | 1369 1); |
| 1370 | 1370 |
| 1371 // Navigate to about:crash and then wait for the renderer to crash. | 1371 // Navigate to about:crash and then wait for the renderer to crash. |
| 1372 ASSERT_TRUE(GetPrerenderContents()); | 1372 ASSERT_TRUE(GetPrerenderContents()); |
| 1373 ASSERT_TRUE(GetPrerenderContents()->prerender_contents()); | 1373 ASSERT_TRUE(GetPrerenderContents()->prerender_contents()); |
| 1374 GetPrerenderContents()->prerender_contents()->web_contents()->GetController(). | 1374 GetPrerenderContents()->prerender_contents()->web_contents()->GetController(). |
| 1375 LoadURL( | 1375 LoadURL( |
| 1376 GURL(chrome::kAboutCrashURL), | 1376 GURL(chrome::kChromeUICrashURL), |
| 1377 content::Referrer(), | 1377 content::Referrer(), |
| 1378 content::PAGE_TRANSITION_TYPED, | 1378 content::PAGE_TRANSITION_TYPED, |
| 1379 std::string()); | 1379 std::string()); |
| 1380 ui_test_utils::RunMessageLoop(); | 1380 ui_test_utils::RunMessageLoop(); |
| 1381 } | 1381 } |
| 1382 | 1382 |
| 1383 // Checks that we correctly use a prerendered page when navigating to a | 1383 // Checks that we correctly use a prerendered page when navigating to a |
| 1384 // fragment. | 1384 // fragment. |
| 1385 // DISABLED: http://crbug.com/84154 | 1385 // DISABLED: http://crbug.com/84154 |
| 1386 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 1386 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1940 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, MatchCompleteDummy) { | 1940 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, MatchCompleteDummy) { |
| 1941 std::deque<FinalStatus> expected_final_status_queue; | 1941 std::deque<FinalStatus> expected_final_status_queue; |
| 1942 expected_final_status_queue.push_back(FINAL_STATUS_JAVASCRIPT_ALERT); | 1942 expected_final_status_queue.push_back(FINAL_STATUS_JAVASCRIPT_ALERT); |
| 1943 expected_final_status_queue.push_back(FINAL_STATUS_WOULD_HAVE_BEEN_USED); | 1943 expected_final_status_queue.push_back(FINAL_STATUS_WOULD_HAVE_BEEN_USED); |
| 1944 PrerenderTestURL("files/prerender/prerender_alert_before_onload.html", | 1944 PrerenderTestURL("files/prerender/prerender_alert_before_onload.html", |
| 1945 expected_final_status_queue, 1); | 1945 expected_final_status_queue, 1); |
| 1946 NavigateToDestURL(); | 1946 NavigateToDestURL(); |
| 1947 } | 1947 } |
| 1948 | 1948 |
| 1949 } // namespace prerender | 1949 } // namespace prerender |
| OLD | NEW |