| 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/pickle.h" | 8 #include "base/pickle.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 namespace { | 66 namespace { |
| 67 | 67 |
| 68 void WriteHeaders(disk_cache::Entry* entry, const std::string& headers) { | 68 void WriteHeaders(disk_cache::Entry* entry, const std::string& headers) { |
| 69 net::HttpResponseInfo responseinfo; | 69 net::HttpResponseInfo responseinfo; |
| 70 std::string raw_headers = net::HttpUtil::AssembleRawHeaders( | 70 std::string raw_headers = net::HttpUtil::AssembleRawHeaders( |
| 71 headers.c_str(), headers.size()); | 71 headers.c_str(), headers.size()); |
| 72 responseinfo.socket_address = net::HostPortPair("1.2.3.4", 80); | 72 responseinfo.socket_address = net::HostPortPair("1.2.3.4", 80); |
| 73 responseinfo.headers = new net::HttpResponseHeaders(raw_headers); | 73 responseinfo.headers = new net::HttpResponseHeaders(raw_headers); |
| 74 | 74 |
| 75 Pickle pickle; | 75 base::Pickle pickle; |
| 76 responseinfo.Persist(&pickle, false, false); | 76 responseinfo.Persist(&pickle, false, false); |
| 77 | 77 |
| 78 scoped_refptr<net::WrappedIOBuffer> buf(new net::WrappedIOBuffer( | 78 scoped_refptr<net::WrappedIOBuffer> buf(new net::WrappedIOBuffer( |
| 79 reinterpret_cast<const char*>(pickle.data()))); | 79 reinterpret_cast<const char*>(pickle.data()))); |
| 80 int len = static_cast<int>(pickle.size()); | 80 int len = static_cast<int>(pickle.size()); |
| 81 | 81 |
| 82 net::TestCompletionCallback cb; | 82 net::TestCompletionCallback cb; |
| 83 int rv = entry->WriteData(0, 0, buf.get(), len, cb.callback(), true); | 83 int rv = entry->WriteData(0, 0, buf.get(), len, cb.callback(), true); |
| 84 ASSERT_EQ(len, cb.GetResult(rv)); | 84 ASSERT_EQ(len, cb.GetResult(rv)); |
| 85 } | 85 } |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 pb_resource = expected.add_resources(); | 670 pb_resource = expected.add_resources(); |
| 671 pb_resource->set_id(2); | 671 pb_resource->set_id(2); |
| 672 pb_resource->set_parent_id(3); | 672 pb_resource->set_parent_id(3); |
| 673 pb_resource->set_url(kSecondRedirectURL); | 673 pb_resource->set_url(kSecondRedirectURL); |
| 674 pb_resource = expected.add_resources(); | 674 pb_resource = expected.add_resources(); |
| 675 pb_resource->set_id(3); | 675 pb_resource->set_id(3); |
| 676 pb_resource->set_url(kFirstRedirectURL); | 676 pb_resource->set_url(kFirstRedirectURL); |
| 677 | 677 |
| 678 VerifyResults(actual, expected); | 678 VerifyResults(actual, expected); |
| 679 } | 679 } |
| OLD | NEW |