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 865efe0d603ef4b74431a6f0af57355f120775e1..191d840bf7565401d8c87f86ddb9e072414e80e2 100644 |
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc |
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc |
@@ -1045,6 +1045,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, |