| 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 <string> | 6 #include <string> |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 net::HttpResponseInfo* MakeHttpResponseInfo(const std::string& raw_headers) { | 258 net::HttpResponseInfo* MakeHttpResponseInfo(const std::string& raw_headers) { |
| 259 net::HttpResponseInfo* info = new net::HttpResponseInfo; | 259 net::HttpResponseInfo* info = new net::HttpResponseInfo; |
| 260 info->request_time = base::Time::Now(); | 260 info->request_time = base::Time::Now(); |
| 261 info->response_time = base::Time::Now(); | 261 info->response_time = base::Time::Now(); |
| 262 info->was_cached = false; | 262 info->was_cached = false; |
| 263 info->headers = new net::HttpResponseHeaders(raw_headers); | 263 info->headers = new net::HttpResponseHeaders(raw_headers); |
| 264 return info; | 264 return info; |
| 265 } | 265 } |
| 266 | 266 |
| 267 int GetHttpResponseInfoSize(const net::HttpResponseInfo* info) { | 267 int GetHttpResponseInfoSize(const net::HttpResponseInfo* info) { |
| 268 Pickle pickle; | 268 base::Pickle pickle; |
| 269 return PickleHttpResonseInfo(&pickle, info); | 269 return PickleHttpResonseInfo(&pickle, info); |
| 270 } | 270 } |
| 271 | 271 |
| 272 bool CompareHttpResponseInfos(const net::HttpResponseInfo* info1, | 272 bool CompareHttpResponseInfos(const net::HttpResponseInfo* info1, |
| 273 const net::HttpResponseInfo* info2) { | 273 const net::HttpResponseInfo* info2) { |
| 274 Pickle pickle1; | 274 base::Pickle pickle1; |
| 275 Pickle pickle2; | 275 base::Pickle pickle2; |
| 276 PickleHttpResonseInfo(&pickle1, info1); | 276 PickleHttpResonseInfo(&pickle1, info1); |
| 277 PickleHttpResonseInfo(&pickle2, info2); | 277 PickleHttpResonseInfo(&pickle2, info2); |
| 278 return (pickle1.size() == pickle2.size()) && | 278 return (pickle1.size() == pickle2.size()) && |
| 279 (0 == memcmp(pickle1.data(), pickle2.data(), pickle1.size())); | 279 (0 == memcmp(pickle1.data(), pickle2.data(), pickle1.size())); |
| 280 } | 280 } |
| 281 | 281 |
| 282 int PickleHttpResonseInfo(Pickle* pickle, const net::HttpResponseInfo* info) { | 282 int PickleHttpResonseInfo(base::Pickle* pickle, |
| 283 const net::HttpResponseInfo* info) { |
| 283 const bool kSkipTransientHeaders = true; | 284 const bool kSkipTransientHeaders = true; |
| 284 const bool kTruncated = false; | 285 const bool kTruncated = false; |
| 285 info->Persist(pickle, kSkipTransientHeaders, kTruncated); | 286 info->Persist(pickle, kSkipTransientHeaders, kTruncated); |
| 286 return pickle->size(); | 287 return pickle->size(); |
| 287 } | 288 } |
| 288 | 289 |
| 289 // Helpers to fill and verify blocks of memory with a value | 290 // Helpers to fill and verify blocks of memory with a value |
| 290 | 291 |
| 291 void FillData(char value, char* data, int data_len) { | 292 void FillData(char value, char* data, int data_len) { |
| 292 memset(data, value, data_len); | 293 memset(data, value, data_len); |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 | 809 |
| 809 TEST_F(AppCacheResponseTest, DeleteWithinCallbacks) { | 810 TEST_F(AppCacheResponseTest, DeleteWithinCallbacks) { |
| 810 RunTestOnIOThread(&AppCacheResponseTest::DeleteWithinCallbacks); | 811 RunTestOnIOThread(&AppCacheResponseTest::DeleteWithinCallbacks); |
| 811 } | 812 } |
| 812 | 813 |
| 813 TEST_F(AppCacheResponseTest, DeleteWithIOPending) { | 814 TEST_F(AppCacheResponseTest, DeleteWithIOPending) { |
| 814 RunTestOnIOThread(&AppCacheResponseTest::DeleteWithIOPending); | 815 RunTestOnIOThread(&AppCacheResponseTest::DeleteWithIOPending); |
| 815 } | 816 } |
| 816 | 817 |
| 817 } // namespace content | 818 } // namespace content |
| OLD | NEW |