OLD | NEW |
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 <stdint.h> |
| 6 |
5 #include <string> | 7 #include <string> |
6 | 8 |
7 #include "base/files/file.h" | 9 #include "base/files/file.h" |
8 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
10 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
| 13 #include "base/macros.h" |
11 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
12 #include "base/strings/sys_string_conversions.h" | 15 #include "base/strings/sys_string_conversions.h" |
13 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "build/build_config.h" |
14 #include "content/public/test/async_file_test_helper.h" | 18 #include "content/public/test/async_file_test_helper.h" |
15 #include "content/public/test/test_file_system_context.h" | 19 #include "content/public/test/test_file_system_context.h" |
16 #include "storage/browser/fileapi/async_file_util_adapter.h" | 20 #include "storage/browser/fileapi/async_file_util_adapter.h" |
17 #include "storage/browser/fileapi/file_system_context.h" | 21 #include "storage/browser/fileapi/file_system_context.h" |
18 #include "storage/browser/fileapi/file_system_file_util.h" | 22 #include "storage/browser/fileapi/file_system_file_util.h" |
19 #include "storage/browser/fileapi/file_system_operation_context.h" | 23 #include "storage/browser/fileapi/file_system_operation_context.h" |
20 #include "storage/browser/fileapi/local_file_util.h" | 24 #include "storage/browser/fileapi/local_file_util.h" |
21 #include "storage/browser/fileapi/native_file_util.h" | 25 #include "storage/browser/fileapi/native_file_util.h" |
22 #include "storage/common/fileapi/file_system_types.h" | 26 #include "storage/common/fileapi/file_system_types.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 86 |
83 bool FileExists(const char *file_name) { | 87 bool FileExists(const char *file_name) { |
84 return base::PathExists(LocalPath(file_name)) && | 88 return base::PathExists(LocalPath(file_name)) && |
85 !base::DirectoryExists(LocalPath(file_name)); | 89 !base::DirectoryExists(LocalPath(file_name)); |
86 } | 90 } |
87 | 91 |
88 bool DirectoryExists(const char *file_name) { | 92 bool DirectoryExists(const char *file_name) { |
89 return base::DirectoryExists(LocalPath(file_name)); | 93 return base::DirectoryExists(LocalPath(file_name)); |
90 } | 94 } |
91 | 95 |
92 int64 GetSize(const char *file_name) { | 96 int64_t GetSize(const char* file_name) { |
93 base::File::Info info; | 97 base::File::Info info; |
94 base::GetFileInfo(LocalPath(file_name), &info); | 98 base::GetFileInfo(LocalPath(file_name), &info); |
95 return info.size; | 99 return info.size; |
96 } | 100 } |
97 | 101 |
98 base::File CreateFile(const char* file_name) { | 102 base::File CreateFile(const char* file_name) { |
99 int file_flags = base::File::FLAG_CREATE | | 103 int file_flags = base::File::FLAG_CREATE | |
100 base::File::FLAG_WRITE | base::File::FLAG_ASYNC; | 104 base::File::FLAG_WRITE | base::File::FLAG_ASYNC; |
101 | 105 |
102 scoped_ptr<FileSystemOperationContext> context(NewContext()); | 106 scoped_ptr<FileSystemOperationContext> context(NewContext()); |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 CreateURL(from_dir), | 371 CreateURL(from_dir), |
368 CreateURL(to_dir))); | 372 CreateURL(to_dir))); |
369 | 373 |
370 EXPECT_FALSE(DirectoryExists(from_dir)); | 374 EXPECT_FALSE(DirectoryExists(from_dir)); |
371 EXPECT_TRUE(DirectoryExists(to_dir)); | 375 EXPECT_TRUE(DirectoryExists(to_dir)); |
372 EXPECT_TRUE(FileExists(to_file)); | 376 EXPECT_TRUE(FileExists(to_file)); |
373 EXPECT_EQ(1020, GetSize(to_file)); | 377 EXPECT_EQ(1020, GetSize(to_file)); |
374 } | 378 } |
375 | 379 |
376 } // namespace content | 380 } // namespace content |
OLD | NEW |