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

Unified Diff: chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc

Issue 707223004: Don't report blocked web contents from already navigated render views. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 6 years, 1 month 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 | « chrome/browser/chrome_content_browser_client.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc
diff --git a/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc b/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc
index 3ace9753d7a8eb12ba3a8f5cd6f6e838e36a4147..f3c000d78a4b2ffcda889caedac00a9c96926aca 100644
--- a/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc
+++ b/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc
@@ -28,6 +28,7 @@
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/omnibox/autocomplete_match.h"
#include "components/omnibox/autocomplete_result.h"
+#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_frame_host.h"
@@ -484,4 +485,26 @@ IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, DenialOfService) {
ASSERT_EQ(25, GetBlockedContentsCount());
}
+// Verify that an onunload popup does not show up for about:blank.
+IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, Regress427477) {
+ ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL));
+ ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL));
+
+ GURL url(
+ embedded_test_server()->GetURL("/popup_blocker/popup-on-unload.html"));
+ ui_test_utils::NavigateToURL(browser(), url);
+
+ WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
+
+ tab->GetController().GoBack();
+ content::WaitForLoadStop(tab);
+
+ ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(),
+ browser()->host_desktop_type()));
+ ASSERT_EQ(1, browser()->tab_strip_model()->count());
+
+ // The popup from the unload event handler should not show up for about:blank.
+ ASSERT_EQ(0, GetBlockedContentsCount());
+}
+
} // namespace
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698