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

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

Issue 1410853003: [Safe Browsing] Only check main frame and iframe URLs on Mobile, for speed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rm unecessary thread restriction that interferes with tests Created 5 years, 2 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 // 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 "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 safe_browsing_util::MALWARE, 95 safe_browsing_util::MALWARE,
96 expected_threats); 96 expected_threats);
97 sb_check.url_results[0] = badurls[gurl.spec()]; 97 sb_check.url_results[0] = badurls[gurl.spec()];
98 sb_check.OnSafeBrowsingResult(); 98 sb_check.OnSafeBrowsingResult();
99 } 99 }
100 100
101 void SetURLThreatType(const GURL& url, SBThreatType threat_type) { 101 void SetURLThreatType(const GURL& url, SBThreatType threat_type) {
102 badurls[url.spec()] = threat_type; 102 badurls[url.spec()] = threat_type;
103 } 103 }
104 104
105 // These are called when checking URLs, so we implement them.
106 bool IsSupported() const override { return true; }
107 bool ChecksAreAlwaysAsync() const override { return false; }
108 bool CanCheckResourceType(
109 content::ResourceType /* resource_type */) const override {
110 return true;
111 }
112
105 // Called during startup, so must not check-fail. 113 // Called during startup, so must not check-fail.
106 bool CheckExtensionIDs(const std::set<std::string>& extension_ids, 114 bool CheckExtensionIDs(const std::set<std::string>& extension_ids,
107 Client* client) override { 115 Client* client) override {
108 return true; 116 return true;
109 } 117 }
110 118
111 private: 119 private:
112 ~FakeSafeBrowsingDatabaseManager() override {} 120 ~FakeSafeBrowsingDatabaseManager() override {}
113 121
114 base::hash_map<std::string, SBThreatType> badurls; 122 base::hash_map<std::string, SBThreatType> badurls;
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageIDNTest, 1021 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageIDNTest,
1014 SafeBrowsingBlockingPageDecodesIDN) { 1022 SafeBrowsingBlockingPageDecodesIDN) {
1015 EXPECT_TRUE(VerifyIDNDecoded()); 1023 EXPECT_TRUE(VerifyIDNDecoded());
1016 } 1024 }
1017 1025
1018 INSTANTIATE_TEST_CASE_P(SafeBrowsingBlockingPageIDNTestWithThreatType, 1026 INSTANTIATE_TEST_CASE_P(SafeBrowsingBlockingPageIDNTestWithThreatType,
1019 SafeBrowsingBlockingPageIDNTest, 1027 SafeBrowsingBlockingPageIDNTest,
1020 testing::Values(SB_THREAT_TYPE_URL_MALWARE, 1028 testing::Values(SB_THREAT_TYPE_URL_MALWARE,
1021 SB_THREAT_TYPE_URL_PHISHING, 1029 SB_THREAT_TYPE_URL_PHISHING,
1022 SB_THREAT_TYPE_URL_UNWANTED)); 1030 SB_THREAT_TYPE_URL_UNWANTED));
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/remote_database_manager_unittest.cc ('k') | chrome/browser/safe_browsing/safe_browsing_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698