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" |
11 #include "net/http/http_cache.h" | 11 #include "net/http/http_cache.h" |
12 #include "net/http/http_transaction_test_util.h" | 12 #include "net/http/http_transaction_test_util.h" |
13 #include "net/url_request/url_request_context.h" | 13 #include "net/url_request/url_request_context.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 class TestURLRequestContext : public URLRequestContext { | 20 class TestURLRequestContext : public URLRequestContext { |
21 public: | 21 public: |
22 TestURLRequestContext(); | 22 TestURLRequestContext(); |
23 | 23 |
24 virtual ~TestURLRequestContext() { | 24 ~TestURLRequestContext() override { AssertNoURLRequests(); } |
25 AssertNoURLRequests(); | |
26 } | |
27 | 25 |
28 // Gets a pointer to the cache backend. | 26 // Gets a pointer to the cache backend. |
29 disk_cache::Backend* GetBackend(); | 27 disk_cache::Backend* GetBackend(); |
30 | 28 |
31 private: | 29 private: |
32 HttpCache cache_; | 30 HttpCache cache_; |
33 }; | 31 }; |
34 | 32 |
35 TestURLRequestContext::TestURLRequestContext() | 33 TestURLRequestContext::TestURLRequestContext() |
36 : cache_(new MockNetworkLayer(), NULL, | 34 : cache_(new MockNetworkLayer(), NULL, |
(...skipping 169 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 |