Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: chrome/browser/safe_browsing/client_side_detection_host_unittest.cc

Issue 2927123004: Enable client side phishing detection on https sites. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 ExpectShouldClassifyForMalwareResult(false); 1165 ExpectShouldClassifyForMalwareResult(false);
1166 } 1166 }
1167 1167
1168 TEST_F(ClientSideDetectionHostTest, TestPreClassificationCheckHttpsUrl) { 1168 TEST_F(ClientSideDetectionHostTest, TestPreClassificationCheckHttpsUrl) {
1169 GURL url("https://host.com/"); 1169 GURL url("https://host.com/");
1170 ExpectPreClassificationChecks(url, &kFalse, &kFalse, &kFalse, &kFalse, 1170 ExpectPreClassificationChecks(url, &kFalse, &kFalse, &kFalse, &kFalse,
1171 &kFalse, &kFalse, &kFalse, &kFalse); 1171 &kFalse, &kFalse, &kFalse, &kFalse);
1172 NavigateAndCommit(url); 1172 NavigateAndCommit(url);
1173 WaitAndCheckPreClassificationChecks(); 1173 WaitAndCheckPreClassificationChecks();
1174 1174
1175 ExpectStartPhishingDetection(NULL); 1175 ExpectStartPhishingDetection(&url);
1176 ExpectShouldClassifyForMalwareResult(true); 1176 ExpectShouldClassifyForMalwareResult(true);
1177 } 1177 }
1178 1178
1179 TEST_F(ClientSideDetectionHostTest, TestPreClassificationCheckValidCached) { 1179 TEST_F(ClientSideDetectionHostTest, TestPreClassificationCheckValidCached) {
1180 // If result is cached, we will try and display the blocking page directly 1180 // If result is cached, we will try and display the blocking page directly
1181 // with no start classification message. 1181 // with no start classification message.
1182 GURL url("http://host8.com/"); 1182 GURL url("http://host8.com/");
1183 ExpectPreClassificationChecks(url, &kFalse, &kFalse, &kFalse, &kFalse, &kTrue, 1183 ExpectPreClassificationChecks(url, &kFalse, &kFalse, &kFalse, &kFalse, &kTrue,
1184 &kFalse, &kFalse, &kFalse); 1184 &kFalse, &kFalse, &kFalse);
1185 1185
1186 UnsafeResource resource; 1186 UnsafeResource resource;
1187 EXPECT_CALL(*ui_manager_.get(), DisplayBlockingPage(_)) 1187 EXPECT_CALL(*ui_manager_.get(), DisplayBlockingPage(_))
1188 .WillOnce(SaveArg<0>(&resource)); 1188 .WillOnce(SaveArg<0>(&resource));
1189 1189
1190 NavigateAndCommit(url); 1190 NavigateAndCommit(url);
1191 WaitAndCheckPreClassificationChecks(); 1191 WaitAndCheckPreClassificationChecks();
1192 EXPECT_EQ(url, resource.url); 1192 EXPECT_EQ(url, resource.url);
1193 EXPECT_EQ(url, resource.original_url); 1193 EXPECT_EQ(url, resource.original_url);
1194 1194
1195 ExpectStartPhishingDetection(NULL); 1195 ExpectStartPhishingDetection(NULL);
1196 1196
1197 // Showing a phishing warning will invalidate all the weak pointers which 1197 // Showing a phishing warning will invalidate all the weak pointers which
1198 // means we will not extract malware features. 1198 // means we will not extract malware features.
1199 ExpectShouldClassifyForMalwareResult(false); 1199 ExpectShouldClassifyForMalwareResult(false);
1200 } 1200 }
1201 } // namespace safe_browsing 1201 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698