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

Side by Side Diff: net/url_request/url_request_test_util.h

Issue 10919317: Move TestJobInterceptor to url_request_test_util. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix typo Created 8 years, 3 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
« no previous file with comments | « no previous file | net/url_request/url_request_test_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ 5 #ifndef NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_
6 #define NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ 6 #define NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_
7 7
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 19 matching lines...) Expand all
30 #include "net/disk_cache/disk_cache.h" 30 #include "net/disk_cache/disk_cache.h"
31 #include "net/ftp/ftp_network_layer.h" 31 #include "net/ftp/ftp_network_layer.h"
32 #include "net/http/http_auth_handler_factory.h" 32 #include "net/http/http_auth_handler_factory.h"
33 #include "net/http/http_cache.h" 33 #include "net/http/http_cache.h"
34 #include "net/http/http_network_layer.h" 34 #include "net/http/http_network_layer.h"
35 #include "net/proxy/proxy_service.h" 35 #include "net/proxy/proxy_service.h"
36 #include "net/url_request/url_request.h" 36 #include "net/url_request/url_request.h"
37 #include "net/url_request/url_request_context.h" 37 #include "net/url_request/url_request_context.h"
38 #include "net/url_request/url_request_context_getter.h" 38 #include "net/url_request/url_request_context_getter.h"
39 #include "net/url_request/url_request_context_storage.h" 39 #include "net/url_request/url_request_context_storage.h"
40 #include "net/url_request/url_request_job_factory.h"
40 41
41 using base::TimeDelta; 42 using base::TimeDelta;
42 43
43 //----------------------------------------------------------------------------- 44 //-----------------------------------------------------------------------------
44 45
45 class TestURLRequestContext : public net::URLRequestContext { 46 class TestURLRequestContext : public net::URLRequestContext {
46 public: 47 public:
47 TestURLRequestContext(); 48 TestURLRequestContext();
48 // Default constructor like TestURLRequestContext() but does not call 49 // Default constructor like TestURLRequestContext() but does not call
49 // Init() in case |delay_initialization| is true. This allows modifying the 50 // Init() in case |delay_initialization| is true. This allows modifying the
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 static const std::string& value(); 290 static const std::string& value();
290 291
291 private: 292 private:
292 static std::string value_; 293 static std::string value_;
293 const std::string old_value_; 294 const std::string old_value_;
294 const std::string new_value_; 295 const std::string new_value_;
295 296
296 DISALLOW_COPY_AND_ASSIGN(ScopedCustomUrlRequestTestHttpHost); 297 DISALLOW_COPY_AND_ASSIGN(ScopedCustomUrlRequestTestHttpHost);
297 }; 298 };
298 299
300 //-----------------------------------------------------------------------------
301
302 // A simple Interceptor that returns a pre-built URLRequestJob one time.
wtc 2012/09/17 22:52:03 Nit: this comment is a little hard to understand.
303 class TestJobInterceptor : public net::URLRequestJobFactory::Interceptor {
304 public:
305 TestJobInterceptor();
306
307 virtual net::URLRequestJob* MaybeIntercept(
308 net::URLRequest* request,
309 net::NetworkDelegate* network_delegate) const OVERRIDE;
310 virtual net::URLRequestJob* MaybeInterceptRedirect(
311 const GURL& location,
312 net::URLRequest* request,
313 net::NetworkDelegate* network_delegate) const OVERRIDE;
314 virtual net::URLRequestJob* MaybeInterceptResponse(
315 net::URLRequest* request,
316 net::NetworkDelegate* network_delegate) const OVERRIDE;
317 void set_main_intercept_job(net::URLRequestJob* job);
318
319 private:
320 mutable net::URLRequestJob* main_intercept_job_;
321 };
322
299 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ 323 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | net/url_request/url_request_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698