| 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 "net/url_request/view_cache_helper.h" | 5 #include "net/url_request/view_cache_helper.h" |
| 6 | 6 |
| 7 #include "base/pickle.h" | 7 #include "base/pickle.h" |
| 8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
| 9 #include "net/base/test_completion_callback.h" | 9 #include "net/base/test_completion_callback.h" |
| 10 #include "net/disk_cache/disk_cache.h" | 10 #include "net/disk_cache/disk_cache.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 : cache_(new MockNetworkLayer(), NULL, | 34 : cache_(new MockNetworkLayer(), NULL, |
| 35 HttpCache::DefaultBackend::InMemory(0)) { | 35 HttpCache::DefaultBackend::InMemory(0)) { |
| 36 set_http_transaction_factory(&cache_); | 36 set_http_transaction_factory(&cache_); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void WriteHeaders(disk_cache::Entry* entry, int flags, | 39 void WriteHeaders(disk_cache::Entry* entry, int flags, |
| 40 const std::string& data) { | 40 const std::string& data) { |
| 41 if (data.empty()) | 41 if (data.empty()) |
| 42 return; | 42 return; |
| 43 | 43 |
| 44 Pickle pickle; | 44 base::Pickle pickle; |
| 45 pickle.WriteInt(flags | 1); // Version 1. | 45 pickle.WriteInt(flags | 1); // Version 1. |
| 46 pickle.WriteInt64(0); | 46 pickle.WriteInt64(0); |
| 47 pickle.WriteInt64(0); | 47 pickle.WriteInt64(0); |
| 48 pickle.WriteString(data); | 48 pickle.WriteString(data); |
| 49 | 49 |
| 50 scoped_refptr<WrappedIOBuffer> buf(new WrappedIOBuffer( | 50 scoped_refptr<WrappedIOBuffer> buf(new WrappedIOBuffer( |
| 51 reinterpret_cast<const char*>(pickle.data()))); | 51 reinterpret_cast<const char*>(pickle.data()))); |
| 52 int len = static_cast<int>(pickle.size()); | 52 int len = static_cast<int>(pickle.size()); |
| 53 | 53 |
| 54 TestCompletionCallback cb; | 54 TestCompletionCallback cb; |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 std::string data; | 205 std::string data; |
| 206 TestCompletionCallback cb1; | 206 TestCompletionCallback cb1; |
| 207 rv = helper.GetEntryInfoHTML(key, &context, &data, cb1.callback()); | 207 rv = helper.GetEntryInfoHTML(key, &context, &data, cb1.callback()); |
| 208 EXPECT_EQ(OK, cb1.GetResult(rv)); | 208 EXPECT_EQ(OK, cb1.GetResult(rv)); |
| 209 | 209 |
| 210 EXPECT_NE(std::string::npos, data.find("RESPONSE_INFO_TRUNCATED")); | 210 EXPECT_NE(std::string::npos, data.find("RESPONSE_INFO_TRUNCATED")); |
| 211 } | 211 } |
| 212 | 212 |
| 213 } // namespace net | 213 } // namespace net |
| OLD | NEW |