| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
| 7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
| 8 #include "base/port.h" | 8 #include "base/port.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 3126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3137 cache_->OnExternalCacheHit("key0"); | 3137 cache_->OnExternalCacheHit("key0"); |
| 3138 | 3138 |
| 3139 TrimForTest(false); | 3139 TrimForTest(false); |
| 3140 | 3140 |
| 3141 // Make sure the older key remains. | 3141 // Make sure the older key remains. |
| 3142 EXPECT_EQ(1, cache_->GetEntryCount()); | 3142 EXPECT_EQ(1, cache_->GetEntryCount()); |
| 3143 ASSERT_EQ(net::OK, OpenEntry("key0", &entry)); | 3143 ASSERT_EQ(net::OK, OpenEntry("key0", &entry)); |
| 3144 entry->Close(); | 3144 entry->Close(); |
| 3145 } | 3145 } |
| 3146 | 3146 |
| 3147 // The Simple Cache backend requires a few guarantees from the filesystem like | |
| 3148 // atomic renaming of recently open files. Those guarantees are not provided in | |
| 3149 // general on Windows. | |
| 3150 #if defined(OS_POSIX) | |
| 3151 | |
| 3152 TEST_F(DiskCacheBackendTest, SimpleCacheShutdownWithPendingCreate) { | 3147 TEST_F(DiskCacheBackendTest, SimpleCacheShutdownWithPendingCreate) { |
| 3153 SetCacheType(net::APP_CACHE); | 3148 SetCacheType(net::APP_CACHE); |
| 3154 SetSimpleCacheMode(); | 3149 SetSimpleCacheMode(); |
| 3155 BackendShutdownWithPendingCreate(false); | 3150 BackendShutdownWithPendingCreate(false); |
| 3156 } | 3151 } |
| 3157 | 3152 |
| 3158 TEST_F(DiskCacheBackendTest, SimpleCacheShutdownWithPendingFileIO) { | 3153 TEST_F(DiskCacheBackendTest, SimpleCacheShutdownWithPendingFileIO) { |
| 3159 SetCacheType(net::APP_CACHE); | 3154 SetCacheType(net::APP_CACHE); |
| 3160 SetSimpleCacheMode(); | 3155 SetSimpleCacheMode(); |
| 3161 BackendShutdownWithPendingFileIO(false); | 3156 BackendShutdownWithPendingFileIO(false); |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3479 | 3474 |
| 3480 scoped_ptr<TestIterator> iter = CreateIterator(); | 3475 scoped_ptr<TestIterator> iter = CreateIterator(); |
| 3481 disk_cache::Entry* entry = NULL; | 3476 disk_cache::Entry* entry = NULL; |
| 3482 ASSERT_EQ(net::OK, iter->OpenNextEntry(&entry)); | 3477 ASSERT_EQ(net::OK, iter->OpenNextEntry(&entry)); |
| 3483 EXPECT_TRUE(entry); | 3478 EXPECT_TRUE(entry); |
| 3484 disk_cache::ScopedEntryPtr entry_closer(entry); | 3479 disk_cache::ScopedEntryPtr entry_closer(entry); |
| 3485 | 3480 |
| 3486 cache_.reset(); | 3481 cache_.reset(); |
| 3487 // This test passes if we don't leak memory. | 3482 // This test passes if we don't leak memory. |
| 3488 } | 3483 } |
| 3489 | |
| 3490 #endif // defined(OS_POSIX) | |
| OLD | NEW |