| OLD | NEW |
| 1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2010 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/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/scoped_vector.h" | 9 #include "base/scoped_vector.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 3405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3416 transaction.load_flags |= net::LOAD_ONLY_FROM_CACHE; | 3416 transaction.load_flags |= net::LOAD_ONLY_FROM_CACHE; |
| 3417 | 3417 |
| 3418 MockHttpRequest request(transaction); | 3418 MockHttpRequest request(transaction); |
| 3419 TestCompletionCallback callback; | 3419 TestCompletionCallback callback; |
| 3420 | 3420 |
| 3421 scoped_ptr<net::HttpTransaction> trans; | 3421 scoped_ptr<net::HttpTransaction> trans; |
| 3422 int rv = cache.http_cache()->CreateTransaction(&trans); | 3422 int rv = cache.http_cache()->CreateTransaction(&trans); |
| 3423 EXPECT_EQ(net::OK, rv); | 3423 EXPECT_EQ(net::OK, rv); |
| 3424 ASSERT_TRUE(trans.get()); | 3424 ASSERT_TRUE(trans.get()); |
| 3425 | 3425 |
| 3426 rv = trans->Start(&request, &callback, NULL); | 3426 rv = trans->Start(&request, &callback, net::BoundNetLog()); |
| 3427 if (rv == net::ERR_IO_PENDING) | 3427 if (rv == net::ERR_IO_PENDING) |
| 3428 rv = callback.WaitForResult(); | 3428 rv = callback.WaitForResult(); |
| 3429 ASSERT_EQ(net::ERR_CACHE_MISS, rv); | 3429 ASSERT_EQ(net::ERR_CACHE_MISS, rv); |
| 3430 | 3430 |
| 3431 trans.reset(); | 3431 trans.reset(); |
| 3432 | 3432 |
| 3433 EXPECT_EQ(1, cache.network_layer()->transaction_count()); | 3433 EXPECT_EQ(1, cache.network_layer()->transaction_count()); |
| 3434 EXPECT_EQ(1, cache.disk_cache()->open_count()); | 3434 EXPECT_EQ(1, cache.disk_cache()->open_count()); |
| 3435 EXPECT_EQ(1, cache.disk_cache()->create_count()); | 3435 EXPECT_EQ(1, cache.disk_cache()->create_count()); |
| 3436 | 3436 |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4335 // Now return 200 when validating the entry so the metadata will be lost. | 4335 // Now return 200 when validating the entry so the metadata will be lost. |
| 4336 MockTransaction trans2(kTypicalGET_Transaction); | 4336 MockTransaction trans2(kTypicalGET_Transaction); |
| 4337 trans2.load_flags = net::LOAD_VALIDATE_CACHE; | 4337 trans2.load_flags = net::LOAD_VALIDATE_CACHE; |
| 4338 RunTransactionTestWithResponseInfo(cache.http_cache(), trans2, &response); | 4338 RunTransactionTestWithResponseInfo(cache.http_cache(), trans2, &response); |
| 4339 EXPECT_TRUE(response.metadata.get() == NULL); | 4339 EXPECT_TRUE(response.metadata.get() == NULL); |
| 4340 | 4340 |
| 4341 EXPECT_EQ(3, cache.network_layer()->transaction_count()); | 4341 EXPECT_EQ(3, cache.network_layer()->transaction_count()); |
| 4342 EXPECT_EQ(4, cache.disk_cache()->open_count()); | 4342 EXPECT_EQ(4, cache.disk_cache()->open_count()); |
| 4343 EXPECT_EQ(1, cache.disk_cache()->create_count()); | 4343 EXPECT_EQ(1, cache.disk_cache()->create_count()); |
| 4344 } | 4344 } |
| OLD | NEW |