| 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 13 matching lines...) Expand all Loading... |
| 24 ~TestURLRequestContext() override { AssertNoURLRequests(); } | 24 ~TestURLRequestContext() override { AssertNoURLRequests(); } |
| 25 | 25 |
| 26 // Gets a pointer to the cache backend. | 26 // Gets a pointer to the cache backend. |
| 27 disk_cache::Backend* GetBackend(); | 27 disk_cache::Backend* GetBackend(); |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 HttpCache cache_; | 30 HttpCache cache_; |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 TestURLRequestContext::TestURLRequestContext() | 33 TestURLRequestContext::TestURLRequestContext() |
| 34 : cache_(new MockNetworkLayer(), | 34 : cache_(new MockNetworkLayer(), NULL, |
| 35 nullptr, | 35 HttpCache::DefaultBackend::InMemory(0)) { |
| 36 HttpCache::DefaultBackend::InMemory(0), | |
| 37 true) { | |
| 38 set_http_transaction_factory(&cache_); | 36 set_http_transaction_factory(&cache_); |
| 39 } | 37 } |
| 40 | 38 |
| 41 void WriteHeaders(disk_cache::Entry* entry, int flags, | 39 void WriteHeaders(disk_cache::Entry* entry, int flags, |
| 42 const std::string& data) { | 40 const std::string& data) { |
| 43 if (data.empty()) | 41 if (data.empty()) |
| 44 return; | 42 return; |
| 45 | 43 |
| 46 base::Pickle pickle; | 44 base::Pickle pickle; |
| 47 pickle.WriteInt(flags | 1); // Version 1. | 45 pickle.WriteInt(flags | 1); // Version 1. |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 204 |
| 207 std::string data; | 205 std::string data; |
| 208 TestCompletionCallback cb1; | 206 TestCompletionCallback cb1; |
| 209 rv = helper.GetEntryInfoHTML(key, &context, &data, cb1.callback()); | 207 rv = helper.GetEntryInfoHTML(key, &context, &data, cb1.callback()); |
| 210 EXPECT_EQ(OK, cb1.GetResult(rv)); | 208 EXPECT_EQ(OK, cb1.GetResult(rv)); |
| 211 | 209 |
| 212 EXPECT_NE(std::string::npos, data.find("RESPONSE_INFO_TRUNCATED")); | 210 EXPECT_NE(std::string::npos, data.find("RESPONSE_INFO_TRUNCATED")); |
| 213 } | 211 } |
| 214 | 212 |
| 215 } // namespace net | 213 } // namespace net |
| OLD | NEW |