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

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

Issue 10559036: Added URLRequestContext to constructor for URLRequest. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Merged with latest version Created 8 years, 6 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 #include "net/url_request/url_request_test_util.h" 5 #include "net/url_request/url_request_test_util.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 base::WorkerPool::GetTaskRunner(true))); 105 base::WorkerPool::GetTaskRunner(true)));
106 } 106 }
107 if (accept_language().empty()) 107 if (accept_language().empty())
108 set_accept_language("en-us,fr"); 108 set_accept_language("en-us,fr");
109 if (accept_charset().empty()) 109 if (accept_charset().empty())
110 set_accept_charset("iso-8859-1,*,utf-8"); 110 set_accept_charset("iso-8859-1,*,utf-8");
111 if (!job_factory()) 111 if (!job_factory())
112 context_storage_.set_job_factory(new net::URLRequestJobFactory); 112 context_storage_.set_job_factory(new net::URLRequestJobFactory);
113 } 113 }
114 114
115 TestURLRequest::TestURLRequest(const GURL& url, Delegate* delegate) 115 TestURLRequest::TestURLRequest(const GURL& url,
116 : net::URLRequest(url, delegate), 116 Delegate* delegate,
117 context_(new TestURLRequestContext) { 117 TestURLRequestContext* context)
118 set_context(context_.get()); 118 : net::URLRequest(url, delegate, context) {
119 } 119 }
120 120
121 TestURLRequest::~TestURLRequest() { 121 TestURLRequest::~TestURLRequest() {
122 set_context(NULL);
123 } 122 }
124 123
125 TestURLRequestContextGetter::TestURLRequestContextGetter( 124 TestURLRequestContextGetter::TestURLRequestContextGetter(
126 const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner) 125 const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner)
127 : network_task_runner_(network_task_runner) { 126 : network_task_runner_(network_task_runner) {
128 DCHECK(network_task_runner_); 127 DCHECK(network_task_runner_);
129 } 128 }
130 129
131 TestURLRequestContextGetter::TestURLRequestContextGetter( 130 TestURLRequestContextGetter::TestURLRequestContextGetter(
132 const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner, 131 const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner,
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 515
517 ScopedCustomUrlRequestTestHttpHost::~ScopedCustomUrlRequestTestHttpHost() { 516 ScopedCustomUrlRequestTestHttpHost::~ScopedCustomUrlRequestTestHttpHost() {
518 DCHECK_EQ(value_, new_value_); 517 DCHECK_EQ(value_, new_value_);
519 value_ = old_value_; 518 value_ = old_value_;
520 } 519 }
521 520
522 // static 521 // static
523 const std::string& ScopedCustomUrlRequestTestHttpHost::value() { 522 const std::string& ScopedCustomUrlRequestTestHttpHost::value() {
524 return value_; 523 return value_;
525 } 524 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698