| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 void OnReceivedData(std::unique_ptr<ReceivedData> data) override { | 46 void OnReceivedData(std::unique_ptr<ReceivedData> data) override { |
| 47 EXPECT_FALSE(context_->complete); | 47 EXPECT_FALSE(context_->complete); |
| 48 context_->data.append(data->payload(), data->length()); | 48 context_->data.append(data->payload(), data->length()); |
| 49 context_->run_loop_quit_closure.Run(); | 49 context_->run_loop_quit_closure.Run(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void OnCompletedRequest(int error_code, | 52 void OnCompletedRequest(int error_code, |
| 53 bool was_ignored_by_handler, | 53 bool was_ignored_by_handler, |
| 54 bool stale_copy_in_cache, | 54 bool stale_copy_in_cache, |
| 55 const std::string& security_info, | |
| 56 const base::TimeTicks& completion_time, | 55 const base::TimeTicks& completion_time, |
| 57 int64_t total_transfer_size) override { | 56 int64_t total_transfer_size) override { |
| 58 EXPECT_FALSE(context_->complete); | 57 EXPECT_FALSE(context_->complete); |
| 59 context_->complete = true; | 58 context_->complete = true; |
| 60 context_->error_code = error_code; | 59 context_->error_code = error_code; |
| 61 context_->run_loop_quit_closure.Run(); | 60 context_->run_loop_quit_closure.Run(); |
| 62 } | 61 } |
| 63 | 62 |
| 64 struct Context { | 63 struct Context { |
| 65 // Data received. If downloading to file, remains empty. | 64 // Data received. If downloading to file, remains empty. |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 Run(&context); | 201 Run(&context); |
| 203 | 202 |
| 204 EXPECT_TRUE(context.complete); | 203 EXPECT_TRUE(context.complete); |
| 205 EXPECT_EQ(net::ERR_FAILED, context.error_code); | 204 EXPECT_EQ(net::ERR_FAILED, context.error_code); |
| 206 EXPECT_EQ("", context.data); | 205 EXPECT_EQ("", context.data); |
| 207 } | 206 } |
| 208 | 207 |
| 209 } // namespace | 208 } // namespace |
| 210 | 209 |
| 211 } // namespace content | 210 } // namespace content |
| OLD | NEW |