OLD | NEW |
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 "content/child/resource_dispatcher.h" | 5 #include "content/child/resource_dispatcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 EXPECT_TRUE(dispatcher_->OnMessageReceived(ResourceMsg_SetDataBuffer( | 268 EXPECT_TRUE(dispatcher_->OnMessageReceived(ResourceMsg_SetDataBuffer( |
269 request_id, duplicate_handle, shared_memory->requested_size(), 0))); | 269 request_id, duplicate_handle, shared_memory->requested_size(), 0))); |
270 } | 270 } |
271 | 271 |
272 void NotifyDataReceived(int request_id, const std::string& data) { | 272 void NotifyDataReceived(int request_id, const std::string& data) { |
273 ASSERT_LE(data.length(), shared_memory_map_[request_id]->requested_size()); | 273 ASSERT_LE(data.length(), shared_memory_map_[request_id]->requested_size()); |
274 memcpy(shared_memory_map_[request_id]->memory(), data.c_str(), | 274 memcpy(shared_memory_map_[request_id]->memory(), data.c_str(), |
275 data.length()); | 275 data.length()); |
276 | 276 |
277 EXPECT_TRUE(dispatcher_->OnMessageReceived(ResourceMsg_DataReceived( | 277 EXPECT_TRUE(dispatcher_->OnMessageReceived(ResourceMsg_DataReceived( |
278 request_id, 0, data.length(), data.length(), data.length()))); | 278 request_id, 0, data.length(), data.length()))); |
279 } | 279 } |
280 | 280 |
281 void NotifyInlinedDataChunkReceived(int request_id, | 281 void NotifyInlinedDataChunkReceived(int request_id, |
282 const std::vector<char>& data) { | 282 const std::vector<char>& data) { |
283 auto size = data.size(); | 283 auto size = data.size(); |
284 EXPECT_TRUE(dispatcher_->OnMessageReceived( | 284 EXPECT_TRUE(dispatcher_->OnMessageReceived( |
285 ResourceMsg_InlinedDataChunkReceived(request_id, data, size, size))); | 285 ResourceMsg_InlinedDataChunkReceived(request_id, data, size))); |
286 } | 286 } |
287 | 287 |
288 void NotifyDataDownloaded(int request_id, | 288 void NotifyDataDownloaded(int request_id, |
289 int decoded_length, | 289 int decoded_length, |
290 int encoded_data_length) { | 290 int encoded_data_length) { |
291 EXPECT_TRUE(dispatcher_->OnMessageReceived(ResourceMsg_DataDownloaded( | 291 EXPECT_TRUE(dispatcher_->OnMessageReceived(ResourceMsg_DataDownloaded( |
292 request_id, decoded_length, encoded_data_length))); | 292 request_id, decoded_length, encoded_data_length))); |
293 } | 293 } |
294 | 294 |
295 void NotifyRequestComplete(int request_id, size_t total_size) { | 295 void NotifyRequestComplete(int request_id, size_t total_size) { |
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 ResourceResponseHead response_head; | 1039 ResourceResponseHead response_head; |
1040 | 1040 |
1041 PerformTest(response_head); | 1041 PerformTest(response_head); |
1042 | 1042 |
1043 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); | 1043 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); |
1044 EXPECT_EQ(base::TimeTicks(), | 1044 EXPECT_EQ(base::TimeTicks(), |
1045 response_info().load_timing.connect_timing.dns_start); | 1045 response_info().load_timing.connect_timing.dns_start); |
1046 } | 1046 } |
1047 | 1047 |
1048 } // namespace content | 1048 } // namespace content |
OLD | NEW |