| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/scoped_callback_factory.h" | 8 #include "base/memory/scoped_callback_factory.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
| 11 #include "base/scoped_temp_dir.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_path_manager.h" | 18 #include "webkit/fileapi/file_system_path_manager.h" |
| 19 #include "webkit/fileapi/file_system_test_helper.h" | 19 #include "webkit/fileapi/file_system_test_helper.h" |
| 20 #include "webkit/fileapi/file_system_types.h" | 20 #include "webkit/fileapi/file_system_types.h" |
| 21 #include "webkit/fileapi/local_file_system_file_util.h" | 21 #include "webkit/fileapi/local_file_system_file_util.h" |
| 22 | 22 |
| 23 namespace fileapi { | 23 namespace fileapi { |
| 24 | 24 |
| 25 // TODO(dmikurube): Cover all public methods in LocalFileSystemFileUtil. | 25 // TODO(dmikurube): Cover all public methods in LocalFileSystemFileUtil. |
| 26 class LocalFileSystemFileUtilTest : public testing::Test { | 26 class LocalFileSystemFileUtilTest : public testing::Test { |
| 27 public: | 27 public: |
| 28 LocalFileSystemFileUtilTest() | 28 LocalFileSystemFileUtilTest() |
| 29 : local_file_util_( | 29 : local_file_util_( |
| 30 new LocalFileSystemFileUtil(FileSystemFileUtil::GetInstance())), | 30 new LocalFileSystemFileUtil(new FileSystemFileUtil())), |
| 31 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 31 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
| 32 } | 32 } |
| 33 | 33 |
| 34 void SetUp() { | 34 void SetUp() { |
| 35 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); | 35 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
| 36 test_helper_.SetUp(data_dir_.path(), FileUtil()); | 36 test_helper_.SetUp(data_dir_.path(), FileUtil()); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void TearDown() { | 39 void TearDown() { |
| 40 test_helper_.TearDown(); | 40 test_helper_.TearDown(); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 ASSERT_EQ(base::PLATFORM_FILE_OK, | 266 ASSERT_EQ(base::PLATFORM_FILE_OK, |
| 267 FileUtil()->Move(context.get(), Path(from_dir), Path(to_dir))); | 267 FileUtil()->Move(context.get(), Path(from_dir), Path(to_dir))); |
| 268 | 268 |
| 269 EXPECT_FALSE(DirectoryExists(from_dir)); | 269 EXPECT_FALSE(DirectoryExists(from_dir)); |
| 270 EXPECT_TRUE(DirectoryExists(to_dir)); | 270 EXPECT_TRUE(DirectoryExists(to_dir)); |
| 271 EXPECT_TRUE(FileExists(to_file)); | 271 EXPECT_TRUE(FileExists(to_file)); |
| 272 EXPECT_EQ(1020, GetSize(to_file)); | 272 EXPECT_EQ(1020, GetSize(to_file)); |
| 273 } | 273 } |
| 274 | 274 |
| 275 } // namespace fileapi | 275 } // namespace fileapi |
| OLD | NEW |