| 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" | 5 #include "chrome/browser/media_galleries/fileapi/itunes_file_util.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
| 15 #include "base/files/scoped_temp_dir.h" | 15 #include "base/files/scoped_temp_dir.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ptr_util.h" |
| 17 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
| 18 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
| 19 #include "base/synchronization/waitable_event.h" | 20 #include "base/synchronization/waitable_event.h" |
| 20 #include "base/threading/thread_task_runner_handle.h" | 21 #include "base/threading/thread_task_runner_handle.h" |
| 21 #include "base/time/time.h" | 22 #include "base/time/time.h" |
| 22 #include "chrome/browser/media_galleries/fileapi/itunes_data_provider.h" | 23 #include "chrome/browser/media_galleries/fileapi/itunes_data_provider.h" |
| 23 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" | 24 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
| 24 #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" | 25 #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" |
| 25 #include "chrome/browser/media_galleries/imported_media_gallery_registry.h" | 26 #include "chrome/browser/media_galleries/imported_media_gallery_registry.h" |
| 26 #include "content/public/browser/browser_thread.h" | 27 #include "content/public/browser/browser_thread.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 base::Bind(&ItunesFileUtilTest::SetUpDataProvider, | 168 base::Bind(&ItunesFileUtilTest::SetUpDataProvider, |
| 168 base::Unretained(this))); | 169 base::Unretained(this))); |
| 169 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL, | 170 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL, |
| 170 base::WaitableEvent::InitialState::NOT_SIGNALED); | 171 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 171 MediaFileSystemBackend::MediaTaskRunner()->PostTask( | 172 MediaFileSystemBackend::MediaTaskRunner()->PostTask( |
| 172 FROM_HERE, | 173 FROM_HERE, |
| 173 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&event))); | 174 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&event))); |
| 174 event.Wait(); | 175 event.Wait(); |
| 175 | 176 |
| 176 media_path_filter_.reset(new MediaPathFilter()); | 177 media_path_filter_.reset(new MediaPathFilter()); |
| 177 ScopedVector<storage::FileSystemBackend> additional_providers; | 178 std::vector<std::unique_ptr<storage::FileSystemBackend>> |
| 178 additional_providers.push_back(new TestMediaFileSystemBackend( | 179 additional_providers; |
| 180 additional_providers.push_back(base::MakeUnique<TestMediaFileSystemBackend>( |
| 179 profile_dir_.GetPath(), | 181 profile_dir_.GetPath(), |
| 180 new TestITunesFileUtil(media_path_filter_.get(), | 182 new TestITunesFileUtil(media_path_filter_.get(), |
| 181 itunes_data_provider_.get()))); | 183 itunes_data_provider_.get()))); |
| 182 | 184 |
| 183 file_system_context_ = new storage::FileSystemContext( | 185 file_system_context_ = new storage::FileSystemContext( |
| 184 base::ThreadTaskRunnerHandle::Get().get(), | 186 base::ThreadTaskRunnerHandle::Get().get(), |
| 185 base::ThreadTaskRunnerHandle::Get().get(), | 187 base::ThreadTaskRunnerHandle::Get().get(), |
| 186 storage::ExternalMountPoints::CreateRefCounted().get(), | 188 storage::ExternalMountPoints::CreateRefCounted().get(), |
| 187 storage_policy.get(), NULL, std::move(additional_providers), | 189 storage_policy.get(), NULL, std::move(additional_providers), |
| 188 std::vector<storage::URLRequestAutoMountHandler>(), | 190 std::vector<storage::URLRequestAutoMountHandler>(), |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 completed = false; | 345 completed = false; |
| 344 ReadDirectoryTestHelper(operation_runner(), url, &contents, &completed); | 346 ReadDirectoryTestHelper(operation_runner(), url, &contents, &completed); |
| 345 ASSERT_TRUE(completed); | 347 ASSERT_TRUE(completed); |
| 346 ASSERT_EQ(1u, contents.size()); | 348 ASSERT_EQ(1u, contents.size()); |
| 347 EXPECT_FALSE(contents.front().is_directory); | 349 EXPECT_FALSE(contents.front().is_directory); |
| 348 EXPECT_EQ(base::FilePath().AppendASCII("baz.ogg").value(), | 350 EXPECT_EQ(base::FilePath().AppendASCII("baz.ogg").value(), |
| 349 contents.front().name); | 351 contents.front().name); |
| 350 } | 352 } |
| 351 | 353 |
| 352 } // namespace itunes | 354 } // namespace itunes |
| OLD | NEW |