| 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/url_response_body_consumer.h" | 5 #include "content/child/url_response_body_consumer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 void OnDownloadedData(int len, int encoded_data_length) override { | 47 void OnDownloadedData(int len, int encoded_data_length) override { |
| 48 ADD_FAILURE() << "OnDownloadedData should not be called."; | 48 ADD_FAILURE() << "OnDownloadedData should not be called."; |
| 49 } | 49 } |
| 50 | 50 |
| 51 void OnReceivedData(std::unique_ptr<ReceivedData> data) override { | 51 void OnReceivedData(std::unique_ptr<ReceivedData> data) override { |
| 52 EXPECT_FALSE(context_->complete); | 52 EXPECT_FALSE(context_->complete); |
| 53 context_->data.append(data->payload(), data->length()); | 53 context_->data.append(data->payload(), data->length()); |
| 54 context_->run_loop_quit_closure.Run(); | 54 context_->run_loop_quit_closure.Run(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void OnTransferSizeUpdated(int transfer_size_diff) override {} |
| 58 |
| 57 void OnCompletedRequest(int error_code, | 59 void OnCompletedRequest(int error_code, |
| 58 bool was_ignored_by_handler, | 60 bool was_ignored_by_handler, |
| 59 bool stale_copy_in_cache, | 61 bool stale_copy_in_cache, |
| 60 const base::TimeTicks& completion_time, | 62 const base::TimeTicks& completion_time, |
| 61 int64_t total_transfer_size, | 63 int64_t total_transfer_size, |
| 62 int64_t encoded_body_size) override { | 64 int64_t encoded_body_size) override { |
| 63 EXPECT_FALSE(context_->complete); | 65 EXPECT_FALSE(context_->complete); |
| 64 context_->complete = true; | 66 context_->complete = true; |
| 65 context_->error_code = error_code; | 67 context_->error_code = error_code; |
| 66 context_->run_loop_quit_closure.Run(); | 68 context_->run_loop_quit_closure.Run(); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 Run(&context); | 222 Run(&context); |
| 221 | 223 |
| 222 EXPECT_TRUE(context.complete); | 224 EXPECT_TRUE(context.complete); |
| 223 EXPECT_EQ(net::ERR_FAILED, context.error_code); | 225 EXPECT_EQ(net::ERR_FAILED, context.error_code); |
| 224 EXPECT_EQ("", context.data); | 226 EXPECT_EQ("", context.data); |
| 225 } | 227 } |
| 226 | 228 |
| 227 } // namespace | 229 } // namespace |
| 228 | 230 |
| 229 } // namespace content | 231 } // namespace content |
| OLD | NEW |