Probably broke Win7 Tests (dbg)(6). http://build.chromium.org/p/chromium.win/builders...
[chromium-blink-merge.git] / net / proxy / mock_proxy_script_fetcher.h
blob81e221f0a9b21a1ca6c518674ffa99cf7cdf5905
1 // Copyright (c) 2012 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 NET_PROXY_MOCK_PROXY_SCRIPT_FETCHER_H_
6 #define NET_PROXY_MOCK_PROXY_SCRIPT_FETCHER_H_
8 #include "base/compiler_specific.h"
9 #include "net/proxy/proxy_script_fetcher.h"
10 #include "url/gurl.h"
12 #include <string>
14 namespace net {
16 class URLRequestContext;
18 // A mock ProxyScriptFetcher. No result will be returned to the fetch client
19 // until we call NotifyFetchCompletion() to set the results.
20 class MockProxyScriptFetcher : public ProxyScriptFetcher {
21 public:
22 MockProxyScriptFetcher();
23 virtual ~MockProxyScriptFetcher();
25 // ProxyScriptFetcher implementation.
26 virtual int Fetch(const GURL& url,
27 base::string16* text,
28 const CompletionCallback& callback) OVERRIDE;
29 virtual void Cancel() OVERRIDE;
30 virtual URLRequestContext* GetRequestContext() const OVERRIDE;
32 void NotifyFetchCompletion(int result, const std::string& ascii_text);
33 const GURL& pending_request_url() const;
34 bool has_pending_request() const;
36 // Spins the message loop until this->Fetch() is invoked.
37 void WaitUntilFetch();
39 private:
40 GURL pending_request_url_;
41 CompletionCallback pending_request_callback_;
42 base::string16* pending_request_text_;
43 bool waiting_for_fetch_;
46 } // namespace net
48 #endif // NET_PROXY_MOCK_PROXY_SCRIPT_FETCHER_H_