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 "chrome/browser/media_galleries/fileapi/native_media_file_util.h" |
| 6 |
5 #include <stddef.h> | 7 #include <stddef.h> |
6 | |
7 #include <set> | 8 #include <set> |
8 #include <string> | 9 #include <string> |
| 10 #include <utility> |
9 | 11 |
10 #include "base/bind.h" | 12 #include "base/bind.h" |
11 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
12 #include "base/files/scoped_temp_dir.h" | 14 #include "base/files/scoped_temp_dir.h" |
13 #include "base/format_macros.h" | 15 #include "base/format_macros.h" |
14 #include "base/macros.h" | 16 #include "base/macros.h" |
15 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
16 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
17 #include "base/thread_task_runner_handle.h" | 19 #include "base/thread_task_runner_handle.h" |
18 #include "base/time/time.h" | 20 #include "base/time/time.h" |
19 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" | 21 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
20 #include "chrome/browser/media_galleries/fileapi/native_media_file_util.h" | |
21 #include "content/public/test/mock_special_storage_policy.h" | 22 #include "content/public/test/mock_special_storage_policy.h" |
22 #include "content/public/test/test_browser_thread.h" | 23 #include "content/public/test/test_browser_thread.h" |
23 #include "content/public/test/test_file_system_options.h" | 24 #include "content/public/test/test_file_system_options.h" |
24 #include "storage/browser/fileapi/external_mount_points.h" | 25 #include "storage/browser/fileapi/external_mount_points.h" |
25 #include "storage/browser/fileapi/file_system_backend.h" | 26 #include "storage/browser/fileapi/file_system_backend.h" |
26 #include "storage/browser/fileapi/file_system_context.h" | 27 #include "storage/browser/fileapi/file_system_context.h" |
27 #include "storage/browser/fileapi/file_system_operation_runner.h" | 28 #include "storage/browser/fileapi/file_system_operation_runner.h" |
28 #include "storage/browser/fileapi/file_system_url.h" | 29 #include "storage/browser/fileapi/file_system_url.h" |
29 #include "storage/browser/fileapi/isolated_context.h" | 30 #include "storage/browser/fileapi/isolated_context.h" |
30 #include "storage/browser/fileapi/native_file_util.h" | 31 #include "storage/browser/fileapi/native_file_util.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 new content::MockSpecialStoragePolicy(); | 127 new content::MockSpecialStoragePolicy(); |
127 | 128 |
128 ScopedVector<storage::FileSystemBackend> additional_providers; | 129 ScopedVector<storage::FileSystemBackend> additional_providers; |
129 additional_providers.push_back(new MediaFileSystemBackend( | 130 additional_providers.push_back(new MediaFileSystemBackend( |
130 data_dir_.path(), base::ThreadTaskRunnerHandle::Get().get())); | 131 data_dir_.path(), base::ThreadTaskRunnerHandle::Get().get())); |
131 | 132 |
132 file_system_context_ = new storage::FileSystemContext( | 133 file_system_context_ = new storage::FileSystemContext( |
133 base::ThreadTaskRunnerHandle::Get().get(), | 134 base::ThreadTaskRunnerHandle::Get().get(), |
134 base::ThreadTaskRunnerHandle::Get().get(), | 135 base::ThreadTaskRunnerHandle::Get().get(), |
135 storage::ExternalMountPoints::CreateRefCounted().get(), | 136 storage::ExternalMountPoints::CreateRefCounted().get(), |
136 storage_policy.get(), NULL, additional_providers.Pass(), | 137 storage_policy.get(), NULL, std::move(additional_providers), |
137 std::vector<storage::URLRequestAutoMountHandler>(), data_dir_.path(), | 138 std::vector<storage::URLRequestAutoMountHandler>(), data_dir_.path(), |
138 content::CreateAllowFileAccessOptions()); | 139 content::CreateAllowFileAccessOptions()); |
139 | 140 |
140 filesystem_id_ = isolated_context()->RegisterFileSystemForPath( | 141 filesystem_id_ = isolated_context()->RegisterFileSystemForPath( |
141 storage::kFileSystemTypeNativeMedia, std::string(), root_path(), NULL); | 142 storage::kFileSystemTypeNativeMedia, std::string(), root_path(), NULL); |
142 | 143 |
143 isolated_context()->AddReference(filesystem_id_); | 144 isolated_context()->AddReference(filesystem_id_); |
144 } | 145 } |
145 | 146 |
146 void TearDown() override { | 147 void TearDown() override { |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 expected_error = base::File::FILE_OK; | 565 expected_error = base::File::FILE_OK; |
565 else | 566 else |
566 expected_error = base::File::FILE_ERROR_SECURITY; | 567 expected_error = base::File::FILE_ERROR_SECURITY; |
567 error = base::File::FILE_ERROR_FAILED; | 568 error = base::File::FILE_ERROR_FAILED; |
568 operation_runner()->CreateSnapshotFile(url, | 569 operation_runner()->CreateSnapshotFile(url, |
569 base::Bind(CreateSnapshotCallback, &error)); | 570 base::Bind(CreateSnapshotCallback, &error)); |
570 base::MessageLoop::current()->RunUntilIdle(); | 571 base::MessageLoop::current()->RunUntilIdle(); |
571 ASSERT_EQ(expected_error, error); | 572 ASSERT_EQ(expected_error, error); |
572 } | 573 } |
573 } | 574 } |
OLD | NEW |