| 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 <map> | 5 #include <map> |
| 6 #include <queue> | 6 #include <queue> |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 15 #include "base/message_loop_proxy.h" | 15 #include "base/message_loop_proxy.h" |
| 16 #include "base/time.h" | 16 #include "base/time.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 #include "webkit/fileapi/async_file_test_helper.h" | 18 #include "webkit/fileapi/async_file_test_helper.h" |
| 19 #include "webkit/fileapi/external_mount_points.h" | 19 #include "webkit/fileapi/external_mount_points.h" |
| 20 #include "webkit/fileapi/file_system_context.h" | 20 #include "webkit/fileapi/file_system_context.h" |
| 21 #include "webkit/fileapi/file_system_mount_point_provider.h" |
| 21 #include "webkit/fileapi/file_system_operation_context.h" | 22 #include "webkit/fileapi/file_system_operation_context.h" |
| 22 #include "webkit/fileapi/file_system_task_runners.h" | 23 #include "webkit/fileapi/file_system_task_runners.h" |
| 23 #include "webkit/fileapi/isolated_context.h" | 24 #include "webkit/fileapi/isolated_context.h" |
| 24 #include "webkit/fileapi/isolated_file_util.h" | 25 #include "webkit/fileapi/isolated_file_util.h" |
| 25 #include "webkit/fileapi/local_file_system_operation.h" | 26 #include "webkit/fileapi/local_file_system_operation.h" |
| 26 #include "webkit/fileapi/local_file_system_test_helper.h" | 27 #include "webkit/fileapi/local_file_system_test_helper.h" |
| 27 #include "webkit/fileapi/local_file_util.h" | 28 #include "webkit/fileapi/local_file_util.h" |
| 28 #include "webkit/fileapi/mock_file_system_options.h" | 29 #include "webkit/fileapi/mock_file_system_options.h" |
| 29 #include "webkit/fileapi/native_file_util.h" | 30 #include "webkit/fileapi/native_file_util.h" |
| 30 #include "webkit/fileapi/test_file_set.h" | 31 #include "webkit/fileapi/test_file_set.h" |
| 31 #include "webkit/quota/mock_special_storage_policy.h" | |
| 32 | 32 |
| 33 using file_util::FileEnumerator; | 33 using file_util::FileEnumerator; |
| 34 | 34 |
| 35 namespace fileapi { | 35 namespace fileapi { |
| 36 | 36 |
| 37 namespace { | 37 namespace { |
| 38 | 38 |
| 39 typedef AsyncFileTestHelper::FileEntryList FileEntryList; | 39 typedef AsyncFileTestHelper::FileEntryList FileEntryList; |
| 40 | 40 |
| 41 // Used in IsolatedFileUtilTest::SimulateDropFiles(). | 41 // Used in IsolatedFileUtilTest::SimulateDropFiles(). |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); | 103 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
| 104 ASSERT_TRUE(partition_dir_.CreateUniqueTempDir()); | 104 ASSERT_TRUE(partition_dir_.CreateUniqueTempDir()); |
| 105 file_util_.reset(new DraggedFileUtil()); | 105 file_util_.reset(new DraggedFileUtil()); |
| 106 | 106 |
| 107 // Register the files/directories of RegularTestCases (with random | 107 // Register the files/directories of RegularTestCases (with random |
| 108 // root paths) as dropped files. | 108 // root paths) as dropped files. |
| 109 SimulateDropFiles(); | 109 SimulateDropFiles(); |
| 110 | 110 |
| 111 file_system_context_ = new FileSystemContext( | 111 file_system_context_ = new FileSystemContext( |
| 112 FileSystemTaskRunners::CreateMockTaskRunners(), | 112 FileSystemTaskRunners::CreateMockTaskRunners(), |
| 113 ExternalMountPoints::CreateRefCounted().get(), | |
| 114 make_scoped_refptr(new quota::MockSpecialStoragePolicy()), | |
| 115 NULL /* quota_manager */, | 113 NULL /* quota_manager */, |
| 114 ScopedVector<FileSystemMountPointProvider>(), |
| 115 std::vector<MountPoints*>(), |
| 116 partition_dir_.path(), | 116 partition_dir_.path(), |
| 117 CreateAllowFileAccessOptions()); | 117 CreateAllowFileAccessOptions()); |
| 118 | 118 |
| 119 isolated_context()->AddReference(filesystem_id_); | 119 isolated_context()->AddReference(filesystem_id_); |
| 120 } | 120 } |
| 121 | 121 |
| 122 virtual void TearDown() { | 122 virtual void TearDown() { |
| 123 isolated_context()->RemoveReference(filesystem_id_); | 123 isolated_context()->RemoveReference(filesystem_id_); |
| 124 } | 124 } |
| 125 | 125 |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 EXPECT_EQ(base::PLATFORM_FILE_OK, | 551 EXPECT_EQ(base::PLATFORM_FILE_OK, |
| 552 file_util()->Truncate(GetOperationContext().get(), url, 999)); | 552 file_util()->Truncate(GetOperationContext().get(), url, 999)); |
| 553 ASSERT_EQ(base::PLATFORM_FILE_OK, | 553 ASSERT_EQ(base::PLATFORM_FILE_OK, |
| 554 file_util()->GetFileInfo(GetOperationContext().get(), url, | 554 file_util()->GetFileInfo(GetOperationContext().get(), url, |
| 555 &info, &platform_path)); | 555 &info, &platform_path)); |
| 556 EXPECT_EQ(999, info.size); | 556 EXPECT_EQ(999, info.size); |
| 557 } | 557 } |
| 558 } | 558 } |
| 559 | 559 |
| 560 } // namespace fileapi | 560 } // namespace fileapi |
| OLD | NEW |