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

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

Issue 7863006: Add a whitelist for the new binary download protection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Matt's comment. Created 9 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 safebrowsing service using test safebrowsing database 5 // This test creates a safebrowsing service using test safebrowsing database
6 // and a test protocol manager. It is used to test logics in safebrowsing 6 // and a test protocol manager. It is used to test logics in safebrowsing
7 // service. 7 // service.
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 return false; 77 return false;
78 DCHECK_LE(1U, prefix_hits->size()); 78 DCHECK_LE(1U, prefix_hits->size());
79 return true; 79 return true;
80 } 80 }
81 virtual bool ContainsDownloadHashPrefix(const SBPrefix& prefix) { 81 virtual bool ContainsDownloadHashPrefix(const SBPrefix& prefix) {
82 return download_digest_prefix_.count(prefix) > 0; 82 return download_digest_prefix_.count(prefix) > 0;
83 } 83 }
84 virtual bool ContainsCsdWhitelistedUrl(const GURL& url) { 84 virtual bool ContainsCsdWhitelistedUrl(const GURL& url) {
85 return true; 85 return true;
86 } 86 }
87 virtual bool ContainsDownloadWhitelistedString(const std::string& str) {
88 return true;
89 }
90 virtual bool ContainsDownloadWhitelistedUrl(const GURL& url) {
91 return true;
92 }
87 virtual bool UpdateStarted(std::vector<SBListChunkRanges>* lists) { 93 virtual bool UpdateStarted(std::vector<SBListChunkRanges>* lists) {
88 ADD_FAILURE() << "Not implemented."; 94 ADD_FAILURE() << "Not implemented.";
89 return false; 95 return false;
90 } 96 }
91 virtual void InsertChunks(const std::string& list_name, 97 virtual void InsertChunks(const std::string& list_name,
92 const SBChunkList& chunks) { 98 const SBChunkList& chunks) {
93 ADD_FAILURE() << "Not implemented."; 99 ADD_FAILURE() << "Not implemented.";
94 } 100 }
95 virtual void DeleteChunks(const std::vector<SBChunkDelete>& chunk_deletes) { 101 virtual void DeleteChunks(const std::vector<SBChunkDelete>& chunk_deletes) {
96 ADD_FAILURE() << "Not implemented."; 102 ADD_FAILURE() << "Not implemented.";
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 }; 166 };
161 167
162 // Factory that creates TestSafeBrowsingDatabase instances. 168 // Factory that creates TestSafeBrowsingDatabase instances.
163 class TestSafeBrowsingDatabaseFactory : public SafeBrowsingDatabaseFactory { 169 class TestSafeBrowsingDatabaseFactory : public SafeBrowsingDatabaseFactory {
164 public: 170 public:
165 TestSafeBrowsingDatabaseFactory() : db_(NULL) {} 171 TestSafeBrowsingDatabaseFactory() : db_(NULL) {}
166 virtual ~TestSafeBrowsingDatabaseFactory() {} 172 virtual ~TestSafeBrowsingDatabaseFactory() {}
167 173
168 virtual SafeBrowsingDatabase* CreateSafeBrowsingDatabase( 174 virtual SafeBrowsingDatabase* CreateSafeBrowsingDatabase(
169 bool enable_download_protection, 175 bool enable_download_protection,
170 bool enable_client_side_whitelist) { 176 bool enable_client_side_whitelist,
177 bool enable_download_whitelist) {
171 db_ = new TestSafeBrowsingDatabase(); 178 db_ = new TestSafeBrowsingDatabase();
172 return db_; 179 return db_;
173 } 180 }
174 TestSafeBrowsingDatabase* GetDb() { 181 TestSafeBrowsingDatabase* GetDb() {
175 return db_; 182 return db_;
176 } 183 }
177 private: 184 private:
178 // Owned by the SafebrowsingService. 185 // Owned by the SafebrowsingService.
179 TestSafeBrowsingDatabase* db_; 186 TestSafeBrowsingDatabase* db_;
180 }; 187 };
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 764
758 // Delete the Profile. SBS stops again. 765 // Delete the Profile. SBS stops again.
759 pref_service2 = NULL; 766 pref_service2 = NULL;
760 profile2.reset(); 767 profile2.reset();
761 WaitForIOThread(); 768 WaitForIOThread();
762 EXPECT_FALSE(sb_service->enabled()); 769 EXPECT_FALSE(sb_service->enabled());
763 EXPECT_FALSE(csd_service->enabled()); 770 EXPECT_FALSE(csd_service->enabled());
764 } 771 }
765 772
766 } // namespace 773 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_service.cc ('k') | chrome/browser/safe_browsing/safe_browsing_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698