| 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 <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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 EXPECT_TRUE(dispatcher_.OnMessageReceived( | 297 EXPECT_TRUE(dispatcher_.OnMessageReceived( |
| 298 ResourceMsg_SetDataBuffer(request_id, duplicate_handle, | 298 ResourceMsg_SetDataBuffer(request_id, duplicate_handle, |
| 299 shared_memory->requested_size(), 0))); | 299 shared_memory->requested_size(), 0))); |
| 300 } | 300 } |
| 301 | 301 |
| 302 void NotifyDataReceived(int request_id, std::string data) { | 302 void NotifyDataReceived(int request_id, std::string data) { |
| 303 ASSERT_LE(data.length(), shared_memory_map_[request_id]->requested_size()); | 303 ASSERT_LE(data.length(), shared_memory_map_[request_id]->requested_size()); |
| 304 memcpy(shared_memory_map_[request_id]->memory(), data.c_str(), | 304 memcpy(shared_memory_map_[request_id]->memory(), data.c_str(), |
| 305 data.length()); | 305 data.length()); |
| 306 | 306 |
| 307 EXPECT_TRUE(dispatcher_.OnMessageReceived(ResourceMsg_DataReceived( | 307 EXPECT_TRUE(dispatcher_.OnMessageReceived( |
| 308 request_id, 0, 0, data.length(), data.length()))); | 308 ResourceMsg_DataReceived(request_id, 0, data.length(), data.length()))); |
| 309 } | 309 } |
| 310 | 310 |
| 311 void NotifyDataDownloaded(int request_id, int decoded_length, | 311 void NotifyDataDownloaded(int request_id, int decoded_length, |
| 312 int encoded_length) { | 312 int encoded_length) { |
| 313 EXPECT_TRUE(dispatcher_.OnMessageReceived( | 313 EXPECT_TRUE(dispatcher_.OnMessageReceived( |
| 314 ResourceMsg_DataDownloaded(request_id, decoded_length, | 314 ResourceMsg_DataDownloaded(request_id, decoded_length, |
| 315 encoded_length))); | 315 encoded_length))); |
| 316 } | 316 } |
| 317 | 317 |
| 318 void NotifyRequestComplete(int request_id, size_t total_size) { | 318 void NotifyRequestComplete(int request_id, size_t total_size) { |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 ResourceResponseHead response_head; | 810 ResourceResponseHead response_head; |
| 811 | 811 |
| 812 PerformTest(response_head); | 812 PerformTest(response_head); |
| 813 | 813 |
| 814 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); | 814 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); |
| 815 EXPECT_EQ(base::TimeTicks(), | 815 EXPECT_EQ(base::TimeTicks(), |
| 816 response_info().load_timing.connect_timing.dns_start); | 816 response_info().load_timing.connect_timing.dns_start); |
| 817 } | 817 } |
| 818 | 818 |
| 819 } // namespace content | 819 } // namespace content |
| OLD | NEW |