OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/itunes_file_util.h" |
| 6 |
5 #include <set> | 7 #include <set> |
6 #include <string> | 8 #include <string> |
| 9 #include <utility> |
7 #include <vector> | 10 #include <vector> |
8 | 11 |
9 #include "base/bind.h" | 12 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
11 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
12 #include "base/files/scoped_temp_dir.h" | 15 #include "base/files/scoped_temp_dir.h" |
13 #include "base/macros.h" | 16 #include "base/macros.h" |
14 #include "base/run_loop.h" | 17 #include "base/run_loop.h" |
15 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
16 #include "base/synchronization/waitable_event.h" | 19 #include "base/synchronization/waitable_event.h" |
17 #include "base/thread_task_runner_handle.h" | 20 #include "base/thread_task_runner_handle.h" |
18 #include "base/time/time.h" | 21 #include "base/time/time.h" |
19 #include "chrome/browser/media_galleries/fileapi/itunes_data_provider.h" | 22 #include "chrome/browser/media_galleries/fileapi/itunes_data_provider.h" |
20 #include "chrome/browser/media_galleries/fileapi/itunes_file_util.h" | |
21 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" | 23 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
22 #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" | 24 #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" |
23 #include "chrome/browser/media_galleries/imported_media_gallery_registry.h" | 25 #include "chrome/browser/media_galleries/imported_media_gallery_registry.h" |
24 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
25 #include "content/public/test/mock_special_storage_policy.h" | 27 #include "content/public/test/mock_special_storage_policy.h" |
26 #include "content/public/test/test_browser_thread.h" | 28 #include "content/public/test/test_browser_thread.h" |
27 #include "content/public/test/test_file_system_options.h" | 29 #include "content/public/test/test_file_system_options.h" |
28 #include "storage/browser/fileapi/async_file_util.h" | 30 #include "storage/browser/fileapi/async_file_util.h" |
29 #include "storage/browser/fileapi/external_mount_points.h" | 31 #include "storage/browser/fileapi/external_mount_points.h" |
30 #include "storage/browser/fileapi/file_system_context.h" | 32 #include "storage/browser/fileapi/file_system_context.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 ScopedVector<storage::FileSystemBackend> additional_providers; | 176 ScopedVector<storage::FileSystemBackend> additional_providers; |
175 additional_providers.push_back(new TestMediaFileSystemBackend( | 177 additional_providers.push_back(new TestMediaFileSystemBackend( |
176 profile_dir_.path(), | 178 profile_dir_.path(), |
177 new TestITunesFileUtil(media_path_filter_.get(), | 179 new TestITunesFileUtil(media_path_filter_.get(), |
178 itunes_data_provider_.get()))); | 180 itunes_data_provider_.get()))); |
179 | 181 |
180 file_system_context_ = new storage::FileSystemContext( | 182 file_system_context_ = new storage::FileSystemContext( |
181 base::ThreadTaskRunnerHandle::Get().get(), | 183 base::ThreadTaskRunnerHandle::Get().get(), |
182 base::ThreadTaskRunnerHandle::Get().get(), | 184 base::ThreadTaskRunnerHandle::Get().get(), |
183 storage::ExternalMountPoints::CreateRefCounted().get(), | 185 storage::ExternalMountPoints::CreateRefCounted().get(), |
184 storage_policy.get(), | 186 storage_policy.get(), NULL, std::move(additional_providers), |
185 NULL, | 187 std::vector<storage::URLRequestAutoMountHandler>(), profile_dir_.path(), |
186 additional_providers.Pass(), | |
187 std::vector<storage::URLRequestAutoMountHandler>(), | |
188 profile_dir_.path(), | |
189 content::CreateAllowFileAccessOptions()); | 188 content::CreateAllowFileAccessOptions()); |
190 } | 189 } |
191 | 190 |
192 protected: | 191 protected: |
193 void TestNonexistentFolder(const std::string& path_append) { | 192 void TestNonexistentFolder(const std::string& path_append) { |
194 FileSystemOperation::FileEntryList contents; | 193 FileSystemOperation::FileEntryList contents; |
195 FileSystemURL url = CreateURL(path_append); | 194 FileSystemURL url = CreateURL(path_append); |
196 bool completed = false; | 195 bool completed = false; |
197 ReadDirectoryTestHelper(operation_runner(), url, &contents, &completed); | 196 ReadDirectoryTestHelper(operation_runner(), url, &contents, &completed); |
198 | 197 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 completed = false; | 342 completed = false; |
344 ReadDirectoryTestHelper(operation_runner(), url, &contents, &completed); | 343 ReadDirectoryTestHelper(operation_runner(), url, &contents, &completed); |
345 ASSERT_TRUE(completed); | 344 ASSERT_TRUE(completed); |
346 ASSERT_EQ(1u, contents.size()); | 345 ASSERT_EQ(1u, contents.size()); |
347 EXPECT_FALSE(contents.front().is_directory); | 346 EXPECT_FALSE(contents.front().is_directory); |
348 EXPECT_EQ(base::FilePath().AppendASCII("baz.ogg").value(), | 347 EXPECT_EQ(base::FilePath().AppendASCII("baz.ogg").value(), |
349 contents.front().name); | 348 contents.front().name); |
350 } | 349 } |
351 | 350 |
352 } // namespace itunes | 351 } // namespace itunes |
OLD | NEW |