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

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

Issue 2105713002: Render process changes for ResourceTiming sizes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@resource_timing_sizes_browser_process
Patch Set: Created 4 years, 5 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 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 : name_(name), data_(s, s + strlen(s)), logger_(logger) {} 75 : name_(name), data_(s, s + strlen(s)), logger_(logger) {}
76 ~LoggingFixedReceivedData() override { 76 ~LoggingFixedReceivedData() override {
77 logger_->Add(name_ + " is destructed."); 77 logger_->Add(name_ + " is destructed.");
78 } 78 }
79 79
80 const char* payload() const override { 80 const char* payload() const override {
81 return data_.empty() ? nullptr : &data_[0]; 81 return data_.empty() ? nullptr : &data_[0];
82 } 82 }
83 int length() const override { return static_cast<int>(data_.size()); } 83 int length() const override { return static_cast<int>(data_.size()); }
84 int encoded_length() const override { return static_cast<int>(data_.size()); } 84 int encoded_length() const override { return static_cast<int>(data_.size()); }
85 int encoded_body_length() const override {
86 return static_cast<int>(data_.size());
87 }
85 88
86 private: 89 private:
87 const std::string name_; 90 const std::string name_;
88 const std::vector<char> data_; 91 const std::vector<char> data_;
89 scoped_refptr<Logger> logger_; 92 scoped_refptr<Logger> logger_;
90 93
91 DISALLOW_COPY_AND_ASSIGN(LoggingFixedReceivedData); 94 DISALLOW_COPY_AND_ASSIGN(LoggingFixedReceivedData);
92 }; 95 };
93 96
94 class DestructionTrackingFunction 97 class DestructionTrackingFunction
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 base::MessageLoop loop_; 192 base::MessageLoop loop_;
190 }; 193 };
191 194
192 class SharedMemoryDataConsumerHandleTest 195 class SharedMemoryDataConsumerHandleTest
193 : public ::testing::TestWithParam<BackpressureMode> { 196 : public ::testing::TestWithParam<BackpressureMode> {
194 protected: 197 protected:
195 void SetUp() override { 198 void SetUp() override {
196 handle_.reset(new SharedMemoryDataConsumerHandle(GetParam(), &writer_)); 199 handle_.reset(new SharedMemoryDataConsumerHandle(GetParam(), &writer_));
197 } 200 }
198 std::unique_ptr<FixedReceivedData> NewFixedData(const char* s) { 201 std::unique_ptr<FixedReceivedData> NewFixedData(const char* s) {
199 return base::WrapUnique(new FixedReceivedData(s, strlen(s), strlen(s))); 202 auto size = strlen(s);
203 return base::WrapUnique(new FixedReceivedData(s, size, size, size));
200 } 204 }
201 205
202 StrictMock<MockClient> client_; 206 StrictMock<MockClient> client_;
203 std::unique_ptr<SharedMemoryDataConsumerHandle> handle_; 207 std::unique_ptr<SharedMemoryDataConsumerHandle> handle_;
204 std::unique_ptr<Writer> writer_; 208 std::unique_ptr<Writer> writer_;
205 base::MessageLoop loop_; 209 base::MessageLoop loop_;
206 }; 210 };
207 211
208 void RunPostedTasks() { 212 void RunPostedTasks() {
209 base::RunLoop run_loop; 213 base::RunLoop run_loop;
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 logger->log()); 1048 logger->log());
1045 } 1049 }
1046 1050
1047 INSTANTIATE_TEST_CASE_P(SharedMemoryDataConsumerHandleTest, 1051 INSTANTIATE_TEST_CASE_P(SharedMemoryDataConsumerHandleTest,
1048 SharedMemoryDataConsumerHandleTest, 1052 SharedMemoryDataConsumerHandleTest,
1049 ::testing::Values(kApplyBackpressure, 1053 ::testing::Values(kApplyBackpressure,
1050 kDoNotApplyBackpressure)); 1054 kDoNotApplyBackpressure));
1051 } // namespace 1055 } // namespace
1052 1056
1053 } // namespace content 1057 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698