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 <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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 67 } |
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 file_util::PathExists(LocalPath(file_name)) && | 77 return base::PathExists(LocalPath(file_name)) && |
78 !file_util::DirectoryExists(LocalPath(file_name)); | 78 !file_util::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 file_util::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); |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |