| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stack> | 5 #include <stack> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 net::HttpResponseInfo* MakeHttpResponseInfo(const std::string& raw_headers) { | 380 net::HttpResponseInfo* MakeHttpResponseInfo(const std::string& raw_headers) { |
| 381 net::HttpResponseInfo* info = new net::HttpResponseInfo; | 381 net::HttpResponseInfo* info = new net::HttpResponseInfo; |
| 382 info->request_time = base::Time::Now(); | 382 info->request_time = base::Time::Now(); |
| 383 info->response_time = base::Time::Now(); | 383 info->response_time = base::Time::Now(); |
| 384 info->was_cached = false; | 384 info->was_cached = false; |
| 385 info->headers = new net::HttpResponseHeaders(raw_headers); | 385 info->headers = new net::HttpResponseHeaders(raw_headers); |
| 386 return info; | 386 return info; |
| 387 } | 387 } |
| 388 | 388 |
| 389 int GetHttpResponseInfoSize(const net::HttpResponseInfo* info) { | 389 int GetHttpResponseInfoSize(const net::HttpResponseInfo* info) { |
| 390 Pickle pickle; | 390 base::Pickle pickle; |
| 391 return PickleHttpResonseInfo(&pickle, info); | 391 return PickleHttpResonseInfo(&pickle, info); |
| 392 } | 392 } |
| 393 | 393 |
| 394 bool CompareHttpResponseInfos(const net::HttpResponseInfo* info1, | 394 bool CompareHttpResponseInfos(const net::HttpResponseInfo* info1, |
| 395 const net::HttpResponseInfo* info2) { | 395 const net::HttpResponseInfo* info2) { |
| 396 Pickle pickle1; | 396 base::Pickle pickle1; |
| 397 Pickle pickle2; | 397 base::Pickle pickle2; |
| 398 PickleHttpResonseInfo(&pickle1, info1); | 398 PickleHttpResonseInfo(&pickle1, info1); |
| 399 PickleHttpResonseInfo(&pickle2, info2); | 399 PickleHttpResonseInfo(&pickle2, info2); |
| 400 return (pickle1.size() == pickle2.size()) && | 400 return (pickle1.size() == pickle2.size()) && |
| 401 (0 == memcmp(pickle1.data(), pickle2.data(), pickle1.size())); | 401 (0 == memcmp(pickle1.data(), pickle2.data(), pickle1.size())); |
| 402 } | 402 } |
| 403 | 403 |
| 404 int PickleHttpResonseInfo(Pickle* pickle, const net::HttpResponseInfo* info) { | 404 int PickleHttpResonseInfo(base::Pickle* pickle, |
| 405 const net::HttpResponseInfo* info) { |
| 405 const bool kSkipTransientHeaders = true; | 406 const bool kSkipTransientHeaders = true; |
| 406 const bool kTruncated = false; | 407 const bool kTruncated = false; |
| 407 info->Persist(pickle, kSkipTransientHeaders, kTruncated); | 408 info->Persist(pickle, kSkipTransientHeaders, kTruncated); |
| 408 return pickle->size(); | 409 return pickle->size(); |
| 409 } | 410 } |
| 410 | 411 |
| 411 // Helpers to fill and verify blocks of memory with a value | 412 // Helpers to fill and verify blocks of memory with a value |
| 412 | 413 |
| 413 void FillData(char value, char* data, int data_len) { | 414 void FillData(char value, char* data, int data_len) { |
| 414 memset(data, value, data_len); | 415 memset(data, value, data_len); |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 RunTestOnIOThread(&AppCacheURLRequestJobTest::CancelRequest); | 861 RunTestOnIOThread(&AppCacheURLRequestJobTest::CancelRequest); |
| 861 } | 862 } |
| 862 | 863 |
| 863 TEST_F(AppCacheURLRequestJobTest, CancelRequestWithIOPending) { | 864 TEST_F(AppCacheURLRequestJobTest, CancelRequestWithIOPending) { |
| 864 RunTestOnIOThread(&AppCacheURLRequestJobTest::CancelRequestWithIOPending); | 865 RunTestOnIOThread(&AppCacheURLRequestJobTest::CancelRequestWithIOPending); |
| 865 } | 866 } |
| 866 | 867 |
| 867 } // namespace | 868 } // namespace |
| 868 | 869 |
| 869 } // namespace content | 870 } // namespace content |
| OLD | NEW |