| 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 3f39487d9d6d8814656e270e6226f186be4da804..3f3a9b2bbd7da4d5c29dcf3028ff3f9f4b461cae 100644
|
| --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
|
| +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
|
| @@ -43,12 +43,14 @@
|
| #include "components/security_interstitials/core/controller_client.h"
|
| #include "components/security_interstitials/core/metrics_helper.h"
|
| #include "components/security_state/core/security_state.h"
|
| +#include "components/strings/grit/components_strings.h"
|
| #include "content/public/browser/interstitial_page.h"
|
| #include "content/public/browser/navigation_controller.h"
|
| #include "content/public/browser/navigation_entry.h"
|
| #include "content/public/browser/notification_types.h"
|
| #include "content/public/browser/render_frame_host.h"
|
| #include "content/public/browser/render_process_host.h"
|
| +#include "content/public/browser/security_style_explanations.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "content/public/test/browser_test_utils.h"
|
| #include "content/public/test/test_browser_thread.h"
|
| @@ -57,6 +59,7 @@
|
| #include "net/cert/mock_cert_verifier.h"
|
| #include "net/test/embedded_test_server/embedded_test_server.h"
|
| #include "net/test/url_request/url_request_mock_http_job.h"
|
| +#include "ui/base/l10n/l10n_util.h"
|
|
|
| using chrome_browser_interstitials::SecurityInterstitialIDNTest;
|
| using content::BrowserThread;
|
| @@ -1116,21 +1119,29 @@ class SecurityStyleTestObserver : public content::WebContentsObserver {
|
| public:
|
| explicit SecurityStyleTestObserver(content::WebContents* web_contents)
|
| : content::WebContentsObserver(web_contents),
|
| - latest_security_style_(blink::WebSecurityStyleUnknown) {}
|
| + latest_security_style_(blink::WebSecurityStyleUnknown),
|
| + latest_security_style_explanations_() {}
|
|
|
| blink::WebSecurityStyle latest_security_style() const {
|
| return latest_security_style_;
|
| }
|
|
|
| + content::SecurityStyleExplanations latest_security_style_explanations()
|
| + const {
|
| + return latest_security_style_explanations_;
|
| + }
|
| +
|
| // WebContentsObserver:
|
| void SecurityStyleChanged(blink::WebSecurityStyle security_style,
|
| const content::SecurityStyleExplanations&
|
| security_style_explanations) override {
|
| latest_security_style_ = security_style;
|
| + latest_security_style_explanations_ = security_style_explanations;
|
| }
|
|
|
| private:
|
| blink::WebSecurityStyle latest_security_style_;
|
| + content::SecurityStyleExplanations latest_security_style_explanations_;
|
| DISALLOW_COPY_AND_ASSIGN(SecurityStyleTestObserver);
|
| };
|
|
|
| @@ -1149,6 +1160,9 @@ IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
|
| ExpectSecurityIndicatorDowngrade(error_tab, 0u);
|
| EXPECT_EQ(blink::WebSecurityStyleAuthenticationBroken,
|
| observer.latest_security_style());
|
| + // Security style summary for Developer Tools should contain a warning.
|
| + EXPECT_EQ(l10n_util::GetStringUTF8(IDS_SAFEBROWSING_WARNING),
|
| + observer.latest_security_style_explanations().summary_override);
|
|
|
| // The security indicator should still be downgraded post-interstitial.
|
| EXPECT_TRUE(ClickAndWaitForDetach("proceed-link"));
|
| @@ -1266,18 +1280,28 @@ IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
|
| // HTTPS (meaning that the SB state overrides the HTTPS state).
|
| IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
|
| SecurityState_ValidHTTPS) {
|
| - // The security indicator should be downgraded while the interstitial shows.
|
| - SetupWarningAndNavigateToValidHTTPS();
|
| 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.
|
| + SetupWarningAndNavigateToValidHTTPS();
|
| ExpectSecurityIndicatorDowngrade(error_tab, 0u);
|
|
|
| + // Security style summary for Developer Tools should contain a warning.
|
| + EXPECT_EQ(l10n_util::GetStringUTF8(IDS_SAFEBROWSING_WARNING),
|
| + observer.latest_security_style_explanations().summary_override);
|
| +
|
| // 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);
|
| +
|
| + // Security style summary for Developer Tools should still contain a warning.
|
| + EXPECT_EQ(l10n_util::GetStringUTF8(IDS_SAFEBROWSING_WARNING),
|
| + observer.latest_security_style_explanations().summary_override);
|
| }
|
|
|
| // Test that the security indicator is still downgraded after two interstitials
|
|
|