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/iphoto_file_util.h" |
| 6 |
5 #include <map> | 7 #include <map> |
6 #include <set> | 8 #include <set> |
7 #include <string> | 9 #include <string> |
| 10 #include <utility> |
8 #include <vector> | 11 #include <vector> |
9 | 12 |
10 #include "base/bind.h" | 13 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 14 #include "base/bind_helpers.h" |
12 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
13 #include "base/files/scoped_temp_dir.h" | 16 #include "base/files/scoped_temp_dir.h" |
14 #include "base/macros.h" | 17 #include "base/macros.h" |
15 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
16 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
17 #include "base/synchronization/waitable_event.h" | 20 #include "base/synchronization/waitable_event.h" |
18 #include "base/thread_task_runner_handle.h" | 21 #include "base/thread_task_runner_handle.h" |
19 #include "base/time/time.h" | 22 #include "base/time/time.h" |
20 #include "chrome/browser/media_galleries/fileapi/iphoto_data_provider.h" | 23 #include "chrome/browser/media_galleries/fileapi/iphoto_data_provider.h" |
21 #include "chrome/browser/media_galleries/fileapi/iphoto_file_util.h" | |
22 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" | 24 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
23 #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" | 25 #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" |
24 #include "chrome/browser/media_galleries/imported_media_gallery_registry.h" | 26 #include "chrome/browser/media_galleries/imported_media_gallery_registry.h" |
25 #include "content/public/browser/browser_thread.h" | 27 #include "content/public/browser/browser_thread.h" |
26 #include "content/public/test/mock_special_storage_policy.h" | 28 #include "content/public/test/mock_special_storage_policy.h" |
27 #include "content/public/test/test_browser_thread.h" | 29 #include "content/public/test/test_browser_thread.h" |
28 #include "content/public/test/test_file_system_options.h" | 30 #include "content/public/test/test_file_system_options.h" |
29 #include "storage/browser/fileapi/async_file_util.h" | 31 #include "storage/browser/fileapi/async_file_util.h" |
30 #include "storage/browser/fileapi/external_mount_points.h" | 32 #include "storage/browser/fileapi/external_mount_points.h" |
31 #include "storage/browser/fileapi/file_system_context.h" | 33 #include "storage/browser/fileapi/file_system_context.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 ScopedVector<storage::FileSystemBackend> additional_providers; | 208 ScopedVector<storage::FileSystemBackend> additional_providers; |
207 additional_providers.push_back(new TestMediaFileSystemBackend( | 209 additional_providers.push_back(new TestMediaFileSystemBackend( |
208 profile_dir_.path(), | 210 profile_dir_.path(), |
209 new TestIPhotoFileUtil(media_path_filter_.get(), | 211 new TestIPhotoFileUtil(media_path_filter_.get(), |
210 iphoto_data_provider_.get()))); | 212 iphoto_data_provider_.get()))); |
211 | 213 |
212 file_system_context_ = new storage::FileSystemContext( | 214 file_system_context_ = new storage::FileSystemContext( |
213 base::ThreadTaskRunnerHandle::Get().get(), | 215 base::ThreadTaskRunnerHandle::Get().get(), |
214 base::ThreadTaskRunnerHandle::Get().get(), | 216 base::ThreadTaskRunnerHandle::Get().get(), |
215 storage::ExternalMountPoints::CreateRefCounted().get(), | 217 storage::ExternalMountPoints::CreateRefCounted().get(), |
216 storage_policy.get(), | 218 storage_policy.get(), NULL, std::move(additional_providers), |
217 NULL, | 219 std::vector<storage::URLRequestAutoMountHandler>(), profile_dir_.path(), |
218 additional_providers.Pass(), | |
219 std::vector<storage::URLRequestAutoMountHandler>(), | |
220 profile_dir_.path(), | |
221 content::CreateAllowFileAccessOptions()); | 220 content::CreateAllowFileAccessOptions()); |
222 } | 221 } |
223 | 222 |
224 protected: | 223 protected: |
225 void TestNonexistentFolder(const std::string& path_append) { | 224 void TestNonexistentFolder(const std::string& path_append) { |
226 FileSystemOperation::FileEntryList contents; | 225 FileSystemOperation::FileEntryList contents; |
227 FileSystemURL url = CreateURL(path_append); | 226 FileSystemURL url = CreateURL(path_append); |
228 bool completed = false; | 227 bool completed = false; |
229 ReadDirectoryTestHelper(operation_runner(), url, &contents, &completed); | 228 ReadDirectoryTestHelper(operation_runner(), url, &contents, &completed); |
230 | 229 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 completed = false; | 344 completed = false; |
346 ReadDirectoryTestHelper(operation_runner(), url, &contents, &completed); | 345 ReadDirectoryTestHelper(operation_runner(), url, &contents, &completed); |
347 ASSERT_TRUE(completed); | 346 ASSERT_TRUE(completed); |
348 ASSERT_EQ(1u, contents.size()); | 347 ASSERT_EQ(1u, contents.size()); |
349 | 348 |
350 EXPECT_FALSE(contents.front().is_directory); | 349 EXPECT_FALSE(contents.front().is_directory); |
351 EXPECT_EQ("a.jpg", contents.front().name); | 350 EXPECT_EQ("a.jpg", contents.front().name); |
352 } | 351 } |
353 | 352 |
354 } // namespace iphoto | 353 } // namespace iphoto |
OLD | NEW |