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

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: Rebase 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 bbfba0dc05dd2d5dd640dd66783a6929b8fe56ee..34d8cbbde68242f9fa2c9c0b656846368c08bfaf 100644
--- a/chrome/browser/prerender/prerender_browsertest.cc
+++ b/chrome/browser/prerender/prerender_browsertest.cc
@@ -166,6 +166,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;
@@ -1200,7 +1201,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 {
@@ -2855,26 +2860,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