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

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

Issue 7846007: net: Rename URLRequestStatus::os_error_. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix os_error_code Created 9 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 | Annotate | Revision Log
« no previous file with comments | « net/url_request/url_request_test_util.h ('k') | net/url_request/url_request_unittest.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 else if (cancel_in_rd_pending_) 296 else if (cancel_in_rd_pending_)
297 request->Cancel(); 297 request->Cancel();
298 } 298 }
299 299
300 void TestDelegate::OnResponseCompleted(net::URLRequest* request) { 300 void TestDelegate::OnResponseCompleted(net::URLRequest* request) {
301 if (quit_on_complete_) 301 if (quit_on_complete_)
302 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); 302 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
303 } 303 }
304 304
305 TestNetworkDelegate::TestNetworkDelegate() 305 TestNetworkDelegate::TestNetworkDelegate()
306 : last_os_error_(0), 306 : last_error_(0),
307 error_count_(0), 307 error_count_(0),
308 created_requests_(0), 308 created_requests_(0),
309 destroyed_requests_(0), 309 destroyed_requests_(0),
310 completed_requests_(0) { 310 completed_requests_(0) {
311 } 311 }
312 312
313 TestNetworkDelegate::~TestNetworkDelegate() { 313 TestNetworkDelegate::~TestNetworkDelegate() {
314 for (std::map<int, int>::iterator i = next_states_.begin(); 314 for (std::map<int, int>::iterator i = next_states_.begin();
315 i != next_states_.end(); ++i) { 315 i != next_states_.end(); ++i) {
316 event_order_[i->first] += "~TestNetworkDelegate\n"; 316 event_order_[i->first] += "~TestNetworkDelegate\n";
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 398
399 void TestNetworkDelegate::OnResponseStarted(net::URLRequest* request) { 399 void TestNetworkDelegate::OnResponseStarted(net::URLRequest* request) {
400 int req_id = request->identifier(); 400 int req_id = request->identifier();
401 event_order_[req_id] += "OnResponseStarted\n"; 401 event_order_[req_id] += "OnResponseStarted\n";
402 InitRequestStatesIfNew(req_id); 402 InitRequestStatesIfNew(req_id);
403 EXPECT_TRUE(next_states_[req_id] & kStageResponseStarted) << 403 EXPECT_TRUE(next_states_[req_id] & kStageResponseStarted) <<
404 event_order_[req_id]; 404 event_order_[req_id];
405 next_states_[req_id] = kStageCompletedSuccess | kStageCompletedError; 405 next_states_[req_id] = kStageCompletedSuccess | kStageCompletedError;
406 if (request->status().status() == net::URLRequestStatus::FAILED) { 406 if (request->status().status() == net::URLRequestStatus::FAILED) {
407 error_count_++; 407 error_count_++;
408 last_os_error_ = request->status().os_error(); 408 last_error_ = request->status().error();
409 } 409 }
410 } 410 }
411 411
412 void TestNetworkDelegate::OnRawBytesRead(const net::URLRequest& request, 412 void TestNetworkDelegate::OnRawBytesRead(const net::URLRequest& request,
413 int bytes_read) { 413 int bytes_read) {
414 } 414 }
415 415
416 void TestNetworkDelegate::OnCompleted(net::URLRequest* request) { 416 void TestNetworkDelegate::OnCompleted(net::URLRequest* request) {
417 int req_id = request->identifier(); 417 int req_id = request->identifier();
418 event_order_[req_id] += "OnCompleted\n"; 418 event_order_[req_id] += "OnCompleted\n";
419 InitRequestStatesIfNew(req_id); 419 InitRequestStatesIfNew(req_id);
420 // Expect "Success -> (next_states_ & kStageCompletedSuccess)" 420 // Expect "Success -> (next_states_ & kStageCompletedSuccess)"
421 // is logically identical to 421 // is logically identical to
422 // Expect "!(Success) || (next_states_ & kStageCompletedSuccess)" 422 // Expect "!(Success) || (next_states_ & kStageCompletedSuccess)"
423 EXPECT_TRUE(!request->status().is_success() || 423 EXPECT_TRUE(!request->status().is_success() ||
424 (next_states_[req_id] & kStageCompletedSuccess)) << 424 (next_states_[req_id] & kStageCompletedSuccess)) <<
425 event_order_[req_id]; 425 event_order_[req_id];
426 EXPECT_TRUE(request->status().is_success() || 426 EXPECT_TRUE(request->status().is_success() ||
427 (next_states_[req_id] & kStageCompletedError)) << 427 (next_states_[req_id] & kStageCompletedError)) <<
428 event_order_[req_id]; 428 event_order_[req_id];
429 next_states_[req_id] = kStageURLRequestDestroyed; 429 next_states_[req_id] = kStageURLRequestDestroyed;
430 completed_requests_++; 430 completed_requests_++;
431 if (request->status().status() == net::URLRequestStatus::FAILED) { 431 if (request->status().status() == net::URLRequestStatus::FAILED) {
432 error_count_++; 432 error_count_++;
433 last_os_error_ = request->status().os_error(); 433 last_error_ = request->status().error();
434 } 434 }
435 } 435 }
436 436
437 void TestNetworkDelegate::OnURLRequestDestroyed( 437 void TestNetworkDelegate::OnURLRequestDestroyed(
438 net::URLRequest* request) { 438 net::URLRequest* request) {
439 int req_id = request->identifier(); 439 int req_id = request->identifier();
440 event_order_[req_id] += "OnURLRequestDestroyed\n"; 440 event_order_[req_id] += "OnURLRequestDestroyed\n";
441 InitRequestStatesIfNew(req_id); 441 InitRequestStatesIfNew(req_id);
442 EXPECT_TRUE(next_states_[req_id] & kStageURLRequestDestroyed) << 442 EXPECT_TRUE(next_states_[req_id] & kStageURLRequestDestroyed) <<
443 event_order_[req_id]; 443 event_order_[req_id];
(...skipping 10 matching lines...) Expand all
454 } 454 }
455 455
456 void TestNetworkDelegate::OnPACScriptError(int line_number, 456 void TestNetworkDelegate::OnPACScriptError(int line_number,
457 const string16& error) { 457 const string16& error) {
458 } 458 }
459 459
460 void TestNetworkDelegate::OnAuthRequired( 460 void TestNetworkDelegate::OnAuthRequired(
461 net::URLRequest* reqest, 461 net::URLRequest* reqest,
462 const net::AuthChallengeInfo& auth_info) { 462 const net::AuthChallengeInfo& auth_info) {
463 } 463 }
OLDNEW
« no previous file with comments | « net/url_request/url_request_test_util.h ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698