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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/process/process.h" | 10 #include "base/process/process.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 // Listens for request response data and stores it so that it can be compared | 39 // Listens for request response data and stores it so that it can be compared |
40 // to the reference data. | 40 // to the reference data. |
41 class TestRequestCallback : public RequestPeer { | 41 class TestRequestCallback : public RequestPeer { |
42 public: | 42 public: |
43 TestRequestCallback() : complete_(false) { | 43 TestRequestCallback() : complete_(false) { |
44 } | 44 } |
45 | 45 |
46 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE { | 46 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE { |
47 } | 47 } |
48 | 48 |
49 virtual bool OnReceivedRedirect( | 49 virtual bool OnReceivedRedirect(const GURL& new_url, |
50 const GURL& new_url, | 50 const GURL& new_first_party_for_cookies, |
51 const ResourceResponseInfo& info, | 51 const ResourceResponseInfo& info) OVERRIDE { |
52 bool* has_new_first_party_for_cookies, | |
53 GURL* new_first_party_for_cookies) OVERRIDE { | |
54 *has_new_first_party_for_cookies = false; | |
55 return true; | 52 return true; |
56 } | 53 } |
57 | 54 |
58 virtual void OnReceivedResponse(const ResourceResponseInfo& info) OVERRIDE { | 55 virtual void OnReceivedResponse(const ResourceResponseInfo& info) OVERRIDE { |
59 } | 56 } |
60 | 57 |
61 virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE { | 58 virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE { |
62 } | 59 } |
63 | 60 |
64 virtual void OnReceivedData(const char* data, | 61 virtual void OnReceivedData(const char* data, |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 ResourceMsg_SetDataBuffer(0, duplicated_handle, 100, 0)); | 258 ResourceMsg_SetDataBuffer(0, duplicated_handle, 100, 0)); |
262 dispatcher_->OnMessageReceived(ResourceMsg_DataReceived(0, 0, 100, 100)); | 259 dispatcher_->OnMessageReceived(ResourceMsg_DataReceived(0, 0, 100, 100)); |
263 | 260 |
264 set_defer_loading(false); | 261 set_defer_loading(false); |
265 } | 262 } |
266 | 263 |
267 // RequestPeer methods. | 264 // RequestPeer methods. |
268 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE { | 265 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE { |
269 } | 266 } |
270 | 267 |
271 virtual bool OnReceivedRedirect( | 268 virtual bool OnReceivedRedirect(const GURL& new_url, |
272 const GURL& new_url, | 269 const GURL& new_first_party_for_cookies, |
273 const ResourceResponseInfo& info, | 270 const ResourceResponseInfo& info) OVERRIDE { |
274 bool* has_new_first_party_for_cookies, | |
275 GURL* new_first_party_for_cookies) OVERRIDE { | |
276 *has_new_first_party_for_cookies = false; | |
277 return true; | 271 return true; |
278 } | 272 } |
279 | 273 |
280 virtual void OnReceivedResponse(const ResourceResponseInfo& info) OVERRIDE { | 274 virtual void OnReceivedResponse(const ResourceResponseInfo& info) OVERRIDE { |
281 EXPECT_EQ(defer_loading_, false); | 275 EXPECT_EQ(defer_loading_, false); |
282 set_defer_loading(true); | 276 set_defer_loading(true); |
283 } | 277 } |
284 | 278 |
285 virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE { | 279 virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE { |
286 } | 280 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 bridge->Start(this); | 346 bridge->Start(this); |
353 | 347 |
354 dispatcher_->OnMessageReceived( | 348 dispatcher_->OnMessageReceived( |
355 ResourceMsg_ReceivedResponse(0, response_head)); | 349 ResourceMsg_ReceivedResponse(0, response_head)); |
356 } | 350 } |
357 | 351 |
358 // RequestPeer methods. | 352 // RequestPeer methods. |
359 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE { | 353 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE { |
360 } | 354 } |
361 | 355 |
362 virtual bool OnReceivedRedirect( | 356 virtual bool OnReceivedRedirect(const GURL& new_url, |
363 const GURL& new_url, | 357 const GURL& new_first_party_for_cookies, |
364 const ResourceResponseInfo& info, | 358 const ResourceResponseInfo& info) OVERRIDE { |
365 bool* has_new_first_party_for_cookies, | |
366 GURL* new_first_party_for_cookies) OVERRIDE { | |
367 return true; | 359 return true; |
368 } | 360 } |
369 | 361 |
370 virtual void OnReceivedResponse(const ResourceResponseInfo& info) OVERRIDE { | 362 virtual void OnReceivedResponse(const ResourceResponseInfo& info) OVERRIDE { |
371 response_info_ = info; | 363 response_info_ = info; |
372 } | 364 } |
373 | 365 |
374 virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE { | 366 virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE { |
375 } | 367 } |
376 | 368 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 response_head.error_code = net::OK; | 425 response_head.error_code = net::OK; |
434 | 426 |
435 PerformTest(response_head); | 427 PerformTest(response_head); |
436 | 428 |
437 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); | 429 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); |
438 EXPECT_EQ(base::TimeTicks(), | 430 EXPECT_EQ(base::TimeTicks(), |
439 response_info().load_timing.connect_timing.dns_start); | 431 response_info().load_timing.connect_timing.dns_start); |
440 } | 432 } |
441 | 433 |
442 } // namespace content | 434 } // namespace content |
OLD | NEW |