| 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 422e33ad23016937aee26a8a82aeb391e70c6789..b9569827d04569d3f82a29328125ee34c386b0fd 100644
|
| --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
|
| +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
|
| @@ -571,6 +571,18 @@ class SafeBrowsingBlockingPageBrowserTest
|
| EXPECT_EQ(expected_tag_name, actual_resource.tag_name());
|
| }
|
|
|
| + void ExpectSecurityIndicatorDowngrade(content::WebContents* tab,
|
| + net::CertStatus cert_status) {
|
| + ChromeSecurityStateModelClient* model_client =
|
| + ChromeSecurityStateModelClient::FromWebContents(tab);
|
| + ASSERT_TRUE(model_client);
|
| + EXPECT_EQ(security_state::SecurityStateModel::SECURITY_ERROR,
|
| + model_client->GetSecurityInfo().security_level);
|
| + EXPECT_TRUE(model_client->GetSecurityInfo().fails_malware_check);
|
| + // TODO(felt): Restore this check when https://crbug.com/641187 is fixed.
|
| + // EXPECT_EQ(cert_status, model_client->GetSecurityInfo().cert_status);
|
| + }
|
| +
|
| protected:
|
| TestThreatDetailsFactory details_factory_;
|
|
|
| @@ -1049,59 +1061,56 @@ IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, WhitelistUnsaved) {
|
| // Safe Browsing interstitial.
|
| IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
|
| SecurityState_HTTP) {
|
| + // The security indicator should be downgraded while the interstitial shows.
|
| SetupWarningAndNavigate();
|
| + WebContents* error_tab = browser()->tab_strip_model()->GetActiveWebContents();
|
| + ASSERT_TRUE(error_tab);
|
| + ExpectSecurityIndicatorDowngrade(error_tab, 0u);
|
| +
|
| + // The security indicator should still be downgraded post-interstitial.
|
| EXPECT_TRUE(ClickAndWaitForDetach("proceed-link"));
|
| AssertNoInterstitial(true);
|
| -
|
| - WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
|
| - ASSERT_TRUE(tab);
|
| - ChromeSecurityStateModelClient* model_client =
|
| - ChromeSecurityStateModelClient::FromWebContents(tab);
|
| - ASSERT_TRUE(model_client);
|
| - EXPECT_EQ(security_state::SecurityStateModel::SECURITY_ERROR,
|
| - model_client->GetSecurityInfo().security_level);
|
| - EXPECT_TRUE(model_client->GetSecurityInfo().fails_malware_check);
|
| + WebContents* post_tab = browser()->tab_strip_model()->GetActiveWebContents();
|
| + ASSERT_TRUE(post_tab);
|
| + ExpectSecurityIndicatorDowngrade(post_tab, 0u);
|
| }
|
|
|
| // Test that the security indicator is downgraded even if the website has valid
|
| // 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);
|
| + ExpectSecurityIndicatorDowngrade(error_tab, 0u);
|
| +
|
| + // The security indicator should still be downgraded post-interstitial.
|
| EXPECT_TRUE(ClickAndWaitForDetach("proceed-link"));
|
| AssertNoInterstitial(true);
|
| -
|
| - WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
|
| - ASSERT_TRUE(tab);
|
| - ChromeSecurityStateModelClient* model_client =
|
| - ChromeSecurityStateModelClient::FromWebContents(tab);
|
| - ASSERT_TRUE(model_client);
|
| - EXPECT_EQ(security_state::SecurityStateModel::SECURITY_ERROR,
|
| - model_client->GetSecurityInfo().security_level);
|
| - EXPECT_TRUE(model_client->GetSecurityInfo().fails_malware_check);
|
| - EXPECT_EQ(0u, model_client->GetSecurityInfo().cert_status);
|
| + WebContents* post_tab = browser()->tab_strip_model()->GetActiveWebContents();
|
| + ASSERT_TRUE(post_tab);
|
| + ExpectSecurityIndicatorDowngrade(post_tab, 0u);
|
| }
|
|
|
| // Test that the security indicator is still downgraded after two interstitials
|
| // are shown in a row (one for Safe Browsing, one for invalid HTTPS).
|
| IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
|
| SecurityState_InvalidHTTPS) {
|
| + // The security indicator should be downgraded while the interstitial shows.
|
| SetupWarningAndNavigateToInvalidHTTPS();
|
| + WebContents* error_tab = browser()->tab_strip_model()->GetActiveWebContents();
|
| + ASSERT_TRUE(error_tab);
|
| + ExpectSecurityIndicatorDowngrade(error_tab, 0u);
|
| +
|
| + // The security indicator should still be downgraded post-interstitial.
|
| EXPECT_TRUE(ClickAndWaitForDetach("proceed-link"));
|
| AssertNoInterstitial(true);
|
| -
|
| - WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
|
| - ASSERT_TRUE(tab);
|
| - ChromeSecurityStateModelClient* model_client =
|
| - ChromeSecurityStateModelClient::FromWebContents(tab);
|
| - ASSERT_TRUE(model_client);
|
| - EXPECT_EQ(security_state::SecurityStateModel::SECURITY_ERROR,
|
| - model_client->GetSecurityInfo().security_level);
|
| - EXPECT_TRUE(model_client->GetSecurityInfo().fails_malware_check);
|
| -
|
| - // TODO(felt): In the testing framework, the cert status gets reset to 0
|
| - // after the malware interstitial and stays that way.
|
| - //EXPECT_NE(0u, model_client->GetSecurityInfo().cert_status);
|
| + WebContents* post_tab = browser()->tab_strip_model()->GetActiveWebContents();
|
| + ASSERT_TRUE(post_tab);
|
| + // TODO(felt): Sometimes the cert status here is 0u, which is wrong.
|
| + // Filed https://crbug.com/641187 to investigate.
|
| + ExpectSecurityIndicatorDowngrade(post_tab, net::CERT_STATUS_INVALID);
|
| }
|
|
|
| INSTANTIATE_TEST_CASE_P(
|
|
|