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

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

Issue 19052005: Move PathIsWritable, DirectoryExists, ContentsEqual, and TextContentsEqual to the 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 | « webkit/browser/fileapi/dump_file_system.cc ('k') | webkit/browser/fileapi/native_file_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 <string> 5 #include <string>
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/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 base::FilePath LocalPath(const char *file_name) { 69 base::FilePath LocalPath(const char *file_name) {
70 base::FilePath path; 70 base::FilePath path;
71 scoped_ptr<FileSystemOperationContext> context(NewContext()); 71 scoped_ptr<FileSystemOperationContext> context(NewContext());
72 file_util()->GetLocalFilePath(context.get(), CreateURL(file_name), &path); 72 file_util()->GetLocalFilePath(context.get(), CreateURL(file_name), &path);
73 return path; 73 return path;
74 } 74 }
75 75
76 bool FileExists(const char *file_name) { 76 bool FileExists(const char *file_name) {
77 return base::PathExists(LocalPath(file_name)) && 77 return base::PathExists(LocalPath(file_name)) &&
78 !file_util::DirectoryExists(LocalPath(file_name)); 78 !base::DirectoryExists(LocalPath(file_name));
79 } 79 }
80 80
81 bool DirectoryExists(const char *file_name) { 81 bool DirectoryExists(const char *file_name) {
82 return file_util::DirectoryExists(LocalPath(file_name)); 82 return base::DirectoryExists(LocalPath(file_name));
83 } 83 }
84 84
85 int64 GetSize(const char *file_name) { 85 int64 GetSize(const char *file_name) {
86 base::PlatformFileInfo info; 86 base::PlatformFileInfo info;
87 file_util::GetFileInfo(LocalPath(file_name), &info); 87 file_util::GetFileInfo(LocalPath(file_name), &info);
88 return info.size; 88 return info.size;
89 } 89 }
90 90
91 base::PlatformFileError CreateFile(const char* file_name, 91 base::PlatformFileError CreateFile(const char* file_name,
92 base::PlatformFile* file_handle, 92 base::PlatformFile* file_handle,
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 CreateURL(from_dir), 378 CreateURL(from_dir),
379 CreateURL(to_dir))); 379 CreateURL(to_dir)));
380 380
381 EXPECT_FALSE(DirectoryExists(from_dir)); 381 EXPECT_FALSE(DirectoryExists(from_dir));
382 EXPECT_TRUE(DirectoryExists(to_dir)); 382 EXPECT_TRUE(DirectoryExists(to_dir));
383 EXPECT_TRUE(FileExists(to_file)); 383 EXPECT_TRUE(FileExists(to_file));
384 EXPECT_EQ(1020, GetSize(to_file)); 384 EXPECT_EQ(1020, GetSize(to_file));
385 } 385 }
386 386
387 } // namespace fileapi 387 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/dump_file_system.cc ('k') | webkit/browser/fileapi/native_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698