| 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/http/mock_http_cache.h" | 5 #include "net/http/mock_http_cache.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 void MockDiskEntry::Close() { | 77 void MockDiskEntry::Close() { |
| 78 Release(); | 78 Release(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 std::string MockDiskEntry::GetKey() const { | 81 std::string MockDiskEntry::GetKey() const { |
| 82 return key_; | 82 return key_; |
| 83 } | 83 } |
| 84 | 84 |
| 85 base::Time MockDiskEntry::GetLastUsed() const { | 85 base::Time MockDiskEntry::GetLastUsed() const { |
| 86 return base::Time::FromInternalValue(0); | 86 return base::Time::Now(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 base::Time MockDiskEntry::GetLastModified() const { | 89 base::Time MockDiskEntry::GetLastModified() const { |
| 90 return base::Time::FromInternalValue(0); | 90 return base::Time::Now(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 int32_t MockDiskEntry::GetDataSize(int index) const { | 93 int32_t MockDiskEntry::GetDataSize(int index) const { |
| 94 DCHECK(index >= 0 && index < kNumCacheEntryDataIndices); | 94 DCHECK(index >= 0 && index < kNumCacheEntryDataIndices); |
| 95 return static_cast<int32_t>(data_[index].size()); | 95 return static_cast<int32_t>(data_[index].size()); |
| 96 } | 96 } |
| 97 | 97 |
| 98 int MockDiskEntry::ReadData(int index, | 98 int MockDiskEntry::ReadData(int index, |
| 99 int offset, | 99 int offset, |
| 100 IOBuffer* buf, | 100 IOBuffer* buf, |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 if (!callback_.is_null()) { | 672 if (!callback_.is_null()) { |
| 673 if (!fail_) | 673 if (!fail_) |
| 674 backend_->reset(new MockDiskCache()); | 674 backend_->reset(new MockDiskCache()); |
| 675 CompletionCallback cb = callback_; | 675 CompletionCallback cb = callback_; |
| 676 callback_.Reset(); | 676 callback_.Reset(); |
| 677 cb.Run(Result()); // This object can be deleted here. | 677 cb.Run(Result()); // This object can be deleted here. |
| 678 } | 678 } |
| 679 } | 679 } |
| 680 | 680 |
| 681 } // namespace net | 681 } // namespace net |
| OLD | NEW |