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_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/files/scoped_temp_dir.h" |
8 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
9 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
10 #include "base/platform_file.h" | 11 #include "base/platform_file.h" |
11 #include "base/scoped_temp_dir.h" | |
12 #include "base/sys_string_conversions.h" | 12 #include "base/sys_string_conversions.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "webkit/fileapi/file_system_context.h" | 15 #include "webkit/fileapi/file_system_context.h" |
16 #include "webkit/fileapi/file_system_file_util.h" | 16 #include "webkit/fileapi/file_system_file_util.h" |
17 #include "webkit/fileapi/file_system_operation_context.h" | 17 #include "webkit/fileapi/file_system_operation_context.h" |
18 #include "webkit/fileapi/file_system_types.h" | 18 #include "webkit/fileapi/file_system_types.h" |
19 #include "webkit/fileapi/local_file_system_test_helper.h" | 19 #include "webkit/fileapi/local_file_system_test_helper.h" |
20 #include "webkit/fileapi/local_file_util.h" | 20 #include "webkit/fileapi/local_file_util.h" |
21 #include "webkit/fileapi/native_file_util.h" | 21 #include "webkit/fileapi/native_file_util.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 context.get(), | 90 context.get(), |
91 Path(file_name), created); | 91 Path(file_name), created); |
92 } | 92 } |
93 | 93 |
94 const LocalFileSystemTestOriginHelper& test_helper() const { | 94 const LocalFileSystemTestOriginHelper& test_helper() const { |
95 return test_helper_; | 95 return test_helper_; |
96 } | 96 } |
97 | 97 |
98 private: | 98 private: |
99 scoped_ptr<LocalFileUtil> local_file_util_; | 99 scoped_ptr<LocalFileUtil> local_file_util_; |
100 ScopedTempDir data_dir_; | 100 base::ScopedTempDir data_dir_; |
101 MessageLoop message_loop_; | 101 MessageLoop message_loop_; |
102 LocalFileSystemTestOriginHelper test_helper_; | 102 LocalFileSystemTestOriginHelper test_helper_; |
103 | 103 |
104 DISALLOW_COPY_AND_ASSIGN(LocalFileUtilTest); | 104 DISALLOW_COPY_AND_ASSIGN(LocalFileUtilTest); |
105 }; | 105 }; |
106 | 106 |
107 TEST_F(LocalFileUtilTest, CreateAndClose) { | 107 TEST_F(LocalFileUtilTest, CreateAndClose) { |
108 const char *file_name = "test_file"; | 108 const char *file_name = "test_file"; |
109 base::PlatformFile file_handle; | 109 base::PlatformFile file_handle; |
110 bool created; | 110 bool created; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 test_helper().SameFileUtilMove(context.get(), | 326 test_helper().SameFileUtilMove(context.get(), |
327 Path(from_dir), Path(to_dir))); | 327 Path(from_dir), Path(to_dir))); |
328 | 328 |
329 EXPECT_FALSE(DirectoryExists(from_dir)); | 329 EXPECT_FALSE(DirectoryExists(from_dir)); |
330 EXPECT_TRUE(DirectoryExists(to_dir)); | 330 EXPECT_TRUE(DirectoryExists(to_dir)); |
331 EXPECT_TRUE(FileExists(to_file)); | 331 EXPECT_TRUE(FileExists(to_file)); |
332 EXPECT_EQ(1020, GetSize(to_file)); | 332 EXPECT_EQ(1020, GetSize(to_file)); |
333 } | 333 } |
334 | 334 |
335 } // namespace fileapi | 335 } // namespace fileapi |
OLD | NEW |