| 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" | |
| 20 #include "webkit/fileapi/file_system_context.h" | 19 #include "webkit/fileapi/file_system_context.h" |
| 21 #include "webkit/fileapi/file_system_operation_context.h" | 20 #include "webkit/fileapi/file_system_operation_context.h" |
| 22 #include "webkit/fileapi/file_system_task_runners.h" | 21 #include "webkit/fileapi/file_system_task_runners.h" |
| 23 #include "webkit/fileapi/isolated_context.h" | 22 #include "webkit/fileapi/isolated_context.h" |
| 24 #include "webkit/fileapi/isolated_file_util.h" | 23 #include "webkit/fileapi/isolated_file_util.h" |
| 25 #include "webkit/fileapi/local_file_system_operation.h" | 24 #include "webkit/fileapi/local_file_system_operation.h" |
| 26 #include "webkit/fileapi/local_file_system_test_helper.h" | 25 #include "webkit/fileapi/local_file_system_test_helper.h" |
| 27 #include "webkit/fileapi/local_file_util.h" | 26 #include "webkit/fileapi/local_file_util.h" |
| 28 #include "webkit/fileapi/mock_file_system_options.h" | 27 #include "webkit/fileapi/mock_file_system_context.h" |
| 29 #include "webkit/fileapi/native_file_util.h" | 28 #include "webkit/fileapi/native_file_util.h" |
| 30 #include "webkit/fileapi/test_file_set.h" | 29 #include "webkit/fileapi/test_file_set.h" |
| 31 #include "webkit/quota/mock_special_storage_policy.h" | |
| 32 | 30 |
| 33 using file_util::FileEnumerator; | 31 using file_util::FileEnumerator; |
| 34 | 32 |
| 35 namespace fileapi { | 33 namespace fileapi { |
| 36 | 34 |
| 37 namespace { | 35 namespace { |
| 38 | 36 |
| 39 typedef AsyncFileTestHelper::FileEntryList FileEntryList; | 37 typedef AsyncFileTestHelper::FileEntryList FileEntryList; |
| 40 | 38 |
| 41 // Used in IsolatedFileUtilTest::SimulateDropFiles(). | 39 // Used in IsolatedFileUtilTest::SimulateDropFiles(). |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 99 |
| 102 virtual void SetUp() { | 100 virtual void SetUp() { |
| 103 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); | 101 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
| 104 ASSERT_TRUE(partition_dir_.CreateUniqueTempDir()); | 102 ASSERT_TRUE(partition_dir_.CreateUniqueTempDir()); |
| 105 file_util_.reset(new DraggedFileUtil()); | 103 file_util_.reset(new DraggedFileUtil()); |
| 106 | 104 |
| 107 // Register the files/directories of RegularTestCases (with random | 105 // Register the files/directories of RegularTestCases (with random |
| 108 // root paths) as dropped files. | 106 // root paths) as dropped files. |
| 109 SimulateDropFiles(); | 107 SimulateDropFiles(); |
| 110 | 108 |
| 111 file_system_context_ = new FileSystemContext( | 109 file_system_context_ = CreateFileSystemContextForTesting( |
| 112 FileSystemTaskRunners::CreateMockTaskRunners(), | |
| 113 ExternalMountPoints::CreateRefCounted().get(), | |
| 114 make_scoped_refptr(new quota::MockSpecialStoragePolicy()), | |
| 115 NULL /* quota_manager */, | 110 NULL /* quota_manager */, |
| 116 partition_dir_.path(), | 111 partition_dir_.path()); |
| 117 CreateAllowFileAccessOptions()); | |
| 118 | 112 |
| 119 isolated_context()->AddReference(filesystem_id_); | 113 isolated_context()->AddReference(filesystem_id_); |
| 120 } | 114 } |
| 121 | 115 |
| 122 virtual void TearDown() { | 116 virtual void TearDown() { |
| 123 isolated_context()->RemoveReference(filesystem_id_); | 117 isolated_context()->RemoveReference(filesystem_id_); |
| 124 } | 118 } |
| 125 | 119 |
| 126 protected: | 120 protected: |
| 127 IsolatedContext* isolated_context() const { | 121 IsolatedContext* isolated_context() const { |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 EXPECT_EQ(base::PLATFORM_FILE_OK, | 545 EXPECT_EQ(base::PLATFORM_FILE_OK, |
| 552 file_util()->Truncate(GetOperationContext().get(), url, 999)); | 546 file_util()->Truncate(GetOperationContext().get(), url, 999)); |
| 553 ASSERT_EQ(base::PLATFORM_FILE_OK, | 547 ASSERT_EQ(base::PLATFORM_FILE_OK, |
| 554 file_util()->GetFileInfo(GetOperationContext().get(), url, | 548 file_util()->GetFileInfo(GetOperationContext().get(), url, |
| 555 &info, &platform_path)); | 549 &info, &platform_path)); |
| 556 EXPECT_EQ(999, info.size); | 550 EXPECT_EQ(999, info.size); |
| 557 } | 551 } |
| 558 } | 552 } |
| 559 | 553 |
| 560 } // namespace fileapi | 554 } // namespace fileapi |
| OLD | NEW |