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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc

Issue 1110723002: Split to SafeBrowsingDatabaseManager into Local* and Remote*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to review. Tweak comments and list initializer. Created 5 years, 7 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/safe_browsing_blocking_page_test.cc
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
index 280196647a4b252ee2c1be5d85eedc6ba8cc026e..03e229e0dc40101992d95d1a0c974f520971fb1f 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
@@ -16,10 +16,12 @@
#include "chrome/browser/interstitials/security_interstitial_page_test_utils.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/database_manager.h"
+#include "chrome/browser/safe_browsing/local_database_manager.h"
#include "chrome/browser/safe_browsing/malware_details.h"
#include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/safe_browsing/safe_browsing_util.h"
+#include "chrome/browser/safe_browsing/test_database_manager.h"
#include "chrome/browser/safe_browsing/ui_manager.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_tabstrip.h"
@@ -55,10 +57,9 @@ const char kMalwareIframe[] = "files/safe_browsing/malware_iframe.html";
// A SafeBrowsingDatabaseManager class that allows us to inject the malicious
// URLs.
-class FakeSafeBrowsingDatabaseManager : public SafeBrowsingDatabaseManager {
+class FakeSafeBrowsingDatabaseManager : public TestSafeBrowsingDatabaseManager {
public:
- explicit FakeSafeBrowsingDatabaseManager(SafeBrowsingService* service)
- : SafeBrowsingDatabaseManager(service) { }
+ FakeSafeBrowsingDatabaseManager() {}
// Called on the IO thread to check if the given url is safe or not. If we
// can synchronously determine that the url is safe, CheckUrl returns true.
@@ -78,23 +79,31 @@ class FakeSafeBrowsingDatabaseManager : public SafeBrowsingDatabaseManager {
void OnCheckBrowseURLDone(const GURL& gurl, Client* client) {
std::vector<SBThreatType> expected_threats;
+ // TODO(nparker): Remove ref to LocalSafeBrowsingDatabase by calling
+ // client->OnCheckBrowseUrlResult(..) directly.
expected_threats.push_back(SB_THREAT_TYPE_URL_MALWARE);
expected_threats.push_back(SB_THREAT_TYPE_URL_PHISHING);
expected_threats.push_back(SB_THREAT_TYPE_URL_UNWANTED);
- SafeBrowsingDatabaseManager::SafeBrowsingCheck sb_check(
+ LocalSafeBrowsingDatabaseManager::SafeBrowsingCheck sb_check(
std::vector<GURL>(1, gurl),
std::vector<SBFullHash>(),
client,
safe_browsing_util::MALWARE,
expected_threats);
sb_check.url_results[0] = badurls[gurl.spec()];
- client->OnSafeBrowsingResult(sb_check);
+ sb_check.OnSafeBrowsingResult();
}
void SetURLThreatType(const GURL& url, SBThreatType threat_type) {
badurls[url.spec()] = threat_type;
}
+ // Called during startup, so must not check-fail.
+ bool CheckExtensionIDs(const std::set<std::string>& extension_ids,
+ Client* client) override {
+ return true;
+ }
+
private:
~FakeSafeBrowsingDatabaseManager() override {}
@@ -172,7 +181,7 @@ class FakeSafeBrowsingService : public SafeBrowsingService {
~FakeSafeBrowsingService() override {}
SafeBrowsingDatabaseManager* CreateDatabaseManager() override {
- fake_database_manager_ = new FakeSafeBrowsingDatabaseManager(this);
+ fake_database_manager_ = new FakeSafeBrowsingDatabaseManager();
return fake_database_manager_;
}
@@ -181,6 +190,11 @@ class FakeSafeBrowsingService : public SafeBrowsingService {
return fake_ui_manager_;
}
+ SafeBrowsingProtocolManagerDelegate* GetProtocolManagerDelegate() override {
+ // Our SafeBrowsingDatabaseManager doesn't implement this delegate.
+ return NULL;
+ }
+
private:
FakeSafeBrowsingDatabaseManager* fake_database_manager_;
FakeSafeBrowsingUIManager* fake_ui_manager_;

Powered by Google App Engine
This is Rietveld 408576698