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/files/file_util.h" | 9 #include "base/files/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" | |
14 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "base/thread_task_runner_handle.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.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/mock_special_storage_policy.h" | 18 #include "content/public/test/mock_special_storage_policy.h" |
19 #include "content/public/test/test_browser_thread.h" | 19 #include "content/public/test/test_browser_thread.h" |
20 #include "content/public/test/test_file_system_options.h" | 20 #include "content/public/test/test_file_system_options.h" |
21 #include "storage/browser/fileapi/external_mount_points.h" | 21 #include "storage/browser/fileapi/external_mount_points.h" |
22 #include "storage/browser/fileapi/file_system_backend.h" | 22 #include "storage/browser/fileapi/file_system_backend.h" |
23 #include "storage/browser/fileapi/file_system_context.h" | 23 #include "storage/browser/fileapi/file_system_context.h" |
24 #include "storage/browser/fileapi/file_system_operation_runner.h" | 24 #include "storage/browser/fileapi/file_system_operation_runner.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 void SetUp() override { | 118 void SetUp() override { |
119 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); | 119 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
120 ASSERT_TRUE(base::CreateDirectory(root_path())); | 120 ASSERT_TRUE(base::CreateDirectory(root_path())); |
121 | 121 |
122 scoped_refptr<storage::SpecialStoragePolicy> storage_policy = | 122 scoped_refptr<storage::SpecialStoragePolicy> storage_policy = |
123 new content::MockSpecialStoragePolicy(); | 123 new content::MockSpecialStoragePolicy(); |
124 | 124 |
125 ScopedVector<storage::FileSystemBackend> additional_providers; | 125 ScopedVector<storage::FileSystemBackend> additional_providers; |
126 additional_providers.push_back(new MediaFileSystemBackend( | 126 additional_providers.push_back(new MediaFileSystemBackend( |
127 data_dir_.path(), base::MessageLoopProxy::current().get())); | 127 data_dir_.path(), base::ThreadTaskRunnerHandle::Get().get())); |
128 | 128 |
129 file_system_context_ = new storage::FileSystemContext( | 129 file_system_context_ = new storage::FileSystemContext( |
130 base::MessageLoopProxy::current().get(), | 130 base::ThreadTaskRunnerHandle::Get().get(), |
131 base::MessageLoopProxy::current().get(), | 131 base::ThreadTaskRunnerHandle::Get().get(), |
132 storage::ExternalMountPoints::CreateRefCounted().get(), | 132 storage::ExternalMountPoints::CreateRefCounted().get(), |
133 storage_policy.get(), | 133 storage_policy.get(), NULL, additional_providers.Pass(), |
134 NULL, | 134 std::vector<storage::URLRequestAutoMountHandler>(), data_dir_.path(), |
135 additional_providers.Pass(), | |
136 std::vector<storage::URLRequestAutoMountHandler>(), | |
137 data_dir_.path(), | |
138 content::CreateAllowFileAccessOptions()); | 135 content::CreateAllowFileAccessOptions()); |
139 | 136 |
140 filesystem_id_ = isolated_context()->RegisterFileSystemForPath( | 137 filesystem_id_ = isolated_context()->RegisterFileSystemForPath( |
141 storage::kFileSystemTypeNativeMedia, std::string(), root_path(), NULL); | 138 storage::kFileSystemTypeNativeMedia, std::string(), root_path(), NULL); |
142 | 139 |
143 isolated_context()->AddReference(filesystem_id_); | 140 isolated_context()->AddReference(filesystem_id_); |
144 } | 141 } |
145 | 142 |
146 void TearDown() override { | 143 void TearDown() override { |
147 isolated_context()->RemoveReference(filesystem_id_); | 144 isolated_context()->RemoveReference(filesystem_id_); |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 expected_error = base::File::FILE_OK; | 565 expected_error = base::File::FILE_OK; |
569 else | 566 else |
570 expected_error = base::File::FILE_ERROR_SECURITY; | 567 expected_error = base::File::FILE_ERROR_SECURITY; |
571 error = base::File::FILE_ERROR_FAILED; | 568 error = base::File::FILE_ERROR_FAILED; |
572 operation_runner()->CreateSnapshotFile(url, | 569 operation_runner()->CreateSnapshotFile(url, |
573 base::Bind(CreateSnapshotCallback, &error)); | 570 base::Bind(CreateSnapshotCallback, &error)); |
574 base::MessageLoop::current()->RunUntilIdle(); | 571 base::MessageLoop::current()->RunUntilIdle(); |
575 ASSERT_EQ(expected_error, error); | 572 ASSERT_EQ(expected_error, error); |
576 } | 573 } |
577 } | 574 } |
OLD | NEW |