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

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, 7 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
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_final_status.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prerender/prerender_browsertest.cc
diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc
index d6ab80780b87e36739fe4f1b3325b56ad64a96c6..998d9543944dc885ee61853f849a89c188a6f3c6 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;
@@ -1206,7 +1207,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 {
@@ -2877,26 +2882,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698