OLD | NEW |
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 "base/file_util.h" |
5 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
6 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
7 #include "base/platform_file.h" | 8 #include "base/platform_file.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "webkit/fileapi/native_file_util.h" | 10 #include "webkit/fileapi/native_file_util.h" |
10 | 11 |
11 namespace fileapi { | 12 namespace fileapi { |
12 | 13 |
13 class NativeFileUtilTest : public testing::Test { | 14 class NativeFileUtilTest : public testing::Test { |
14 public: | 15 public: |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 100 |
100 EXPECT_TRUE(NativeFileUtil::DirectoryExists(dir_name)); | 101 EXPECT_TRUE(NativeFileUtil::DirectoryExists(dir_name)); |
101 EXPECT_TRUE(file_util::DirectoryExists(dir_name)); | 102 EXPECT_TRUE(file_util::DirectoryExists(dir_name)); |
102 | 103 |
103 ASSERT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, | 104 ASSERT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, |
104 NativeFileUtil::CreateDirectory(dir_name, | 105 NativeFileUtil::CreateDirectory(dir_name, |
105 true /* exclusive */, | 106 true /* exclusive */, |
106 false /* recursive */)); | 107 false /* recursive */)); |
107 | 108 |
108 ASSERT_EQ(base::PLATFORM_FILE_OK, | 109 ASSERT_EQ(base::PLATFORM_FILE_OK, |
109 NativeFileUtil::DeleteDirectory (dir_name)); | 110 NativeFileUtil::DeleteDirectory(dir_name)); |
110 EXPECT_FALSE(file_util::DirectoryExists(dir_name)); | 111 EXPECT_FALSE(file_util::DirectoryExists(dir_name)); |
111 EXPECT_FALSE(NativeFileUtil::DirectoryExists(dir_name)); | 112 EXPECT_FALSE(NativeFileUtil::DirectoryExists(dir_name)); |
112 } | 113 } |
113 | 114 |
114 TEST_F(NativeFileUtilTest, TouchFileAndGetFileInfo) { | 115 TEST_F(NativeFileUtilTest, TouchFileAndGetFileInfo) { |
115 base::FilePath file_name = Path("test_file"); | 116 base::FilePath file_name = Path("test_file"); |
116 base::PlatformFileInfo native_info; | 117 base::PlatformFileInfo native_info; |
117 ASSERT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, | 118 ASSERT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
118 NativeFileUtil::GetFileInfo(file_name, &native_info)); | 119 NativeFileUtil::GetFileInfo(file_name, &native_info)); |
119 | 120 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 Path("nodir").AppendASCII("file"), | 332 Path("nodir").AppendASCII("file"), |
332 false)); | 333 false)); |
333 // Destination's parent is a file. | 334 // Destination's parent is a file. |
334 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, | 335 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
335 NativeFileUtil::CopyOrMoveFile(from_file, | 336 NativeFileUtil::CopyOrMoveFile(from_file, |
336 Path("tofile1").AppendASCII("file"), | 337 Path("tofile1").AppendASCII("file"), |
337 false)); | 338 false)); |
338 } | 339 } |
339 | 340 |
340 } // namespace fileapi | 341 } // namespace fileapi |
OLD | NEW |