| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 EXPECT_FALSE(threat_details_done_callback_.is_null()); | 187 EXPECT_FALSE(threat_details_done_callback_.is_null()); |
| 188 if (!threat_details_done_callback_.is_null()) { | 188 if (!threat_details_done_callback_.is_null()) { |
| 189 threat_details_done_callback_.Run(); | 189 threat_details_done_callback_.Run(); |
| 190 threat_details_done_callback_ = base::Closure(); | 190 threat_details_done_callback_ = base::Closure(); |
| 191 } | 191 } |
| 192 threat_details_done_ = true; | 192 threat_details_done_ = true; |
| 193 } | 193 } |
| 194 | 194 |
| 195 void MaybeReportSafeBrowsingHit(const HitReport& hit_report, | 195 void MaybeReportSafeBrowsingHit(const HitReport& hit_report, |
| 196 WebContents* web_contents) override { | 196 const WebContents* web_contents) override { |
| 197 if (SafeBrowsingUIManager::ShouldSendHitReport(hit_report, web_contents)) { | 197 if (SafeBrowsingUIManager::ShouldSendHitReport(hit_report, web_contents)) { |
| 198 hit_report_sent_ = true; | 198 hit_report_sent_ = true; |
| 199 } | 199 } |
| 200 } | 200 } |
| 201 | 201 |
| 202 bool hit_report_sent() { return hit_report_sent_; } | 202 bool hit_report_sent() { return hit_report_sent_; } |
| 203 | 203 |
| 204 void set_threat_details_done_callback(const base::Closure& callback) { | 204 void set_threat_details_done_callback(const base::Closure& callback) { |
| 205 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 205 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 206 EXPECT_TRUE(threat_details_done_callback_.is_null()); | 206 EXPECT_TRUE(threat_details_done_callback_.is_null()); |
| (...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 | 1566 |
| 1567 INSTANTIATE_TEST_CASE_P( | 1567 INSTANTIATE_TEST_CASE_P( |
| 1568 SafeBrowsingBlockingPageIDNTestWithThreatType, | 1568 SafeBrowsingBlockingPageIDNTestWithThreatType, |
| 1569 SafeBrowsingBlockingPageIDNTest, | 1569 SafeBrowsingBlockingPageIDNTest, |
| 1570 testing::Combine(testing::Values(false, true), | 1570 testing::Combine(testing::Values(false, true), |
| 1571 testing::Values(SB_THREAT_TYPE_URL_MALWARE, | 1571 testing::Values(SB_THREAT_TYPE_URL_MALWARE, |
| 1572 SB_THREAT_TYPE_URL_PHISHING, | 1572 SB_THREAT_TYPE_URL_PHISHING, |
| 1573 SB_THREAT_TYPE_URL_UNWANTED))); | 1573 SB_THREAT_TYPE_URL_UNWANTED))); |
| 1574 | 1574 |
| 1575 } // namespace safe_browsing | 1575 } // namespace safe_browsing |
| OLD | NEW |