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

Unified Diff: chrome/browser/prerender/prerender_browsertest.cc

Issue 257083002: Check BrowsingInstance before swapping prerenders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move accounting to RFHM Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/prerender/prerender_browsertest.cc
diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc
index 4e7e946a1c11978ea967493e1b44cfdd4c79a713..713790cff3fe6cfb3351381ad2311da623ce52e5 100644
--- a/chrome/browser/prerender/prerender_browsertest.cc
+++ b/chrome/browser/prerender/prerender_browsertest.cc
@@ -163,6 +163,7 @@ bool ShouldAbortPrerenderBeforeSwap(FinalStatus status) {
case FINAL_STATUS_PAGE_BEING_CAPTURED:
case FINAL_STATUS_NAVIGATION_UNCOMMITTED:
case FINAL_STATUS_WOULD_HAVE_BEEN_USED:
+ case FINAL_STATUS_NON_EMPTY_BROWSING_INSTANCE:
return false;
default:
return true;
@@ -1197,7 +1198,11 @@ class PrerenderBrowserTest : virtual public InProcessBrowserTest {
}
void OpenDestURLViaWindowOpen() const {
- OpenURLWithJSImpl("WindowOpen", dest_url_, GURL(), true);
+ OpenURLViaWindowOpen(dest_url_);
+ }
+
+ void OpenURLViaWindowOpen(const GURL& url) const {
+ OpenURLWithJSImpl("WindowOpen", url, GURL(), true);
}
void RemoveLinkElement(int i) const {
@@ -2852,26 +2857,36 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPrint) {
// Checks that if a page is opened in a new window by javascript and both the
// pages are in the same domain, the prerendered page is not used, due to
-// window.opener.
+// there being other tabs in the same browsing instance.
IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
PrerenderSameDomainWindowOpenerWindowOpen) {
PrerenderTestURL("files/prerender/prerender_page.html",
- FINAL_STATUS_WINDOW_OPENER,
+ FINAL_STATUS_NON_EMPTY_BROWSING_INSTANCE,
1);
OpenDestURLViaWindowOpen();
}
// Checks that if a page is opened due to click on a href with target="_blank"
// and both pages are in the same domain the prerendered page is not used, due
-// to window.opener.
+// there being other tabs in the same browsing instance.
IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
PrerenderSameDomainWindowOpenerClickTarget) {
PrerenderTestURL("files/prerender/prerender_page.html",
- FINAL_STATUS_WINDOW_OPENER,
+ FINAL_STATUS_NON_EMPTY_BROWSING_INSTANCE,
1);
OpenDestURLViaClickTarget();
}
+// Checks that prerenders do not get swapped into target pages that have opened
+// a popup, even if the target page itself does not have an opener.
+IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderTargetHasPopup) {
+ PrerenderTestURL("files/prerender/prerender_page.html",
+ FINAL_STATUS_NON_EMPTY_BROWSING_INSTANCE,
+ 1);
+ OpenURLViaWindowOpen(GURL(content::kAboutBlankURL));
+ NavigateToDestURLWithDisposition(CURRENT_TAB, false);
+}
+
class TestClientCertStore : public net::ClientCertStore {
public:
TestClientCertStore() {}
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_final_status.h » ('j') | content/browser/browsing_instance.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698