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

Side by Side Diff: net/proxy/mock_proxy_script_fetcher.h

Issue 2845643003: Allow ProxyService to share URLRequestContext with everything else. (Closed)
Patch Set: Fix fetcher shutdown with no active request, add test, add comment Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_PROXY_MOCK_PROXY_SCRIPT_FETCHER_H_ 5 #ifndef NET_PROXY_MOCK_PROXY_SCRIPT_FETCHER_H_
6 #define NET_PROXY_MOCK_PROXY_SCRIPT_FETCHER_H_ 6 #define NET_PROXY_MOCK_PROXY_SCRIPT_FETCHER_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "net/proxy/proxy_script_fetcher.h" 9 #include "net/proxy/proxy_script_fetcher.h"
10 #include "url/gurl.h" 10 #include "url/gurl.h"
11 11
12 #include <string> 12 #include <string>
13 13
14 namespace net { 14 namespace net {
15 15
16 class URLRequestContext; 16 class URLRequestContext;
17 17
18 // A mock ProxyScriptFetcher. No result will be returned to the fetch client 18 // A mock ProxyScriptFetcher. No result will be returned to the fetch client
19 // until we call NotifyFetchCompletion() to set the results. 19 // until we call NotifyFetchCompletion() to set the results.
20 class MockProxyScriptFetcher : public ProxyScriptFetcher { 20 class MockProxyScriptFetcher : public ProxyScriptFetcher {
21 public: 21 public:
22 MockProxyScriptFetcher(); 22 MockProxyScriptFetcher();
23 ~MockProxyScriptFetcher() override; 23 ~MockProxyScriptFetcher() override;
24 24
25 // ProxyScriptFetcher implementation. 25 // ProxyScriptFetcher implementation.
26 int Fetch(const GURL& url, 26 int Fetch(const GURL& url,
27 base::string16* text, 27 base::string16* text,
28 const CompletionCallback& callback) override; 28 const CompletionCallback& callback) override;
29 void Cancel() override; 29 void Cancel() override;
30 void OnShutdown() override;
30 URLRequestContext* GetRequestContext() const override; 31 URLRequestContext* GetRequestContext() const override;
31 32
32 void NotifyFetchCompletion(int result, const std::string& ascii_text); 33 void NotifyFetchCompletion(int result, const std::string& ascii_text);
33 const GURL& pending_request_url() const; 34 const GURL& pending_request_url() const;
34 bool has_pending_request() const; 35 bool has_pending_request() const;
35 36
36 // Spins the message loop until this->Fetch() is invoked. 37 // Spins the message loop until this->Fetch() is invoked.
37 void WaitUntilFetch(); 38 void WaitUntilFetch();
38 39
39 private: 40 private:
40 GURL pending_request_url_; 41 GURL pending_request_url_;
41 CompletionCallback pending_request_callback_; 42 CompletionCallback pending_request_callback_;
42 base::string16* pending_request_text_; 43 base::string16* pending_request_text_;
43 bool waiting_for_fetch_; 44 bool waiting_for_fetch_;
45 bool is_shutdown_;
44 }; 46 };
45 47
46 } // namespace net 48 } // namespace net
47 49
48 #endif // NET_PROXY_MOCK_PROXY_SCRIPT_FETCHER_H_ 50 #endif // NET_PROXY_MOCK_PROXY_SCRIPT_FETCHER_H_
OLDNEW
« no previous file with comments | « net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc ('k') | net/proxy/mock_proxy_script_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698