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

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: 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
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..d021b04798ce5f696e246db237101c49f5b31019 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 th unload event handler should not show up for about:blank.
Charlie Reis 2014/11/10 17:41:26 nit: th -> the
jochen (gone - plz use gerrit) 2014/11/10 19:39:13 done
+ ASSERT_EQ(0, GetBlockedContentsCount());
+}
+
} // namespace

Powered by Google App Engine
This is Rietveld 408576698