| 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/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/pickle.h" | 8 #include "base/pickle.h" |
| 9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 10 #include "net/base/test_completion_callback.h" | 10 #include "net/base/test_completion_callback.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // Gets a pointer to the cache backend. | 31 // Gets a pointer to the cache backend. |
| 32 disk_cache::Backend* GetBackend(); | 32 disk_cache::Backend* GetBackend(); |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 HttpCache cache_; | 35 HttpCache cache_; |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 TestURLRequestContext::TestURLRequestContext() | 38 TestURLRequestContext::TestURLRequestContext() |
| 39 : cache_(base::MakeUnique<MockNetworkLayer>(), | 39 : cache_(base::MakeUnique<MockNetworkLayer>(), |
| 40 HttpCache::DefaultBackend::InMemory(0), | 40 HttpCache::DefaultBackend::InMemory(0), |
| 41 true) { | 41 false /* set_up_quic_server_info */) { |
| 42 set_http_transaction_factory(&cache_); | 42 set_http_transaction_factory(&cache_); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void WriteHeaders(disk_cache::Entry* entry, int flags, | 45 void WriteHeaders(disk_cache::Entry* entry, int flags, |
| 46 const std::string& data) { | 46 const std::string& data) { |
| 47 if (data.empty()) | 47 if (data.empty()) |
| 48 return; | 48 return; |
| 49 | 49 |
| 50 base::Pickle pickle; | 50 base::Pickle pickle; |
| 51 pickle.WriteInt(flags | 1); // Version 1. | 51 pickle.WriteInt(flags | 1); // Version 1. |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 210 |
| 211 std::string data; | 211 std::string data; |
| 212 TestCompletionCallback cb1; | 212 TestCompletionCallback cb1; |
| 213 rv = helper.GetEntryInfoHTML(key, &context, &data, cb1.callback()); | 213 rv = helper.GetEntryInfoHTML(key, &context, &data, cb1.callback()); |
| 214 EXPECT_THAT(cb1.GetResult(rv), IsOk()); | 214 EXPECT_THAT(cb1.GetResult(rv), IsOk()); |
| 215 | 215 |
| 216 EXPECT_NE(std::string::npos, data.find("RESPONSE_INFO_TRUNCATED")); | 216 EXPECT_NE(std::string::npos, data.find("RESPONSE_INFO_TRUNCATED")); |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace net | 219 } // namespace net |
| OLD | NEW |