Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: net/disk_cache/backend_unittest.cc

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/ffmpeg/ffmpeg_unittest.cc ('k') | net/disk_cache/cache_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/file_util.h" 6 #include "base/file_util.h"
7 #include "base/port.h" 7 #include "base/port.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" 10 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
(...skipping 2936 matching lines...) Expand 10 before | Expand all | Expand 10 after
2947 // To make sure the file creation completed we need to call open again so that 2947 // To make sure the file creation completed we need to call open again so that
2948 // we block until it actually created the files. 2948 // we block until it actually created the files.
2949 ASSERT_EQ(net::OK, OpenEntry(key, &entry)); 2949 ASSERT_EQ(net::OK, OpenEntry(key, &entry));
2950 ASSERT_TRUE(entry != NULL); 2950 ASSERT_TRUE(entry != NULL);
2951 entry->Close(); 2951 entry->Close();
2952 entry = NULL; 2952 entry = NULL;
2953 2953
2954 // Delete one of the files in the entry. 2954 // Delete one of the files in the entry.
2955 base::FilePath to_delete_file = cache_path_.AppendASCII( 2955 base::FilePath to_delete_file = cache_path_.AppendASCII(
2956 disk_cache::simple_util::GetFilenameFromKeyAndIndex(key, 0)); 2956 disk_cache::simple_util::GetFilenameFromKeyAndIndex(key, 0));
2957 EXPECT_TRUE(file_util::PathExists(to_delete_file)); 2957 EXPECT_TRUE(base::PathExists(to_delete_file));
2958 EXPECT_TRUE(disk_cache::DeleteCacheFile(to_delete_file)); 2958 EXPECT_TRUE(disk_cache::DeleteCacheFile(to_delete_file));
2959 2959
2960 // Failing to open the entry should delete the rest of these files. 2960 // Failing to open the entry should delete the rest of these files.
2961 ASSERT_EQ(net::ERR_FAILED, OpenEntry(key, &entry)); 2961 ASSERT_EQ(net::ERR_FAILED, OpenEntry(key, &entry));
2962 2962
2963 // Confirm the rest of the files are gone. 2963 // Confirm the rest of the files are gone.
2964 for (int i = 1; i < disk_cache::kSimpleEntryFileCount; ++i) { 2964 for (int i = 1; i < disk_cache::kSimpleEntryFileCount; ++i) {
2965 base::FilePath 2965 base::FilePath
2966 should_be_gone_file(cache_path_.AppendASCII( 2966 should_be_gone_file(cache_path_.AppendASCII(
2967 disk_cache::simple_util::GetFilenameFromKeyAndIndex(key, i))); 2967 disk_cache::simple_util::GetFilenameFromKeyAndIndex(key, i)));
2968 EXPECT_FALSE(file_util::PathExists(should_be_gone_file)); 2968 EXPECT_FALSE(base::PathExists(should_be_gone_file));
2969 } 2969 }
2970 } 2970 }
2971 2971
2972 TEST_F(DiskCacheBackendTest, SimpleCacheOpenBadFile) { 2972 TEST_F(DiskCacheBackendTest, SimpleCacheOpenBadFile) {
2973 SetSimpleCacheMode(); 2973 SetSimpleCacheMode();
2974 InitCache(); 2974 InitCache();
2975 2975
2976 const char* key = "the first key"; 2976 const char* key = "the first key";
2977 disk_cache::Entry* entry = NULL; 2977 disk_cache::Entry* entry = NULL;
2978 2978
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
3063 delete cache; 3063 delete cache;
3064 DisableIntegrityCheck(); 3064 DisableIntegrityCheck();
3065 } 3065 }
3066 3066
3067 TEST_F(DiskCacheBackendTest, SimpleCacheFixEnumerators) { 3067 TEST_F(DiskCacheBackendTest, SimpleCacheFixEnumerators) {
3068 SetSimpleCacheMode(); 3068 SetSimpleCacheMode();
3069 BackendFixEnumerators(); 3069 BackendFixEnumerators();
3070 } 3070 }
3071 3071
3072 #endif // !defined(OS_WIN) 3072 #endif // !defined(OS_WIN)
OLDNEW
« no previous file with comments | « media/ffmpeg/ffmpeg_unittest.cc ('k') | net/disk_cache/cache_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698