| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/test_request_peer.h" | 5 #include "content/child/test_request_peer.h" |
| 6 | 6 |
| 7 #include "content/child/resource_dispatcher.h" | 7 #include "content/child/resource_dispatcher.h" |
| 8 #include "net/url_request/redirect_info.h" | 8 #include "net/url_request/redirect_info.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 context_->cancelled = true; | 61 context_->cancelled = true; |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 void TestRequestPeer::OnTransferSizeUpdated(int transfer_size_diff) { | 65 void TestRequestPeer::OnTransferSizeUpdated(int transfer_size_diff) { |
| 66 EXPECT_TRUE(context_->received_response); | 66 EXPECT_TRUE(context_->received_response); |
| 67 EXPECT_FALSE(context_->complete); | 67 EXPECT_FALSE(context_->complete); |
| 68 if (context_->cancelled) | 68 if (context_->cancelled) |
| 69 return; | 69 return; |
| 70 context_->total_encoded_data_length += transfer_size_diff; | 70 context_->total_encoded_data_length += transfer_size_diff; |
| 71 if (context_->defer_on_transfer_size_updated) |
| 72 dispatcher_->SetDefersLoading(context_->request_id, true); |
| 71 } | 73 } |
| 72 | 74 |
| 73 void TestRequestPeer::OnCompletedRequest(int error_code, | 75 void TestRequestPeer::OnCompletedRequest(int error_code, |
| 74 bool was_ignored_by_handler, | 76 bool was_ignored_by_handler, |
| 75 bool stale_copy_in_cache, | 77 bool stale_copy_in_cache, |
| 76 const base::TimeTicks& completion_time, | 78 const base::TimeTicks& completion_time, |
| 77 int64_t total_transfer_size, | 79 int64_t total_transfer_size, |
| 78 int64_t encoded_body_size) { | 80 int64_t encoded_body_size) { |
| 79 if (context_->cancelled) | 81 if (context_->cancelled) |
| 80 return; | 82 return; |
| 81 EXPECT_TRUE(context_->received_response); | 83 EXPECT_TRUE(context_->received_response); |
| 82 EXPECT_FALSE(context_->complete); | 84 EXPECT_FALSE(context_->complete); |
| 83 context_->complete = true; | 85 context_->complete = true; |
| 84 } | 86 } |
| 85 | 87 |
| 86 TestRequestPeer::Context::Context() = default; | 88 TestRequestPeer::Context::Context() = default; |
| 87 TestRequestPeer::Context::~Context() = default; | 89 TestRequestPeer::Context::~Context() = default; |
| 88 | 90 |
| 89 } // namespace content | 91 } // namespace content |
| OLD | NEW |