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

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

Issue 23696002: Propagate the encoded data length through OnDownloadData delegate method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 months 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/resource_dispatcher.cc ('k') | content/common/resource_messages.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/process/process.h" 10 #include "base/process/process.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 const ResourceResponseInfo& info, 50 const ResourceResponseInfo& info,
51 bool* has_new_first_party_for_cookies, 51 bool* has_new_first_party_for_cookies,
52 GURL* new_first_party_for_cookies) OVERRIDE { 52 GURL* new_first_party_for_cookies) OVERRIDE {
53 *has_new_first_party_for_cookies = false; 53 *has_new_first_party_for_cookies = false;
54 return true; 54 return true;
55 } 55 }
56 56
57 virtual void OnReceivedResponse(const ResourceResponseInfo& info) OVERRIDE { 57 virtual void OnReceivedResponse(const ResourceResponseInfo& info) OVERRIDE {
58 } 58 }
59 59
60 virtual void OnDownloadedData(int len) OVERRIDE { 60 virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE {
61 } 61 }
62 62
63 virtual void OnReceivedData(const char* data, 63 virtual void OnReceivedData(const char* data,
64 int data_length, 64 int data_length,
65 int encoded_data_length) OVERRIDE { 65 int encoded_data_length) OVERRIDE {
66 EXPECT_FALSE(complete_); 66 EXPECT_FALSE(complete_);
67 data_.append(data, data_length); 67 data_.append(data, data_length);
68 total_encoded_data_length_ += encoded_data_length; 68 total_encoded_data_length_ += encoded_data_length;
69 } 69 }
70 70
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 GURL* new_first_party_for_cookies) OVERRIDE { 278 GURL* new_first_party_for_cookies) OVERRIDE {
279 *has_new_first_party_for_cookies = false; 279 *has_new_first_party_for_cookies = false;
280 return true; 280 return true;
281 } 281 }
282 282
283 virtual void OnReceivedResponse(const ResourceResponseInfo& info) OVERRIDE { 283 virtual void OnReceivedResponse(const ResourceResponseInfo& info) OVERRIDE {
284 EXPECT_EQ(defer_loading_, false); 284 EXPECT_EQ(defer_loading_, false);
285 set_defer_loading(true); 285 set_defer_loading(true);
286 } 286 }
287 287
288 virtual void OnDownloadedData(int len) OVERRIDE { 288 virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE {
289 } 289 }
290 290
291 virtual void OnReceivedData(const char* data, 291 virtual void OnReceivedData(const char* data,
292 int data_length, 292 int data_length,
293 int encoded_data_length) OVERRIDE { 293 int encoded_data_length) OVERRIDE {
294 EXPECT_EQ(defer_loading_, false); 294 EXPECT_EQ(defer_loading_, false);
295 set_defer_loading(false); 295 set_defer_loading(false);
296 } 296 }
297 297
298 virtual void OnCompletedRequest( 298 virtual void OnCompletedRequest(
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 const ResourceResponseInfo& info, 367 const ResourceResponseInfo& info,
368 bool* has_new_first_party_for_cookies, 368 bool* has_new_first_party_for_cookies,
369 GURL* new_first_party_for_cookies) OVERRIDE { 369 GURL* new_first_party_for_cookies) OVERRIDE {
370 return true; 370 return true;
371 } 371 }
372 372
373 virtual void OnReceivedResponse(const ResourceResponseInfo& info) OVERRIDE { 373 virtual void OnReceivedResponse(const ResourceResponseInfo& info) OVERRIDE {
374 response_info_ = info; 374 response_info_ = info;
375 } 375 }
376 376
377 virtual void OnDownloadedData(int len) OVERRIDE { 377 virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE {
378 } 378 }
379 379
380 virtual void OnReceivedData(const char* data, 380 virtual void OnReceivedData(const char* data,
381 int data_length, 381 int data_length,
382 int encoded_data_length) OVERRIDE { 382 int encoded_data_length) OVERRIDE {
383 } 383 }
384 384
385 virtual void OnCompletedRequest( 385 virtual void OnCompletedRequest(
386 int error_code, 386 int error_code,
387 bool was_ignored_by_handler, 387 bool was_ignored_by_handler,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 response_head.error_code = net::OK; 434 response_head.error_code = net::OK;
435 435
436 PerformTest(response_head); 436 PerformTest(response_head);
437 437
438 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); 438 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start);
439 EXPECT_EQ(base::TimeTicks(), 439 EXPECT_EQ(base::TimeTicks(),
440 response_info().load_timing.connect_timing.dns_start); 440 response_info().load_timing.connect_timing.dns_start);
441 } 441 }
442 442
443 } // namespace content 443 } // namespace content
OLDNEW
« no previous file with comments | « content/child/resource_dispatcher.cc ('k') | content/common/resource_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698