| 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 <set> | 5 #include <set> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| 11 #include "base/format_macros.h" | 11 #include "base/format_macros.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/message_loop/message_loop_proxy.h" | 13 #include "base/message_loop/message_loop_proxy.h" |
| 14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_p
rovider.h" | 16 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
| 17 #include "chrome/browser/media_galleries/fileapi/native_media_file_util.h" | 17 #include "chrome/browser/media_galleries/fileapi/native_media_file_util.h" |
| 18 #include "content/public/test/test_browser_thread.h" | 18 #include "content/public/test/test_browser_thread.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "webkit/browser/fileapi/external_mount_points.h" | 20 #include "webkit/browser/fileapi/external_mount_points.h" |
| 21 #include "webkit/browser/fileapi/file_system_backend.h" |
| 21 #include "webkit/browser/fileapi/file_system_context.h" | 22 #include "webkit/browser/fileapi/file_system_context.h" |
| 22 #include "webkit/browser/fileapi/file_system_mount_point_provider.h" | |
| 23 #include "webkit/browser/fileapi/file_system_operation_runner.h" | 23 #include "webkit/browser/fileapi/file_system_operation_runner.h" |
| 24 #include "webkit/browser/fileapi/file_system_task_runners.h" | 24 #include "webkit/browser/fileapi/file_system_task_runners.h" |
| 25 #include "webkit/browser/fileapi/file_system_url.h" | 25 #include "webkit/browser/fileapi/file_system_url.h" |
| 26 #include "webkit/browser/fileapi/isolated_context.h" | 26 #include "webkit/browser/fileapi/isolated_context.h" |
| 27 #include "webkit/browser/fileapi/mock_file_system_options.h" | 27 #include "webkit/browser/fileapi/mock_file_system_options.h" |
| 28 #include "webkit/browser/fileapi/native_file_util.h" | 28 #include "webkit/browser/fileapi/native_file_util.h" |
| 29 #include "webkit/browser/quota/mock_special_storage_policy.h" | 29 #include "webkit/browser/quota/mock_special_storage_policy.h" |
| 30 | 30 |
| 31 #define FPL(x) FILE_PATH_LITERAL(x) | 31 #define FPL(x) FILE_PATH_LITERAL(x) |
| 32 | 32 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 : io_thread_(content::BrowserThread::IO, &message_loop_) { | 118 : io_thread_(content::BrowserThread::IO, &message_loop_) { |
| 119 } | 119 } |
| 120 | 120 |
| 121 virtual void SetUp() { | 121 virtual void SetUp() { |
| 122 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); | 122 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
| 123 ASSERT_TRUE(file_util::CreateDirectory(root_path())); | 123 ASSERT_TRUE(file_util::CreateDirectory(root_path())); |
| 124 | 124 |
| 125 scoped_refptr<quota::SpecialStoragePolicy> storage_policy = | 125 scoped_refptr<quota::SpecialStoragePolicy> storage_policy = |
| 126 new quota::MockSpecialStoragePolicy(); | 126 new quota::MockSpecialStoragePolicy(); |
| 127 | 127 |
| 128 ScopedVector<fileapi::FileSystemMountPointProvider> additional_providers; | 128 ScopedVector<fileapi::FileSystemBackend> additional_providers; |
| 129 additional_providers.push_back(new MediaFileSystemMountPointProvider( | 129 additional_providers.push_back(new MediaFileSystemBackend( |
| 130 data_dir_.path(), base::MessageLoopProxy::current().get())); | 130 data_dir_.path(), base::MessageLoopProxy::current().get())); |
| 131 | 131 |
| 132 file_system_context_ = new fileapi::FileSystemContext( | 132 file_system_context_ = new fileapi::FileSystemContext( |
| 133 fileapi::FileSystemTaskRunners::CreateMockTaskRunners(), | 133 fileapi::FileSystemTaskRunners::CreateMockTaskRunners(), |
| 134 fileapi::ExternalMountPoints::CreateRefCounted().get(), | 134 fileapi::ExternalMountPoints::CreateRefCounted().get(), |
| 135 storage_policy.get(), | 135 storage_policy.get(), |
| 136 NULL, | 136 NULL, |
| 137 additional_providers.Pass(), | 137 additional_providers.Pass(), |
| 138 data_dir_.path(), | 138 data_dir_.path(), |
| 139 fileapi::CreateAllowFileAccessOptions()); | 139 fileapi::CreateAllowFileAccessOptions()); |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 expected_error = base::PLATFORM_FILE_ERROR_SECURITY; | 529 expected_error = base::PLATFORM_FILE_ERROR_SECURITY; |
| 530 error = base::PLATFORM_FILE_ERROR_FAILED; | 530 error = base::PLATFORM_FILE_ERROR_FAILED; |
| 531 operation_runner()->CreateSnapshotFile(url, | 531 operation_runner()->CreateSnapshotFile(url, |
| 532 base::Bind(CreateSnapshotCallback, &error)); | 532 base::Bind(CreateSnapshotCallback, &error)); |
| 533 base::MessageLoop::current()->RunUntilIdle(); | 533 base::MessageLoop::current()->RunUntilIdle(); |
| 534 ASSERT_EQ(expected_error, error); | 534 ASSERT_EQ(expected_error, error); |
| 535 } | 535 } |
| 536 } | 536 } |
| 537 | 537 |
| 538 } // namespace chrome | 538 } // namespace chrome |
| OLD | NEW |