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

Side by Side Diff: content/child/shared_memory_data_consumer_handle_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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/shared_memory_data_consumer_handle.h" 5 #include "content/child/shared_memory_data_consumer_handle.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 logger_->Add(name_ + " is destructed."); 79 logger_->Add(name_ + " is destructed.");
80 } 80 }
81 81
82 const char* payload() const override { 82 const char* payload() const override {
83 return data_.empty() ? nullptr : &data_[0]; 83 return data_.empty() ? nullptr : &data_[0];
84 } 84 }
85 int length() const override { return static_cast<int>(data_.size()); } 85 int length() const override { return static_cast<int>(data_.size()); }
86 int encoded_data_length() const override { 86 int encoded_data_length() const override {
87 return static_cast<int>(data_.size()); 87 return static_cast<int>(data_.size());
88 } 88 }
89 int encoded_body_length() const override {
90 return static_cast<int>(data_.size());
91 }
92 89
93 private: 90 private:
94 const std::string name_; 91 const std::string name_;
95 const std::vector<char> data_; 92 const std::vector<char> data_;
96 scoped_refptr<Logger> logger_; 93 scoped_refptr<Logger> logger_;
97 94
98 DISALLOW_COPY_AND_ASSIGN(LoggingFixedReceivedData); 95 DISALLOW_COPY_AND_ASSIGN(LoggingFixedReceivedData);
99 }; 96 };
100 97
101 class DestructionTrackingFunction 98 class DestructionTrackingFunction
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 }; 194 };
198 195
199 class SharedMemoryDataConsumerHandleTest 196 class SharedMemoryDataConsumerHandleTest
200 : public ::testing::TestWithParam<BackpressureMode> { 197 : public ::testing::TestWithParam<BackpressureMode> {
201 protected: 198 protected:
202 void SetUp() override { 199 void SetUp() override {
203 handle_.reset(new SharedMemoryDataConsumerHandle(GetParam(), &writer_)); 200 handle_.reset(new SharedMemoryDataConsumerHandle(GetParam(), &writer_));
204 } 201 }
205 std::unique_ptr<FixedReceivedData> NewFixedData(const char* s) { 202 std::unique_ptr<FixedReceivedData> NewFixedData(const char* s) {
206 auto size = strlen(s); 203 auto size = strlen(s);
207 return base::MakeUnique<FixedReceivedData>(s, size, size, size); 204 return base::MakeUnique<FixedReceivedData>(s, size, size);
208 } 205 }
209 206
210 StrictMock<MockClient> client_; 207 StrictMock<MockClient> client_;
211 std::unique_ptr<SharedMemoryDataConsumerHandle> handle_; 208 std::unique_ptr<SharedMemoryDataConsumerHandle> handle_;
212 std::unique_ptr<Writer> writer_; 209 std::unique_ptr<Writer> writer_;
213 base::MessageLoop loop_; 210 base::MessageLoop loop_;
214 }; 211 };
215 212
216 void RunPostedTasks() { 213 void RunPostedTasks() {
217 base::RunLoop run_loop; 214 base::RunLoop run_loop;
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 logger->log()); 1056 logger->log());
1060 } 1057 }
1061 1058
1062 INSTANTIATE_TEST_CASE_P(SharedMemoryDataConsumerHandleTest, 1059 INSTANTIATE_TEST_CASE_P(SharedMemoryDataConsumerHandleTest,
1063 SharedMemoryDataConsumerHandleTest, 1060 SharedMemoryDataConsumerHandleTest,
1064 ::testing::Values(kApplyBackpressure, 1061 ::testing::Values(kApplyBackpressure,
1065 kDoNotApplyBackpressure)); 1062 kDoNotApplyBackpressure));
1066 } // namespace 1063 } // namespace
1067 1064
1068 } // namespace content 1065 } // namespace content
OLDNEW
« no previous file with comments | « content/child/shared_memory_data_consumer_handle.cc ('k') | content/child/shared_memory_received_data_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698