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 #include "chrome/browser/safe_browsing/client_side_detection_host.h" | 5 #include "chrome/browser/safe_browsing/client_side_detection_host.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <tuple> | 8 #include <tuple> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 using ::testing::DeleteArg; | 40 using ::testing::DeleteArg; |
41 using ::testing::DoAll; | 41 using ::testing::DoAll; |
42 using ::testing::Eq; | 42 using ::testing::Eq; |
43 using ::testing::IsNull; | 43 using ::testing::IsNull; |
44 using ::testing::Mock; | 44 using ::testing::Mock; |
45 using ::testing::NiceMock; | 45 using ::testing::NiceMock; |
46 using ::testing::NotNull; | 46 using ::testing::NotNull; |
47 using ::testing::Pointee; | 47 using ::testing::Pointee; |
48 using ::testing::Return; | 48 using ::testing::Return; |
49 using ::testing::SaveArg; | 49 using ::testing::SaveArg; |
50 using ::testing::SetArgumentPointee; | 50 using ::testing::SetArgPointee; |
51 using ::testing::StrictMock; | 51 using ::testing::StrictMock; |
52 using content::BrowserThread; | 52 using content::BrowserThread; |
53 using content::RenderFrameHostTester; | 53 using content::RenderFrameHostTester; |
54 using content::WebContents; | 54 using content::WebContents; |
55 | 55 |
56 namespace { | 56 namespace { |
57 | 57 |
58 const bool kFalse = false; | 58 const bool kFalse = false; |
59 const bool kTrue = true; | 59 const bool kTrue = true; |
60 | 60 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 if (match_csd_whitelist) { | 277 if (match_csd_whitelist) { |
278 EXPECT_CALL(*database_manager_.get(), MatchCsdWhitelistUrl(url)) | 278 EXPECT_CALL(*database_manager_.get(), MatchCsdWhitelistUrl(url)) |
279 .WillOnce(Return(*match_csd_whitelist)); | 279 .WillOnce(Return(*match_csd_whitelist)); |
280 } | 280 } |
281 if (malware_killswitch) { | 281 if (malware_killswitch) { |
282 EXPECT_CALL(*database_manager_.get(), IsMalwareKillSwitchOn()) | 282 EXPECT_CALL(*database_manager_.get(), IsMalwareKillSwitchOn()) |
283 .WillRepeatedly(Return(*malware_killswitch)); | 283 .WillRepeatedly(Return(*malware_killswitch)); |
284 } | 284 } |
285 if (get_valid_cached_result) { | 285 if (get_valid_cached_result) { |
286 EXPECT_CALL(*csd_service_, GetValidCachedResult(url, NotNull())) | 286 EXPECT_CALL(*csd_service_, GetValidCachedResult(url, NotNull())) |
287 .WillOnce(DoAll(SetArgumentPointee<1>(true), | 287 .WillOnce( |
288 Return(*get_valid_cached_result))); | 288 DoAll(SetArgPointee<1>(true), Return(*get_valid_cached_result))); |
289 } | 289 } |
290 if (is_in_cache) { | 290 if (is_in_cache) { |
291 EXPECT_CALL(*csd_service_, IsInCache(url)).WillOnce(Return(*is_in_cache)); | 291 EXPECT_CALL(*csd_service_, IsInCache(url)).WillOnce(Return(*is_in_cache)); |
292 } | 292 } |
293 if (over_phishing_report_limit) { | 293 if (over_phishing_report_limit) { |
294 EXPECT_CALL(*csd_service_, OverPhishingReportLimit()) | 294 EXPECT_CALL(*csd_service_, OverPhishingReportLimit()) |
295 .WillOnce(Return(*over_phishing_report_limit)); | 295 .WillOnce(Return(*over_phishing_report_limit)); |
296 } | 296 } |
297 if (over_malware_report_limit) { | 297 if (over_malware_report_limit) { |
298 EXPECT_CALL(*csd_service_, OverMalwareReportLimit()) | 298 EXPECT_CALL(*csd_service_, OverMalwareReportLimit()) |
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 EXPECT_EQ(url, resource.url); | 1191 EXPECT_EQ(url, resource.url); |
1192 EXPECT_EQ(url, resource.original_url); | 1192 EXPECT_EQ(url, resource.original_url); |
1193 | 1193 |
1194 ExpectStartPhishingDetection(NULL); | 1194 ExpectStartPhishingDetection(NULL); |
1195 | 1195 |
1196 // Showing a phishing warning will invalidate all the weak pointers which | 1196 // Showing a phishing warning will invalidate all the weak pointers which |
1197 // means we will not extract malware features. | 1197 // means we will not extract malware features. |
1198 ExpectShouldClassifyForMalwareResult(false); | 1198 ExpectShouldClassifyForMalwareResult(false); |
1199 } | 1199 } |
1200 } // namespace safe_browsing | 1200 } // namespace safe_browsing |
OLD | NEW |