Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: content/child/url_response_body_consumer_unittest.cc

Issue 2510333002: Send encoded_body_length to renderer when response completed (2/3) (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/child/url_response_body_consumer.cc ('k') | content/child/web_url_loader_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 OnCompletedRequest(int error_code, 57 void OnCompletedRequest(int error_code,
58 bool was_ignored_by_handler, 58 bool was_ignored_by_handler,
59 bool stale_copy_in_cache, 59 bool stale_copy_in_cache,
60 const base::TimeTicks& completion_time, 60 const base::TimeTicks& completion_time,
61 int64_t total_transfer_size) override { 61 int64_t total_transfer_size,
62 int64_t encoded_body_size) override {
62 EXPECT_FALSE(context_->complete); 63 EXPECT_FALSE(context_->complete);
63 context_->complete = true; 64 context_->complete = true;
64 context_->error_code = error_code; 65 context_->error_code = error_code;
65 context_->run_loop_quit_closure.Run(); 66 context_->run_loop_quit_closure.Run();
66 } 67 }
67 68
68 struct Context { 69 struct Context {
69 // Data received. If downloading to file, remains empty. 70 // Data received. If downloading to file, remains empty.
70 std::string data; 71 std::string data;
71 bool complete = false; 72 bool complete = false;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 Run(&context); 220 Run(&context);
220 221
221 EXPECT_TRUE(context.complete); 222 EXPECT_TRUE(context.complete);
222 EXPECT_EQ(net::ERR_FAILED, context.error_code); 223 EXPECT_EQ(net::ERR_FAILED, context.error_code);
223 EXPECT_EQ("", context.data); 224 EXPECT_EQ("", context.data);
224 } 225 }
225 226
226 } // namespace 227 } // namespace
227 228
228 } // namespace content 229 } // namespace content
OLDNEW
« no previous file with comments | « content/child/url_response_body_consumer.cc ('k') | content/child/web_url_loader_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698