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