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

Side by Side Diff: components/subresource_filter/content/browser/fake_safe_browsing_database_manager.h

Issue 2820933002: [subresource_filter] add //chrome level unit test harness (Closed)
Patch Set: add a few #includes (trybots prev) Created 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_FAKE_SAFE_BROWSING_DATABAS E_MANAGER_H_
6 #define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_FAKE_SAFE_BROWSING_DATABAS E_MANAGER_H_
7
8 #include <map>
9 #include <set>
engedy 2017/04/20 12:34:33 nit: No need to include this in the header, it is
Charlie Harrison 2017/04/20 15:55:20 Done.
10
11 #include "base/macros.h"
12 #include "components/safe_browsing_db/hit_report.h"
engedy 2017/04/20 12:34:33 nit: Unused?
Charlie Harrison 2017/04/20 15:55:20 Used for safe_browsing::ThreatSource, but it isn't
13 #include "components/safe_browsing_db/test_database_manager.h"
14 #include "content/public/common/resource_type.h"
engedy 2017/04/20 12:34:33 nit: Unused?
Charlie Harrison 2017/04/20 15:55:20 Ditto, done.
15 #include "url/gurl.h"
engedy 2017/04/20 12:34:33 nit: Fwd-declaration below seems sufficient.
Charlie Harrison 2017/04/20 15:55:20 Done.
16
17 class GURL;
18
19 // Database manager that allows any URL to be configured as blacklisted for
20 // testing.
21 class FakeSafeBrowsingDatabaseManager
22 : public safe_browsing::TestSafeBrowsingDatabaseManager {
23 public:
24 FakeSafeBrowsingDatabaseManager();
25
26 void AddBlacklistedUrl(const GURL& url,
27 safe_browsing::SBThreatType threat_type);
28
29 void SimulateTimeout();
30
31 protected:
32 ~FakeSafeBrowsingDatabaseManager() override;
33
34 // safe_browsing::TestSafeBrowsingDatabaseManager:
35 bool CheckUrlForSubresourceFilter(const GURL& url, Client* client) override;
36 bool CheckResourceUrl(const GURL& url, Client* client) override;
37 bool IsSupported() const override;
38 void CancelCheck(Client* client) override;
39 bool ChecksAreAlwaysAsync() const override;
40 bool CanCheckResourceType(
41 content::ResourceType /* resource_type */) const override;
42 safe_browsing::ThreatSource GetThreatSource() const override;
43 bool CheckExtensionIDs(const std::set<std::string>& extension_ids,
44 Client* client) override;
45
46 private:
47 std::map<GURL, safe_browsing::SBThreatType> url_to_threat_type_;
48 bool simulate_timeout_;
49
50 DISALLOW_COPY_AND_ASSIGN(FakeSafeBrowsingDatabaseManager);
51 };
52
53 #endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_FAKE_SAFE_BROWSING_DATA BASE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698