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

Unified Diff: chrome/browser/safe_browsing/test_database_manager.h

Issue 1110723002: Split to SafeBrowsingDatabaseManager into Local* and Remote*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: extend test db manager to fix browser tests Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/test_database_manager.h
diff --git a/chrome/browser/safe_browsing/test_database_manager.h b/chrome/browser/safe_browsing/test_database_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..9905fe7318d685f9fc3c17890b5df0b98d70f186
--- /dev/null
+++ b/chrome/browser/safe_browsing/test_database_manager.h
@@ -0,0 +1,56 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_SAFE_BROWSING_TEST_DATABASE_MANAGER_H_
+#define CHROME_BROWSER_SAFE_BROWSING_TEST_DATABASE_MANAGER_H_
+
+#include <set>
+#include <string>
+#include <vector>
+
+#include "chrome/browser/safe_browsing/database_manager.h"
+#include "chrome/browser/safe_browsing/protocol_manager.h"
+
+// This is a non-pure-virtual implementation of the SafeBrowsingDatabaseManager
+// interface. It's used in tests by overriding only the functions that get
+// called, and it'll complain if you call one that isn't overriden.
+class TestSafeBrowsingDatabaseManager
+ : public SafeBrowsingDatabaseManager,
+ public SafeBrowsingProtocolManagerDelegate {
mattm 2015/05/06 02:42:46 Doesn't that make this sort of a TestLocalSafeBrow
Nathan Parker 2015/05/06 22:27:36 I've removed this since SafeBrowsingService now ha
+ public:
+ // SafeBrowsingDatabaseManager implementation:
+ bool CanCheckUrl(const GURL& url) const override;
+ bool download_protection_enabled() const override;
+ bool CheckBrowseUrl(const GURL& url, Client* client) override;
+ bool CheckDownloadUrl(const std::vector<GURL>& url_chain,
+ Client* client) override;
+ bool CheckExtensionIDs(const std::set<std::string>& extension_ids,
+ Client* client) override;
+ bool MatchCsdWhitelistUrl(const GURL& url) override;
+ bool MatchMalwareIP(const std::string& ip_address) override;
+ bool MatchDownloadWhitelistUrl(const GURL& url) override;
+ bool MatchDownloadWhitelistString(const std::string& str) override;
+ bool MatchInclusionWhitelistUrl(const GURL& url) override;
+ bool IsMalwareKillSwitchOn() override;
+ bool IsCsdWhitelistKillSwitchOn() override;
+ void CancelCheck(Client* client) override;
+ void StartOnIOThread() override;
+ void StopOnIOThread(bool shutdown) override;
+ SafeBrowsingProtocolManagerDelegate* GetProtocolManagerDelegate() override;
+
+ // SafeBrowsingProtocolManagerDelegate implementation:
+ void UpdateFinished(bool success) override;
+ void ResetDatabase() override;
+ void GetChunks(GetChunksCallback callback) override;
+ void AddChunks(const std::string& list,
+ scoped_ptr<ScopedVector<SBChunkData>> chunks,
+ AddChunksCallback callback) override;
+ void DeleteChunks(
+ scoped_ptr<std::vector<SBChunkDelete>> chunk_deletes) override;
+ void UpdateStarted() override;
+
+ protected:
+ ~TestSafeBrowsingDatabaseManager() override {};
+};
+#endif // CHROME_BROWSER_SAFE_BROWSING_TEST_DATABASE_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698