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, |