| 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 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 <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 bool ContainsExtensionPrefixes(const std::vector<SBPrefix>& prefixes, | 153 bool ContainsExtensionPrefixes(const std::vector<SBPrefix>& prefixes, |
| 154 std::vector<SBPrefix>* prefix_hits) override { | 154 std::vector<SBPrefix>* prefix_hits) override { |
| 155 return true; | 155 return true; |
| 156 } | 156 } |
| 157 bool ContainsSideEffectFreeWhitelistUrl(const GURL& url) override { | 157 bool ContainsSideEffectFreeWhitelistUrl(const GURL& url) override { |
| 158 return true; | 158 return true; |
| 159 } | 159 } |
| 160 bool ContainsMalwareIP(const std::string& ip_address) override { | 160 bool ContainsMalwareIP(const std::string& ip_address) override { |
| 161 return true; | 161 return true; |
| 162 } | 162 } |
| 163 bool ContainsUnwantedSoftwareUrl( |
| 164 const GURL& url, |
| 165 std::vector<SBPrefix>* prefix_hits, |
| 166 std::vector<SBFullHashResult>* cache_hits) override { |
| 167 return true; |
| 168 } |
| 163 bool UpdateStarted(std::vector<SBListChunkRanges>* lists) override { | 169 bool UpdateStarted(std::vector<SBListChunkRanges>* lists) override { |
| 164 ADD_FAILURE() << "Not implemented."; | 170 ADD_FAILURE() << "Not implemented."; |
| 165 return false; | 171 return false; |
| 166 } | 172 } |
| 167 void InsertChunks(const std::string& list_name, | 173 void InsertChunks(const std::string& list_name, |
| 168 const std::vector<SBChunkData*>& chunks) override { | 174 const std::vector<SBChunkData*>& chunks) override { |
| 169 ADD_FAILURE() << "Not implemented."; | 175 ADD_FAILURE() << "Not implemented."; |
| 170 } | 176 } |
| 171 void DeleteChunks(const std::vector<SBChunkDelete>& chunk_deletes) override { | 177 void DeleteChunks(const std::vector<SBChunkDelete>& chunk_deletes) override { |
| 172 ADD_FAILURE() << "Not implemented."; | 178 ADD_FAILURE() << "Not implemented."; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 public: | 240 public: |
| 235 TestSafeBrowsingDatabaseFactory() : db_(NULL) {} | 241 TestSafeBrowsingDatabaseFactory() : db_(NULL) {} |
| 236 ~TestSafeBrowsingDatabaseFactory() override {} | 242 ~TestSafeBrowsingDatabaseFactory() override {} |
| 237 | 243 |
| 238 SafeBrowsingDatabase* CreateSafeBrowsingDatabase( | 244 SafeBrowsingDatabase* CreateSafeBrowsingDatabase( |
| 239 bool enable_download_protection, | 245 bool enable_download_protection, |
| 240 bool enable_client_side_whitelist, | 246 bool enable_client_side_whitelist, |
| 241 bool enable_download_whitelist, | 247 bool enable_download_whitelist, |
| 242 bool enable_extension_blacklist, | 248 bool enable_extension_blacklist, |
| 243 bool enable_side_effect_free_whitelist, | 249 bool enable_side_effect_free_whitelist, |
| 244 bool enable_ip_blacklist) override { | 250 bool enable_ip_blacklist, |
| 251 bool enabled_unwanted_software_list) override { |
| 245 db_ = new TestSafeBrowsingDatabase(); | 252 db_ = new TestSafeBrowsingDatabase(); |
| 246 return db_; | 253 return db_; |
| 247 } | 254 } |
| 248 TestSafeBrowsingDatabase* GetDb() { | 255 TestSafeBrowsingDatabase* GetDb() { |
| 249 return db_; | 256 return db_; |
| 250 } | 257 } |
| 251 private: | 258 private: |
| 252 // Owned by the SafebrowsingService. | 259 // Owned by the SafebrowsingService. |
| 253 TestSafeBrowsingDatabase* db_; | 260 TestSafeBrowsingDatabase* db_; |
| 254 }; | 261 }; |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 content::WindowedNotificationObserver observer( | 1096 content::WindowedNotificationObserver observer( |
| 1090 chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, | 1097 chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, |
| 1091 content::Source<SafeBrowsingDatabaseManager>( | 1098 content::Source<SafeBrowsingDatabaseManager>( |
| 1092 sb_service_->database_manager().get())); | 1099 sb_service_->database_manager().get())); |
| 1093 BrowserThread::PostTask( | 1100 BrowserThread::PostTask( |
| 1094 BrowserThread::IO, | 1101 BrowserThread::IO, |
| 1095 FROM_HERE, | 1102 FROM_HERE, |
| 1096 base::Bind(&SafeBrowsingDatabaseManagerCookieTest::ForceUpdate, this)); | 1103 base::Bind(&SafeBrowsingDatabaseManagerCookieTest::ForceUpdate, this)); |
| 1097 observer.Wait(); | 1104 observer.Wait(); |
| 1098 } | 1105 } |
| OLD | NEW |