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

Side by Side Diff: content/browser/fileapi/file_system_operation_impl_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "webkit/browser/fileapi/file_system_operation_impl.h" 5 #include "webkit/browser/fileapi/file_system_operation_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 FileSystemURL CreateDirectory(const std::string& path) { 152 FileSystemURL CreateDirectory(const std::string& path) {
153 FileSystemURL url = URLForPath(path); 153 FileSystemURL url = URLForPath(path);
154 EXPECT_EQ(base::PLATFORM_FILE_OK, 154 EXPECT_EQ(base::PLATFORM_FILE_OK,
155 file_util()->CreateDirectory(NewContext().get(), url, 155 file_util()->CreateDirectory(NewContext().get(), url,
156 false /* exclusive */, true)); 156 false /* exclusive */, true));
157 return url; 157 return url;
158 } 158 }
159 159
160 int64 GetFileSize(const std::string& path) { 160 int64 GetFileSize(const std::string& path) {
161 base::PlatformFileInfo info; 161 base::File::Info info;
162 EXPECT_TRUE(base::GetFileInfo(PlatformPath(path), &info)); 162 EXPECT_TRUE(base::GetFileInfo(PlatformPath(path), &info));
163 return info.size; 163 return info.size;
164 } 164 }
165 165
166 // Callbacks for recording test results. 166 // Callbacks for recording test results.
167 FileSystemOperation::StatusCallback RecordStatusCallback() { 167 FileSystemOperation::StatusCallback RecordStatusCallback() {
168 return base::Bind(&FileSystemOperationImplTest::DidFinish, 168 return base::Bind(&FileSystemOperationImplTest::DidFinish,
169 weak_factory_.GetWeakPtr()); 169 weak_factory_.GetWeakPtr());
170 } 170 }
171 171
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status()); 1099 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status());
1100 EXPECT_TRUE(change_observer()->HasNoChange()); 1100 EXPECT_TRUE(change_observer()->HasNoChange());
1101 1101
1102 EXPECT_EQ(10, GetFileSize("dir/file")); 1102 EXPECT_EQ(10, GetFileSize("dir/file"));
1103 } 1103 }
1104 1104
1105 TEST_F(FileSystemOperationImplTest, TestTouchFile) { 1105 TEST_F(FileSystemOperationImplTest, TestTouchFile) {
1106 FileSystemURL file(CreateFile("file")); 1106 FileSystemURL file(CreateFile("file"));
1107 base::FilePath platform_path = PlatformPath("file"); 1107 base::FilePath platform_path = PlatformPath("file");
1108 1108
1109 base::PlatformFileInfo info; 1109 base::File::Info info;
1110 EXPECT_TRUE(base::GetFileInfo(platform_path, &info)); 1110 EXPECT_TRUE(base::GetFileInfo(platform_path, &info));
1111 EXPECT_FALSE(info.is_directory); 1111 EXPECT_FALSE(info.is_directory);
1112 EXPECT_EQ(0, info.size); 1112 EXPECT_EQ(0, info.size);
1113 const base::Time last_modified = info.last_modified; 1113 const base::Time last_modified = info.last_modified;
1114 const base::Time last_accessed = info.last_accessed; 1114 const base::Time last_accessed = info.last_accessed;
1115 1115
1116 const base::Time new_modified_time = base::Time::UnixEpoch(); 1116 const base::Time new_modified_time = base::Time::UnixEpoch();
1117 const base::Time new_accessed_time = new_modified_time + 1117 const base::Time new_accessed_time = new_modified_time +
1118 base::TimeDelta::FromHours(77); 1118 base::TimeDelta::FromHours(77);
1119 ASSERT_NE(last_modified, new_modified_time); 1119 ASSERT_NE(last_modified, new_modified_time);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 base::RunLoop().RunUntilIdle(); 1274 base::RunLoop().RunUntilIdle();
1275 1275
1276 expected_usage += grandchild_file_size + grandchild_path_cost; 1276 expected_usage += grandchild_file_size + grandchild_path_cost;
1277 usage = GetUsage(); 1277 usage = GetUsage();
1278 EXPECT_EQ(2 * child_file_size + 3 * grandchild_file_size, 1278 EXPECT_EQ(2 * child_file_size + 3 * grandchild_file_size,
1279 GetDataSizeOnDisk()); 1279 GetDataSizeOnDisk());
1280 EXPECT_EQ(expected_usage, usage); 1280 EXPECT_EQ(expected_usage, usage);
1281 } 1281 }
1282 1282
1283 } // namespace fileapi 1283 } // namespace fileapi
OLDNEW
« no previous file with comments | « content/browser/fileapi/dragged_file_util_unittest.cc ('k') | content/browser/fileapi/local_file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698