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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc

Issue 2444383007: Trigger Dangerous indicator for unsafe subresources (Closed)
Patch Set: protip: #include the .h, not the .cc Created 4 years, 2 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/safe_browsing/safe_browsing_blocking_page_test.cc
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
index b2a18ddde0706b08c554de4b418336d169a9184b..468adf7f11532a578712a079b0c2613db5377aab 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
@@ -1047,6 +1047,54 @@ IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, WhitelistUnsaved) {
AssertNoInterstitial(true);
}
+namespace {
+
+class SecurityStyleTestObserver : public content::WebContentsObserver {
+ public:
+ explicit SecurityStyleTestObserver(content::WebContents* web_contents)
+ : content::WebContentsObserver(web_contents),
+ latest_security_style_(blink::WebSecurityStyleUnknown){};
+
+ blink::WebSecurityStyle latest_security_style() const {
+ return latest_security_style_;
+ }
+
+ // WebContentsObserver:
+ void SecurityStyleChanged(blink::WebSecurityStyle security_style,
+ const content::SecurityStyleExplanations&
+ security_style_explanations) override {
+ latest_security_style_ = security_style;
+ }
+
+ private:
+ blink::WebSecurityStyle latest_security_style_;
+ DISALLOW_COPY_AND_ASSIGN(SecurityStyleTestObserver);
+};
+
+} // namespace
+
+// Test that the security indicator gets updated on a Safe Browsing
+// interstitial triggered by a subresource. Regression test for
+// https://crbug.com/659713.
+IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
+ SecurityStateDowngradedForSubresourceInterstitial) {
+ WebContents* error_tab = browser()->tab_strip_model()->GetActiveWebContents();
+ ASSERT_TRUE(error_tab);
+ SecurityStyleTestObserver observer(error_tab);
+ // The security indicator should be downgraded while the interstitial shows.
+ SetupThreatIframeWarningAndNavigate();
+ ExpectSecurityIndicatorDowngrade(error_tab, 0u);
+ EXPECT_EQ(blink::WebSecurityStyleAuthenticationBroken,
+ observer.latest_security_style());
+
+ // The security indicator should still be downgraded post-interstitial.
+ EXPECT_TRUE(ClickAndWaitForDetach("proceed-link"));
+ AssertNoInterstitial(true);
+ WebContents* post_tab = browser()->tab_strip_model()->GetActiveWebContents();
+ ASSERT_TRUE(post_tab);
+ ExpectSecurityIndicatorDowngrade(post_tab, 0u);
+}
+
// Test that the security indicator is downgraded after clicking through a
// Safe Browsing interstitial.
IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/ui_manager.cc » ('j') | chrome/browser/safe_browsing/ui_manager_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698