Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: chrome/browser/prerender/prerender_browsertest.cc

Issue 2656653002: Suppress NEW_NAVIGATION_ENTRY prerenderer failures for ORIGIN_OFFLINE (Closed)
Patch Set: Fixes comparison and adds browser test. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 3092 matching lines...) Expand 10 before | Expand all | Expand 10 after
3103 NavigateToURLWithParams(params, false); 3103 NavigateToURLWithParams(params, false);
3104 } 3104 }
3105 3105
3106 // Checks that the prerendering of a page is canceled correctly when the 3106 // Checks that the prerendering of a page is canceled correctly when the
3107 // prerendered page tries to make a second navigation entry. 3107 // prerendered page tries to make a second navigation entry.
3108 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderNewNavigationEntry) { 3108 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderNewNavigationEntry) {
3109 PrerenderTestURL("/prerender/prerender_new_entry.html", 3109 PrerenderTestURL("/prerender/prerender_new_entry.html",
3110 FINAL_STATUS_NEW_NAVIGATION_ENTRY, 1); 3110 FINAL_STATUS_NEW_NAVIGATION_ENTRY, 1);
3111 } 3111 }
3112 3112
3113 // Checks that the prerendering of a page for ORIGIN_OFFLINE is not canceled
3114 // when the prerendered page tries to make a second navigation entry.
3115 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
3116 PrerenderNoNewNavigationEntryForOffline) {
pasko 2017/01/26 12:09:39 nit: I think this checks when there _is_ a new nav
dougarnett 2017/01/26 16:27:39 Done.
3117 // Navigate to about:blank to get the session storage namespace.
3118 ui_test_utils::NavigateToURL(current_browser(), GURL(url::kAboutBlankURL));
3119 content::SessionStorageNamespace* storage_namespace =
3120 GetActiveWebContents()
3121 ->GetController()
3122 .GetDefaultSessionStorageNamespace();
3123
3124 std::unique_ptr<TestPrerender> test_prerender =
3125 prerender_contents_factory()->ExpectPrerenderContents(
3126 FINAL_STATUS_APP_TERMINATING);
3127
3128 const GURL url =
3129 src_server()->GetURL(MakeAbsolute("/prerender/prerender_new_entry.html"));
3130 std::unique_ptr<PrerenderHandle> prerender_handle(
3131 GetPrerenderManager()->AddPrerenderForOffline(url, storage_namespace,
3132 gfx::Size(640, 480)));
3133 ASSERT_EQ(prerender_handle->contents(), test_prerender->contents());
3134 test_prerender->WaitForLoads(2);
3135 ASSERT_EQ(1, GetActiveWebContents()->GetController().GetEntryCount());
3136 }
3137
3113 // Attempt a swap-in in a new tab. The session storage doesn't match, so it 3138 // Attempt a swap-in in a new tab. The session storage doesn't match, so it
3114 // should not swap. 3139 // should not swap.
3115 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPageNewTab) { 3140 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPageNewTab) {
3116 PrerenderTestURL("/prerender/prerender_page.html", 3141 PrerenderTestURL("/prerender/prerender_page.html",
3117 FINAL_STATUS_APP_TERMINATING, 1); 3142 FINAL_STATUS_APP_TERMINATING, 1);
3118 3143
3119 // Open a new tab to navigate in. 3144 // Open a new tab to navigate in.
3120 ui_test_utils::NavigateToURLWithDisposition( 3145 ui_test_utils::NavigateToURLWithDisposition(
3121 current_browser(), GURL(url::kAboutBlankURL), 3146 current_browser(), GURL(url::kAboutBlankURL),
3122 WindowOpenDisposition::NEW_FOREGROUND_TAB, 3147 WindowOpenDisposition::NEW_FOREGROUND_TAB,
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
3757 browser()->tab_strip_model()->GetActiveWebContents(); 3782 browser()->tab_strip_model()->GetActiveWebContents();
3758 bool display_test_result = false; 3783 bool display_test_result = false;
3759 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(web_contents, 3784 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(web_contents,
3760 "DidDisplayReallyPass()", 3785 "DidDisplayReallyPass()",
3761 &display_test_result)); 3786 &display_test_result));
3762 ASSERT_TRUE(display_test_result); 3787 ASSERT_TRUE(display_test_result);
3763 } 3788 }
3764 #endif // !defined(DISABLE_NACL) 3789 #endif // !defined(DISABLE_NACL)
3765 3790
3766 } // namespace prerender 3791 } // namespace prerender
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_contents.cc » ('j') | chrome/browser/prerender/prerender_contents.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698