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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 context_->run_loop_quit_closure.Run(); | 59 context_->run_loop_quit_closure.Run(); |
60 } | 60 } |
61 | 61 |
62 void OnTransferSizeUpdated(int transfer_size_diff) override {} | 62 void OnTransferSizeUpdated(int transfer_size_diff) override {} |
63 | 63 |
64 void OnCompletedRequest(int error_code, | 64 void OnCompletedRequest(int error_code, |
65 bool was_ignored_by_handler, | 65 bool was_ignored_by_handler, |
66 bool stale_copy_in_cache, | 66 bool stale_copy_in_cache, |
67 const base::TimeTicks& completion_time, | 67 const base::TimeTicks& completion_time, |
68 int64_t total_transfer_size, | 68 int64_t total_transfer_size, |
69 int64_t encoded_body_size) override { | 69 int64_t encoded_body_size, |
| 70 int64_t decoded_body_size) override { |
70 EXPECT_FALSE(context_->complete); | 71 EXPECT_FALSE(context_->complete); |
71 context_->complete = true; | 72 context_->complete = true; |
72 context_->error_code = error_code; | 73 context_->error_code = error_code; |
73 context_->run_loop_quit_closure.Run(); | 74 context_->run_loop_quit_closure.Run(); |
74 } | 75 } |
75 | 76 |
76 struct Context { | 77 struct Context { |
77 // Data received. If downloading to file, remains empty. | 78 // Data received. If downloading to file, remains empty. |
78 std::string data; | 79 std::string data; |
79 bool complete = false; | 80 bool complete = false; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 EXPECT_EQ(std::string(kMaxNumConsumedBytesInTask, 'a'), context.data); | 302 EXPECT_EQ(std::string(kMaxNumConsumedBytesInTask, 'a'), context.data); |
302 context.data.clear(); | 303 context.data.clear(); |
303 | 304 |
304 Run(&context); | 305 Run(&context); |
305 EXPECT_EQ(std::string(kMaxNumConsumedBytesInTask, 'b'), context.data); | 306 EXPECT_EQ(std::string(kMaxNumConsumedBytesInTask, 'b'), context.data); |
306 } | 307 } |
307 | 308 |
308 } // namespace | 309 } // namespace |
309 | 310 |
310 } // namespace content | 311 } // namespace content |
OLD | NEW |