OLD | NEW |
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/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 event_order_[req_id] += "OnResponseStarted\n"; | 499 event_order_[req_id] += "OnResponseStarted\n"; |
500 EXPECT_TRUE(next_states_[req_id] & kStageResponseStarted) << | 500 EXPECT_TRUE(next_states_[req_id] & kStageResponseStarted) << |
501 event_order_[req_id]; | 501 event_order_[req_id]; |
502 next_states_[req_id] = kStageCompletedSuccess | kStageCompletedError; | 502 next_states_[req_id] = kStageCompletedSuccess | kStageCompletedError; |
503 if (request->status().status() == URLRequestStatus::FAILED) { | 503 if (request->status().status() == URLRequestStatus::FAILED) { |
504 error_count_++; | 504 error_count_++; |
505 last_error_ = request->status().error(); | 505 last_error_ = request->status().error(); |
506 } | 506 } |
507 } | 507 } |
508 | 508 |
509 void TestNetworkDelegate::OnNetworkBytesReceived(const URLRequest& request, | 509 void TestNetworkDelegate::OnNetworkBytesReceived(URLRequest* request, |
510 int64_t bytes_received) { | 510 int64_t bytes_received) { |
511 event_order_[request.identifier()] += "OnNetworkBytesReceived\n"; | 511 event_order_[request->identifier()] += "OnNetworkBytesReceived\n"; |
512 total_network_bytes_received_ += bytes_received; | 512 total_network_bytes_received_ += bytes_received; |
513 } | 513 } |
514 | 514 |
515 void TestNetworkDelegate::OnNetworkBytesSent(const URLRequest& request, | 515 void TestNetworkDelegate::OnNetworkBytesSent(URLRequest* request, |
516 int64_t bytes_sent) { | 516 int64_t bytes_sent) { |
517 event_order_[request.identifier()] += "OnNetworkBytesSent\n"; | 517 event_order_[request->identifier()] += "OnNetworkBytesSent\n"; |
518 total_network_bytes_sent_ += bytes_sent; | 518 total_network_bytes_sent_ += bytes_sent; |
519 } | 519 } |
520 | 520 |
521 void TestNetworkDelegate::OnCompleted(URLRequest* request, bool started) { | 521 void TestNetworkDelegate::OnCompleted(URLRequest* request, bool started) { |
522 int req_id = request->identifier(); | 522 int req_id = request->identifier(); |
523 InitRequestStatesIfNew(req_id); | 523 InitRequestStatesIfNew(req_id); |
524 event_order_[req_id] += "OnCompleted\n"; | 524 event_order_[req_id] += "OnCompleted\n"; |
525 // Expect "Success -> (next_states_ & kStageCompletedSuccess)" | 525 // Expect "Success -> (next_states_ & kStageCompletedSuccess)" |
526 // is logically identical to | 526 // is logically identical to |
527 // Expect "!(Success) || (next_states_ & kStageCompletedSuccess)" | 527 // Expect "!(Success) || (next_states_ & kStageCompletedSuccess)" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 URLRequestJob* job = main_intercept_job_; | 637 URLRequestJob* job = main_intercept_job_; |
638 main_intercept_job_ = NULL; | 638 main_intercept_job_ = NULL; |
639 return job; | 639 return job; |
640 } | 640 } |
641 | 641 |
642 void TestJobInterceptor::set_main_intercept_job(URLRequestJob* job) { | 642 void TestJobInterceptor::set_main_intercept_job(URLRequestJob* job) { |
643 main_intercept_job_ = job; | 643 main_intercept_job_ = job; |
644 } | 644 } |
645 | 645 |
646 } // namespace net | 646 } // namespace net |
OLD | NEW |