OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/string_util.h" | 9 #include "base/string_util.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
11 #include "net/base/load_flags.h" | 11 #include "net/base/load_flags.h" |
12 #include "net/disk_cache/disk_cache.h" | 12 #include "net/disk_cache/disk_cache.h" |
13 #include "net/http/http_request_info.h" | 13 #include "net/http/http_request_info.h" |
14 #include "net/http/http_response_info.h" | 14 #include "net/http/http_response_info.h" |
15 #include "net/http/http_transaction.h" | 15 #include "net/http/http_transaction.h" |
16 #include "net/http/http_transaction_unittest.h" | 16 #include "net/http/http_transaction_unittest.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 | 18 |
| 19 using base::Time; |
| 20 |
19 namespace { | 21 namespace { |
20 | 22 |
21 //----------------------------------------------------------------------------- | 23 //----------------------------------------------------------------------------- |
22 // mock disk cache (a very basic memory cache implementation) | 24 // mock disk cache (a very basic memory cache implementation) |
23 | 25 |
24 class MockDiskEntry : public disk_cache::Entry, | 26 class MockDiskEntry : public disk_cache::Entry, |
25 public base::RefCounted<MockDiskEntry> { | 27 public base::RefCounted<MockDiskEntry> { |
26 public: | 28 public: |
27 MockDiskEntry() : test_mode_(0), doomed_(false) { | 29 MockDiskEntry() : test_mode_(0), doomed_(false) { |
28 } | 30 } |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 | 963 |
962 scoped_ptr<net::HttpTransaction> trans( | 964 scoped_ptr<net::HttpTransaction> trans( |
963 cache.http_cache()->CreateTransaction()); | 965 cache.http_cache()->CreateTransaction()); |
964 ASSERT_TRUE(trans.get()); | 966 ASSERT_TRUE(trans.get()); |
965 | 967 |
966 int rv = trans->Start(&request, &callback); | 968 int rv = trans->Start(&request, &callback); |
967 if (rv == net::ERR_IO_PENDING) | 969 if (rv == net::ERR_IO_PENDING) |
968 rv = callback.WaitForResult(); | 970 rv = callback.WaitForResult(); |
969 ASSERT_EQ(net::ERR_CACHE_MISS, rv); | 971 ASSERT_EQ(net::ERR_CACHE_MISS, rv); |
970 } | 972 } |
OLD | NEW |