Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / extensions / test_blacklist_state_fetcher.h
blob373a842cb841061c1c83e1322f7865b7ff4cdada
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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_TEST_BLACKLIST_STATE_FETCHER_H_
6 #define CHROME_BROWSER_EXTENSIONS_TEST_BLACKLIST_STATE_FETCHER_H_
8 #include <string>
10 #include "chrome/browser/extensions/blacklist_state_fetcher.h"
11 #include "chrome/common/safe_browsing/crx_info.pb.h"
12 #include "net/url_request/test_url_fetcher_factory.h"
14 namespace extensions {
16 // A wrapper for extensions::BlacklistStateFetcher, emulating server responses.
17 class TestBlacklistStateFetcher {
18 public:
19 explicit TestBlacklistStateFetcher(BlacklistStateFetcher* fetcher);
21 ~TestBlacklistStateFetcher();
23 void SetBlacklistVerdict(const std::string& id,
24 ClientCRXListInfoResponse_Verdict state);
26 // Get URLFetcher by its id from factory, send the appropriate response.
27 // Return false, if fetcher with fiven id doesn't exist or in case of
28 // incorrect request. Otherwise return true.
29 bool HandleFetcher(int id);
31 private:
32 BlacklistStateFetcher* fetcher_;
34 std::map<std::string, ClientCRXListInfoResponse_Verdict> verdicts_;
36 net::TestURLFetcherFactory url_fetcher_factory_;
38 DISALLOW_COPY_AND_ASSIGN(TestBlacklistStateFetcher);
41 } // namespace extensions
43 #endif // CHROME_BROWSER_EXTENSIONS_TEST_BLACKLIST_STATE_FETCHER_H_