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

Side by Side Diff: net/test/spawner_communicator.cc

Issue 10873056: Added URLRequestContext::CreateRequest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed android bug Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « net/proxy/proxy_script_fetcher_impl.cc ('k') | net/url_request/url_fetcher_core.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 #include "net/test/spawner_communicator.h" 5 #include "net/test/spawner_communicator.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/supports_user_data.h" 10 #include "base/supports_user_data.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 const std::string& post_data, 162 const std::string& post_data,
163 int* result_code, 163 int* result_code,
164 std::string* data_received) { 164 std::string* data_received) {
165 MessageLoop* loop = io_thread_.message_loop(); 165 MessageLoop* loop = io_thread_.message_loop();
166 DCHECK(loop); 166 DCHECK(loop);
167 DCHECK_EQ(MessageLoop::current(), loop); 167 DCHECK_EQ(MessageLoop::current(), loop);
168 168
169 // Prepare the URLRequest for sending the command. 169 // Prepare the URLRequest for sending the command.
170 DCHECK(!cur_request_.get()); 170 DCHECK(!cur_request_.get());
171 context_.reset(new TestURLRequestContext); 171 context_.reset(new TestURLRequestContext);
172 cur_request_.reset(new URLRequest(GenerateSpawnerCommandURL(command, port_), 172 cur_request_.reset(context_->CreateRequest(
173 this, 173 GenerateSpawnerCommandURL(command, port_), this));
174 context_.get()));
175 DCHECK(cur_request_.get()); 174 DCHECK(cur_request_.get());
176 int current_request_id = ++next_id_; 175 int current_request_id = ++next_id_;
177 SpawnerRequestData* data = new SpawnerRequestData(current_request_id, 176 SpawnerRequestData* data = new SpawnerRequestData(current_request_id,
178 result_code, 177 result_code,
179 data_received); 178 data_received);
180 DCHECK(data); 179 DCHECK(data);
181 cur_request_->SetUserData(this, data); 180 cur_request_->SetUserData(this, data);
182 181
183 if (post_data.empty()) { 182 if (post_data.empty()) {
184 cur_request_->set_method("GET"); 183 cur_request_->set_method("GET");
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 std::string server_return_data; 363 std::string server_return_data;
365 int result_code; 364 int result_code;
366 SendCommandAndWaitForResult("kill", "", &result_code, &server_return_data); 365 SendCommandAndWaitForResult("kill", "", &result_code, &server_return_data);
367 Shutdown(); 366 Shutdown();
368 if (OK != result_code || server_return_data != "killed") 367 if (OK != result_code || server_return_data != "killed")
369 return false; 368 return false;
370 return true; 369 return true;
371 } 370 }
372 371
373 } // namespace net 372 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_script_fetcher_impl.cc ('k') | net/url_request/url_fetcher_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698