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

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

Issue 1103813002: Make WebURLLoader capable of retaining received buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
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/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 received_response_ = true; 70 received_response_ = true;
71 if (cancel_on_receive_response_) 71 if (cancel_on_receive_response_)
72 dispatcher_->Cancel(request_id_); 72 dispatcher_->Cancel(request_id_);
73 } 73 }
74 74
75 void OnDownloadedData(int len, int encoded_data_length) override { 75 void OnDownloadedData(int len, int encoded_data_length) override {
76 total_downloaded_data_length_ += len; 76 total_downloaded_data_length_ += len;
77 total_encoded_data_length_ += encoded_data_length; 77 total_encoded_data_length_ += encoded_data_length;
78 } 78 }
79 79
80 void OnReceivedData(const char* data, 80 void OnReceivedData(scoped_ptr<ReceivedData> data) override {
81 int data_length,
82 int encoded_data_length) override {
83 EXPECT_TRUE(received_response_); 81 EXPECT_TRUE(received_response_);
84 EXPECT_FALSE(complete_); 82 EXPECT_FALSE(complete_);
85 data_.append(data, data_length); 83 data_.append(data->payload(), data->length());
86 total_encoded_data_length_ += encoded_data_length; 84 total_encoded_data_length_ += data->encoded_length();
87 } 85 }
88 86
89 void OnCompletedRequest(int error_code, 87 void OnCompletedRequest(int error_code,
90 bool was_ignored_by_handler, 88 bool was_ignored_by_handler,
91 bool stale_copy_in_cache, 89 bool stale_copy_in_cache,
92 const std::string& security_info, 90 const std::string& security_info,
93 const base::TimeTicks& completion_time, 91 const base::TimeTicks& completion_time,
94 int64 total_transfer_size) override { 92 int64 total_transfer_size) override {
95 EXPECT_TRUE(received_response_); 93 EXPECT_TRUE(received_response_);
96 EXPECT_FALSE(complete_); 94 EXPECT_FALSE(complete_);
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 const ResourceResponseInfo& info) override { 725 const ResourceResponseInfo& info) override {
728 return true; 726 return true;
729 } 727 }
730 728
731 void OnReceivedResponse(const ResourceResponseInfo& info) override { 729 void OnReceivedResponse(const ResourceResponseInfo& info) override {
732 response_info_ = info; 730 response_info_ = info;
733 } 731 }
734 732
735 void OnDownloadedData(int len, int encoded_data_length) override {} 733 void OnDownloadedData(int len, int encoded_data_length) override {}
736 734
737 void OnReceivedData(const char* data, 735 void OnReceivedData(scoped_ptr<ReceivedData> data) override {}
738 int data_length,
739 int encoded_data_length) override {}
740 736
741 void OnCompletedRequest(int error_code, 737 void OnCompletedRequest(int error_code,
742 bool was_ignored_by_handler, 738 bool was_ignored_by_handler,
743 bool stale_copy_in_cache, 739 bool stale_copy_in_cache,
744 const std::string& security_info, 740 const std::string& security_info,
745 const base::TimeTicks& completion_time, 741 const base::TimeTicks& completion_time,
746 int64 total_transfer_size) override {} 742 int64 total_transfer_size) override {}
747 743
748 const ResourceResponseInfo& response_info() const { return response_info_; } 744 const ResourceResponseInfo& response_info() const { return response_info_; }
749 745
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 ResourceResponseHead response_head; 783 ResourceResponseHead response_head;
788 784
789 PerformTest(response_head); 785 PerformTest(response_head);
790 786
791 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); 787 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start);
792 EXPECT_EQ(base::TimeTicks(), 788 EXPECT_EQ(base::TimeTicks(),
793 response_info().load_timing.connect_timing.dns_start); 789 response_info().load_timing.connect_timing.dns_start);
794 } 790 }
795 791
796 } // namespace content 792 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698