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/bind.h" | 6 #include "base/bind.h" |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.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 2995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3006 | 3006 |
3007 entry->Close(); | 3007 entry->Close(); |
3008 | 3008 |
3009 // Finish running the pending tasks so that we fully complete the close | 3009 // Finish running the pending tasks so that we fully complete the close |
3010 // operation and destroy the entry object. | 3010 // operation and destroy the entry object. |
3011 base::MessageLoop::current()->RunUntilIdle(); | 3011 base::MessageLoop::current()->RunUntilIdle(); |
3012 | 3012 |
3013 for (int i = 0; i < disk_cache::kSimpleEntryFileCount; ++i) { | 3013 for (int i = 0; i < disk_cache::kSimpleEntryFileCount; ++i) { |
3014 base::FilePath entry_file_path = cache_path_.AppendASCII( | 3014 base::FilePath entry_file_path = cache_path_.AppendASCII( |
3015 disk_cache::simple_util::GetFilenameFromKeyAndFileIndex(key, i)); | 3015 disk_cache::simple_util::GetFilenameFromKeyAndFileIndex(key, i)); |
3016 base::PlatformFileInfo info; | 3016 base::File::Info info; |
3017 EXPECT_FALSE(base::GetFileInfo(entry_file_path, &info)); | 3017 EXPECT_FALSE(base::GetFileInfo(entry_file_path, &info)); |
3018 } | 3018 } |
3019 } | 3019 } |
3020 | 3020 |
3021 TEST_F(DiskCacheEntryTest, SimpleCacheDoomCreateRace) { | 3021 TEST_F(DiskCacheEntryTest, SimpleCacheDoomCreateRace) { |
3022 // This test runs as APP_CACHE to make operations more synchronous. Test | 3022 // This test runs as APP_CACHE to make operations more synchronous. Test |
3023 // sequence: | 3023 // sequence: |
3024 // Create, Doom, Create. | 3024 // Create, Doom, Create. |
3025 SetCacheType(net::APP_CACHE); | 3025 SetCacheType(net::APP_CACHE); |
3026 SetSimpleCacheMode(); | 3026 SetSimpleCacheMode(); |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3892 EXPECT_EQ(kSize, callback.GetResult(ret)); | 3892 EXPECT_EQ(kSize, callback.GetResult(ret)); |
3893 | 3893 |
3894 // Make sure the first range was removed when the second was written. | 3894 // Make sure the first range was removed when the second was written. |
3895 ret = entry->ReadSparseData(0, buffer, kSize, callback.callback()); | 3895 ret = entry->ReadSparseData(0, buffer, kSize, callback.callback()); |
3896 EXPECT_EQ(0, callback.GetResult(ret)); | 3896 EXPECT_EQ(0, callback.GetResult(ret)); |
3897 | 3897 |
3898 entry->Close(); | 3898 entry->Close(); |
3899 } | 3899 } |
3900 | 3900 |
3901 #endif // defined(OS_POSIX) | 3901 #endif // defined(OS_POSIX) |
OLD | NEW |