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

Side by Side Diff: webkit/browser/fileapi/native_file_util_unittest.cc

Issue 101143006: Convert base::file_util to use File instead of PlatformFile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove base:: Created 6 years, 11 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <set> 5 #include <set>
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/platform_file.h" 10 #include "base/platform_file.h"
(...skipping 18 matching lines...) Expand all
29 base::FilePath Path(const char* file_name) { 29 base::FilePath Path(const char* file_name) {
30 return data_dir_.path().AppendASCII(file_name); 30 return data_dir_.path().AppendASCII(file_name);
31 } 31 }
32 32
33 bool FileExists(const base::FilePath& path) { 33 bool FileExists(const base::FilePath& path) {
34 return base::PathExists(path) && 34 return base::PathExists(path) &&
35 !base::DirectoryExists(path); 35 !base::DirectoryExists(path);
36 } 36 }
37 37
38 int64 GetSize(const base::FilePath& path) { 38 int64 GetSize(const base::FilePath& path) {
39 base::PlatformFileInfo info; 39 base::File::Info info;
40 base::GetFileInfo(path, &info); 40 base::GetFileInfo(path, &info);
41 return info.size; 41 return info.size;
42 } 42 }
43 43
44 private: 44 private:
45 base::ScopedTempDir data_dir_; 45 base::ScopedTempDir data_dir_;
46 46
47 DISALLOW_COPY_AND_ASSIGN(NativeFileUtilTest); 47 DISALLOW_COPY_AND_ASSIGN(NativeFileUtilTest);
48 }; 48 };
49 49
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 base::FilePath file_name = Path("test_file"); 118 base::FilePath file_name = Path("test_file");
119 base::PlatformFileInfo native_info; 119 base::PlatformFileInfo native_info;
120 ASSERT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, 120 ASSERT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
121 NativeFileUtil::GetFileInfo(file_name, &native_info)); 121 NativeFileUtil::GetFileInfo(file_name, &native_info));
122 122
123 bool created = false; 123 bool created = false;
124 ASSERT_EQ(base::PLATFORM_FILE_OK, 124 ASSERT_EQ(base::PLATFORM_FILE_OK,
125 NativeFileUtil::EnsureFileExists(file_name, &created)); 125 NativeFileUtil::EnsureFileExists(file_name, &created));
126 ASSERT_TRUE(created); 126 ASSERT_TRUE(created);
127 127
128 base::PlatformFileInfo info; 128 base::File::Info info;
129 ASSERT_TRUE(base::GetFileInfo(file_name, &info)); 129 ASSERT_TRUE(base::GetFileInfo(file_name, &info));
130 ASSERT_EQ(base::PLATFORM_FILE_OK, 130 ASSERT_EQ(base::PLATFORM_FILE_OK,
131 NativeFileUtil::GetFileInfo(file_name, &native_info)); 131 NativeFileUtil::GetFileInfo(file_name, &native_info));
132 ASSERT_EQ(info.size, native_info.size); 132 ASSERT_EQ(info.size, native_info.size);
133 ASSERT_EQ(info.is_directory, native_info.is_directory); 133 ASSERT_EQ(info.is_directory, native_info.is_directory);
134 ASSERT_EQ(info.is_symbolic_link, native_info.is_symbolic_link); 134 ASSERT_EQ(info.is_symbolic_link, native_info.is_symbolic_link);
135 ASSERT_EQ(info.last_modified, native_info.last_modified); 135 ASSERT_EQ(info.last_modified, native_info.last_modified);
136 ASSERT_EQ(info.last_accessed, native_info.last_accessed); 136 ASSERT_EQ(info.last_accessed, native_info.last_accessed);
137 ASSERT_EQ(info.creation_time, native_info.creation_time); 137 ASSERT_EQ(info.creation_time, native_info.creation_time);
138 138
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 FileSystemOperation::OPTION_PRESERVE_LAST_MODIFIED, 403 FileSystemOperation::OPTION_PRESERVE_LAST_MODIFIED,
404 NativeFileUtil::MOVE)); 404 NativeFileUtil::MOVE));
405 405
406 ASSERT_TRUE(FileExists(to_file3)); 406 ASSERT_TRUE(FileExists(to_file3));
407 ASSERT_EQ(base::PLATFORM_FILE_OK, 407 ASSERT_EQ(base::PLATFORM_FILE_OK,
408 NativeFileUtil::GetFileInfo(to_file2, &file_info2)); 408 NativeFileUtil::GetFileInfo(to_file2, &file_info2));
409 EXPECT_EQ(file_info1.last_modified, file_info2.last_modified); 409 EXPECT_EQ(file_info1.last_modified, file_info2.last_modified);
410 } 410 }
411 411
412 } // namespace fileapi 412 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/native_file_util.cc ('k') | webkit/browser/fileapi/obfuscated_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698