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

Side by Side Diff: chrome/browser/extensions/test_blacklist_fetcher.h

Issue 49253005: Fetch extension blacklist states from SafeBrowsing server (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add unit tests, fix bugs. Created 7 years, 1 month 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
(Empty)
1 // Copyright 2013 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 CHROME_BROWSER_EXTENSIONS_TEST_BLACKLIST_FETCHER_H_
6 #define CHROME_BROWSER_EXTENSIONS_TEST_BLACKLIST_FETCHER_H_
7
8 #include <string>
9
10 #include "chrome/browser/extensions/blacklist_fetcher.h"
11 #include "chrome/common/safe_browsing/crx_info.pb.h"
12 #include "net/url_request/test_url_fetcher_factory.h"
13
14 namespace extensions {
15
16 // A wrapper for extensions::BlacklistFetcher, emulating server responses.
17 class TestBlacklistFetcher {
18 public:
19 explicit TestBlacklistFetcher(BlacklistFetcher* fetcher);
20
21 void SetBlacklistVerdict(const std::string& id,
22 ClientCRXListInfoResponse_Verdict state);
23
24 // Get URLFetcher by its id from factory, send the appropriate response.
25 // Return false, if fetcher with fiven id doesn't exist or in case of
26 // incorrect request. Otherwise return true.
27 bool HandleFetcher(int id);
28
29 private:
30 BlacklistFetcher* fetcher_;
31
32 std::map<std::string, ClientCRXListInfoResponse_Verdict> verdicts_;
33
34 net::TestURLFetcherFactory url_fetcher_factory_;
35
36 DISALLOW_COPY_AND_ASSIGN(TestBlacklistFetcher);
37 };
38
39 } // namespace extensions
40
41 #endif // CHROME_BROWSER_EXTENSIONS_TEST_BLACKLIST_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698