| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // This test creates a fake safebrowsing service, where we can inject known- | 5 // This test creates a fake safebrowsing service, where we can inject known- |
| 6 // threat urls. It then uses a real browser to go to these urls, and sends | 6 // threat urls. It then uses a real browser to go to these urls, and sends |
| 7 // "goback" or "proceed" commands and verifies they work. | 7 // "goback" or "proceed" commands and verifies they work. |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 | 581 |
| 582 void ExpectSecurityIndicatorDowngrade(content::WebContents* tab, | 582 void ExpectSecurityIndicatorDowngrade(content::WebContents* tab, |
| 583 net::CertStatus cert_status) { | 583 net::CertStatus cert_status) { |
| 584 ChromeSecurityStateModelClient* model_client = | 584 ChromeSecurityStateModelClient* model_client = |
| 585 ChromeSecurityStateModelClient::FromWebContents(tab); | 585 ChromeSecurityStateModelClient::FromWebContents(tab); |
| 586 ASSERT_TRUE(model_client); | 586 ASSERT_TRUE(model_client); |
| 587 security_state::SecurityStateModel::SecurityInfo security_info; | 587 security_state::SecurityStateModel::SecurityInfo security_info; |
| 588 model_client->GetSecurityInfo(&security_info); | 588 model_client->GetSecurityInfo(&security_info); |
| 589 EXPECT_EQ(security_state::SecurityStateModel::DANGEROUS, | 589 EXPECT_EQ(security_state::SecurityStateModel::DANGEROUS, |
| 590 security_info.security_level); | 590 security_info.security_level); |
| 591 EXPECT_TRUE(security_info.fails_malware_check); | 591 EXPECT_NE(security_state::SecurityStateModel::MALICIOUS_CONTENT_STATUS_NONE, |
| 592 security_info.malicious_content_status); |
| 592 // TODO(felt): Restore this check when https://crbug.com/641187 is fixed. | 593 // TODO(felt): Restore this check when https://crbug.com/641187 is fixed. |
| 593 // EXPECT_EQ(cert_status, model_client->GetSecurityInfo().cert_status); | 594 // EXPECT_EQ(cert_status, model_client->GetSecurityInfo().cert_status); |
| 594 } | 595 } |
| 595 | 596 |
| 596 void ExpectNoSecurityIndicatorDowngrade(content::WebContents* tab) { | 597 void ExpectNoSecurityIndicatorDowngrade(content::WebContents* tab) { |
| 597 ChromeSecurityStateModelClient* model_client = | 598 ChromeSecurityStateModelClient* model_client = |
| 598 ChromeSecurityStateModelClient::FromWebContents(tab); | 599 ChromeSecurityStateModelClient::FromWebContents(tab); |
| 599 ASSERT_TRUE(model_client); | 600 ASSERT_TRUE(model_client); |
| 600 security_state::SecurityStateModel::SecurityInfo security_info; | 601 security_state::SecurityStateModel::SecurityInfo security_info; |
| 601 model_client->GetSecurityInfo(&security_info); | 602 model_client->GetSecurityInfo(&security_info); |
| 602 EXPECT_EQ(security_state::SecurityStateModel::NONE, | 603 EXPECT_EQ(security_state::SecurityStateModel::NONE, |
| 603 security_info.security_level); | 604 security_info.security_level); |
| 604 EXPECT_FALSE(security_info.fails_malware_check); | 605 EXPECT_EQ(security_state::SecurityStateModel::MALICIOUS_CONTENT_STATUS_NONE, |
| 606 security_info.malicious_content_status); |
| 605 } | 607 } |
| 606 | 608 |
| 607 protected: | 609 protected: |
| 608 TestThreatDetailsFactory details_factory_; | 610 TestThreatDetailsFactory details_factory_; |
| 609 | 611 |
| 610 private: | 612 private: |
| 611 // Adds a safebrowsing result of the current test threat to the fake | 613 // Adds a safebrowsing result of the current test threat to the fake |
| 612 // safebrowsing service, navigates to that page, and returns the url. | 614 // safebrowsing service, navigates to that page, and returns the url. |
| 613 // The various wrappers supply different URLs. | 615 // The various wrappers supply different URLs. |
| 614 GURL SetupWarningAndNavigateToURL(GURL url) { | 616 GURL SetupWarningAndNavigateToURL(GURL url) { |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1307 | 1309 |
| 1308 INSTANTIATE_TEST_CASE_P( | 1310 INSTANTIATE_TEST_CASE_P( |
| 1309 SafeBrowsingBlockingPageIDNTestWithThreatType, | 1311 SafeBrowsingBlockingPageIDNTestWithThreatType, |
| 1310 SafeBrowsingBlockingPageIDNTest, | 1312 SafeBrowsingBlockingPageIDNTest, |
| 1311 testing::Combine(testing::Values(false, true), | 1313 testing::Combine(testing::Values(false, true), |
| 1312 testing::Values(SB_THREAT_TYPE_URL_MALWARE, | 1314 testing::Values(SB_THREAT_TYPE_URL_MALWARE, |
| 1313 SB_THREAT_TYPE_URL_PHISHING, | 1315 SB_THREAT_TYPE_URL_PHISHING, |
| 1314 SB_THREAT_TYPE_URL_UNWANTED))); | 1316 SB_THREAT_TYPE_URL_UNWANTED))); |
| 1315 | 1317 |
| 1316 } // namespace safe_browsing | 1318 } // namespace safe_browsing |
| OLD | NEW |