| 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 "content/child/resource_dispatcher.h" | 5 #include "content/child/resource_dispatcher.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 return; | 89 return; |
| 90 EXPECT_TRUE(context_->received_response); | 90 EXPECT_TRUE(context_->received_response); |
| 91 EXPECT_FALSE(context_->complete); | 91 EXPECT_FALSE(context_->complete); |
| 92 context_->data.append(data->payload(), data->length()); | 92 context_->data.append(data->payload(), data->length()); |
| 93 context_->total_encoded_data_length += data->encoded_data_length(); | 93 context_->total_encoded_data_length += data->encoded_data_length(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void OnCompletedRequest(int error_code, | 96 void OnCompletedRequest(int error_code, |
| 97 bool was_ignored_by_handler, | 97 bool was_ignored_by_handler, |
| 98 bool stale_copy_in_cache, | 98 bool stale_copy_in_cache, |
| 99 const std::string& security_info, | |
| 100 const base::TimeTicks& completion_time, | 99 const base::TimeTicks& completion_time, |
| 101 int64_t total_transfer_size) override { | 100 int64_t total_transfer_size) override { |
| 102 if (context_->cancelled) | 101 if (context_->cancelled) |
| 103 return; | 102 return; |
| 104 EXPECT_TRUE(context_->received_response); | 103 EXPECT_TRUE(context_->received_response); |
| 105 EXPECT_FALSE(context_->complete); | 104 EXPECT_FALSE(context_->complete); |
| 106 context_->complete = true; | 105 context_->complete = true; |
| 107 } | 106 } |
| 108 | 107 |
| 109 struct Context { | 108 struct Context { |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 | 539 |
| 541 void OnDownloadedData(int len, int encoded_data_length) override {} | 540 void OnDownloadedData(int len, int encoded_data_length) override {} |
| 542 | 541 |
| 543 void OnReceivedData(std::unique_ptr<ReceivedData> data) override { | 542 void OnReceivedData(std::unique_ptr<ReceivedData> data) override { |
| 544 data_.append(data->payload(), data->length()); | 543 data_.append(data->payload(), data->length()); |
| 545 } | 544 } |
| 546 | 545 |
| 547 void OnCompletedRequest(int error_code, | 546 void OnCompletedRequest(int error_code, |
| 548 bool was_ignored_by_handler, | 547 bool was_ignored_by_handler, |
| 549 bool stale_copy_in_cache, | 548 bool stale_copy_in_cache, |
| 550 const std::string& security_info, | |
| 551 const base::TimeTicks& completion_time, | 549 const base::TimeTicks& completion_time, |
| 552 int64_t total_transfer_size) override { | 550 int64_t total_transfer_size) override { |
| 553 original_peer_->OnReceivedResponse(response_info_); | 551 original_peer_->OnReceivedResponse(response_info_); |
| 554 if (!data_.empty()) { | 552 if (!data_.empty()) { |
| 555 original_peer_->OnReceivedData(base::MakeUnique<FixedReceivedData>( | 553 original_peer_->OnReceivedData(base::MakeUnique<FixedReceivedData>( |
| 556 data_.data(), data_.size(), -1, data_.size())); | 554 data_.data(), data_.size(), -1, data_.size())); |
| 557 } | 555 } |
| 558 original_peer_->OnCompletedRequest(error_code, was_ignored_by_handler, | 556 original_peer_->OnCompletedRequest(error_code, was_ignored_by_handler, |
| 559 stale_copy_in_cache, security_info, | 557 stale_copy_in_cache, completion_time, |
| 560 completion_time, total_transfer_size); | 558 total_transfer_size); |
| 561 } | 559 } |
| 562 | 560 |
| 563 private: | 561 private: |
| 564 std::unique_ptr<RequestPeer> original_peer_; | 562 std::unique_ptr<RequestPeer> original_peer_; |
| 565 ResourceResponseInfo response_info_; | 563 ResourceResponseInfo response_info_; |
| 566 std::string data_; | 564 std::string data_; |
| 567 | 565 |
| 568 DISALLOW_COPY_AND_ASSIGN(WrapperPeer); | 566 DISALLOW_COPY_AND_ASSIGN(WrapperPeer); |
| 569 }; | 567 }; |
| 570 | 568 |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 ResourceResponseHead response_head; | 934 ResourceResponseHead response_head; |
| 937 | 935 |
| 938 PerformTest(response_head); | 936 PerformTest(response_head); |
| 939 | 937 |
| 940 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); | 938 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); |
| 941 EXPECT_EQ(base::TimeTicks(), | 939 EXPECT_EQ(base::TimeTicks(), |
| 942 response_info().load_timing.connect_timing.dns_start); | 940 response_info().load_timing.connect_timing.dns_start); |
| 943 } | 941 } |
| 944 | 942 |
| 945 } // namespace content | 943 } // namespace content |
| OLD | NEW |