| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
| 11 #include "net/http/http_cache.h" | 11 #include "net/http/http_cache.h" |
| 12 #include "net/url_request/url_request_context.h" | 12 #include "net/url_request/url_request_context.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 class TestURLRequestContext : public URLRequestContext { | 19 class TestURLRequestContext : public URLRequestContext { |
| 20 public: | 20 public: |
| 21 TestURLRequestContext(); | 21 TestURLRequestContext(); |
| 22 | 22 |
| 23 // Gets a pointer to the cache backend. | 23 // Gets a pointer to the cache backend. |
| 24 disk_cache::Backend* GetBackend(); | 24 disk_cache::Backend* GetBackend(); |
| 25 | 25 |
| 26 protected: |
| 27 virtual ~TestURLRequestContext() {} |
| 28 |
| 26 private: | 29 private: |
| 27 HttpCache cache_; | 30 HttpCache cache_; |
| 28 }; | 31 }; |
| 29 | 32 |
| 30 TestURLRequestContext::TestURLRequestContext() | 33 TestURLRequestContext::TestURLRequestContext() |
| 31 : cache_(reinterpret_cast<HttpTransactionFactory*>(NULL), NULL, | 34 : cache_(reinterpret_cast<HttpTransactionFactory*>(NULL), NULL, |
| 32 HttpCache::DefaultBackend::InMemory(0)) { | 35 HttpCache::DefaultBackend::InMemory(0)) { |
| 33 set_http_transaction_factory(&cache_); | 36 set_http_transaction_factory(&cache_); |
| 34 } | 37 } |
| 35 | 38 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 203 |
| 201 std::string data; | 204 std::string data; |
| 202 TestCompletionCallback cb1; | 205 TestCompletionCallback cb1; |
| 203 rv = helper.GetEntryInfoHTML(key, context, &data, cb1.callback()); | 206 rv = helper.GetEntryInfoHTML(key, context, &data, cb1.callback()); |
| 204 EXPECT_EQ(OK, cb1.GetResult(rv)); | 207 EXPECT_EQ(OK, cb1.GetResult(rv)); |
| 205 | 208 |
| 206 EXPECT_NE(std::string::npos, data.find("RESPONSE_INFO_TRUNCATED")); | 209 EXPECT_NE(std::string::npos, data.find("RESPONSE_INFO_TRUNCATED")); |
| 207 } | 210 } |
| 208 | 211 |
| 209 } // namespace net | 212 } // namespace net |
| OLD | NEW |