| 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/http/http_cache.h" | 5 #include "net/http/http_cache.h" |
| 6 | 6 |
| 7 #include "base/hash_tables.h" | 7 #include "base/hash_tables.h" |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 2243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2254 EXPECT_EQ(1, cache.network_layer()->transaction_count()); | 2254 EXPECT_EQ(1, cache.network_layer()->transaction_count()); |
| 2255 EXPECT_EQ(0, cache.disk_cache()->open_count()); | 2255 EXPECT_EQ(0, cache.disk_cache()->open_count()); |
| 2256 EXPECT_EQ(1, cache.disk_cache()->create_count()); | 2256 EXPECT_EQ(1, cache.disk_cache()->create_count()); |
| 2257 | 2257 |
| 2258 // Get the same URL again, but use a byte range request. | 2258 // Get the same URL again, but use a byte range request. |
| 2259 transaction.load_flags = net::LOAD_VALIDATE_CACHE; | 2259 transaction.load_flags = net::LOAD_VALIDATE_CACHE; |
| 2260 transaction.handler = ETagGet_UnconditionalRequest_Handler; | 2260 transaction.handler = ETagGet_UnconditionalRequest_Handler; |
| 2261 transaction.request_headers = "Range: bytes = 5-"; | 2261 transaction.request_headers = "Range: bytes = 5-"; |
| 2262 RunTransactionTest(cache.http_cache(), transaction); | 2262 RunTransactionTest(cache.http_cache(), transaction); |
| 2263 | 2263 |
| 2264 EXPECT_EQ(3, cache.network_layer()->transaction_count()); | 2264 EXPECT_EQ(2, cache.network_layer()->transaction_count()); |
| 2265 EXPECT_EQ(1, cache.disk_cache()->open_count()); | 2265 EXPECT_EQ(1, cache.disk_cache()->open_count()); |
| 2266 EXPECT_EQ(2, cache.disk_cache()->create_count()); | 2266 EXPECT_EQ(2, cache.disk_cache()->create_count()); |
| 2267 } | 2267 } |
| 2268 | 2268 |
| 2269 static void ETagGet_ConditionalRequest_NoStore_Handler( | 2269 static void ETagGet_ConditionalRequest_NoStore_Handler( |
| 2270 const net::HttpRequestInfo* request, | 2270 const net::HttpRequestInfo* request, |
| 2271 std::string* response_status, | 2271 std::string* response_status, |
| 2272 std::string* response_headers, | 2272 std::string* response_headers, |
| 2273 std::string* response_data) { | 2273 std::string* response_data) { |
| 2274 EXPECT_TRUE( | 2274 EXPECT_TRUE( |
| (...skipping 2817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5092 // Now return 200 when validating the entry so the metadata will be lost. | 5092 // Now return 200 when validating the entry so the metadata will be lost. |
| 5093 MockTransaction trans2(kTypicalGET_Transaction); | 5093 MockTransaction trans2(kTypicalGET_Transaction); |
| 5094 trans2.load_flags = net::LOAD_VALIDATE_CACHE; | 5094 trans2.load_flags = net::LOAD_VALIDATE_CACHE; |
| 5095 RunTransactionTestWithResponseInfo(cache.http_cache(), trans2, &response); | 5095 RunTransactionTestWithResponseInfo(cache.http_cache(), trans2, &response); |
| 5096 EXPECT_TRUE(response.metadata.get() == NULL); | 5096 EXPECT_TRUE(response.metadata.get() == NULL); |
| 5097 | 5097 |
| 5098 EXPECT_EQ(3, cache.network_layer()->transaction_count()); | 5098 EXPECT_EQ(3, cache.network_layer()->transaction_count()); |
| 5099 EXPECT_EQ(4, cache.disk_cache()->open_count()); | 5099 EXPECT_EQ(4, cache.disk_cache()->open_count()); |
| 5100 EXPECT_EQ(1, cache.disk_cache()->create_count()); | 5100 EXPECT_EQ(1, cache.disk_cache()->create_count()); |
| 5101 } | 5101 } |
| OLD | NEW |