| 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/picasa_file_util.h" |
| 6 |
| 5 #include <stddef.h> | 7 #include <stddef.h> |
| 6 #include <stdint.h> | 8 #include <stdint.h> |
| 7 | 9 |
| 8 #include <set> | 10 #include <set> |
| 9 #include <string> | 11 #include <string> |
| 12 #include <utility> |
| 10 #include <vector> | 13 #include <vector> |
| 11 | 14 |
| 12 #include "base/bind_helpers.h" | 15 #include "base/bind_helpers.h" |
| 13 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
| 14 #include "base/files/file_util.h" | 17 #include "base/files/file_util.h" |
| 15 #include "base/files/scoped_temp_dir.h" | 18 #include "base/files/scoped_temp_dir.h" |
| 16 #include "base/macros.h" | 19 #include "base/macros.h" |
| 17 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
| 18 #include "base/memory/scoped_vector.h" | 21 #include "base/memory/scoped_vector.h" |
| 19 #include "base/message_loop/message_loop.h" | 22 #include "base/message_loop/message_loop.h" |
| 20 #include "base/run_loop.h" | 23 #include "base/run_loop.h" |
| 21 #include "base/single_thread_task_runner.h" | 24 #include "base/single_thread_task_runner.h" |
| 22 #include "base/strings/stringprintf.h" | 25 #include "base/strings/stringprintf.h" |
| 23 #include "base/thread_task_runner_handle.h" | 26 #include "base/thread_task_runner_handle.h" |
| 24 #include "base/time/time.h" | 27 #include "base/time/time.h" |
| 25 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" | 28 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
| 26 #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" | 29 #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" |
| 27 #include "chrome/browser/media_galleries/fileapi/picasa_data_provider.h" | 30 #include "chrome/browser/media_galleries/fileapi/picasa_data_provider.h" |
| 28 #include "chrome/browser/media_galleries/fileapi/picasa_file_util.h" | |
| 29 #include "chrome/browser/media_galleries/imported_media_gallery_registry.h" | 31 #include "chrome/browser/media_galleries/imported_media_gallery_registry.h" |
| 30 #include "chrome/common/media_galleries/picasa_types.h" | 32 #include "chrome/common/media_galleries/picasa_types.h" |
| 31 #include "chrome/common/media_galleries/pmp_constants.h" | 33 #include "chrome/common/media_galleries/pmp_constants.h" |
| 32 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
| 33 #include "content/public/test/mock_special_storage_policy.h" | 35 #include "content/public/test/mock_special_storage_policy.h" |
| 34 #include "content/public/test/test_browser_thread.h" | 36 #include "content/public/test/test_browser_thread.h" |
| 35 #include "content/public/test/test_file_system_options.h" | 37 #include "content/public/test/test_file_system_options.h" |
| 36 #include "storage/browser/blob/shareable_file_reference.h" | 38 #include "storage/browser/blob/shareable_file_reference.h" |
| 37 #include "storage/browser/fileapi/async_file_util.h" | 39 #include "storage/browser/fileapi/async_file_util.h" |
| 38 #include "storage/browser/fileapi/external_mount_points.h" | 40 #include "storage/browser/fileapi/external_mount_points.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 ScopedVector<storage::FileSystemBackend> additional_providers; | 246 ScopedVector<storage::FileSystemBackend> additional_providers; |
| 245 additional_providers.push_back(new TestMediaFileSystemBackend( | 247 additional_providers.push_back(new TestMediaFileSystemBackend( |
| 246 profile_dir_.path(), | 248 profile_dir_.path(), |
| 247 new TestPicasaFileUtil(media_path_filter_.get(), | 249 new TestPicasaFileUtil(media_path_filter_.get(), |
| 248 picasa_data_provider_.get()))); | 250 picasa_data_provider_.get()))); |
| 249 | 251 |
| 250 file_system_context_ = new storage::FileSystemContext( | 252 file_system_context_ = new storage::FileSystemContext( |
| 251 base::ThreadTaskRunnerHandle::Get().get(), | 253 base::ThreadTaskRunnerHandle::Get().get(), |
| 252 base::ThreadTaskRunnerHandle::Get().get(), | 254 base::ThreadTaskRunnerHandle::Get().get(), |
| 253 storage::ExternalMountPoints::CreateRefCounted().get(), | 255 storage::ExternalMountPoints::CreateRefCounted().get(), |
| 254 storage_policy.get(), | 256 storage_policy.get(), NULL, std::move(additional_providers), |
| 255 NULL, | 257 std::vector<storage::URLRequestAutoMountHandler>(), profile_dir_.path(), |
| 256 additional_providers.Pass(), | |
| 257 std::vector<storage::URLRequestAutoMountHandler>(), | |
| 258 profile_dir_.path(), | |
| 259 content::CreateAllowFileAccessOptions()); | 258 content::CreateAllowFileAccessOptions()); |
| 260 } | 259 } |
| 261 | 260 |
| 262 void TearDown() override { | 261 void TearDown() override { |
| 263 SynchronouslyRunOnMediaTaskRunner( | 262 SynchronouslyRunOnMediaTaskRunner( |
| 264 base::Bind(&PicasaFileUtilTest::TearDownOnMediaTaskRunner, | 263 base::Bind(&PicasaFileUtilTest::TearDownOnMediaTaskRunner, |
| 265 base::Unretained(this))); | 264 base::Unretained(this))); |
| 266 } | 265 } |
| 267 | 266 |
| 268 protected: | 267 protected: |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 operation_runner()->CreateSnapshotFile( | 584 operation_runner()->CreateSnapshotFile( |
| 586 CreateURL(std::string(kPicasaDirAlbums) + | 585 CreateURL(std::string(kPicasaDirAlbums) + |
| 587 "/albumname 2013-04-16/mapped_name.jpg"), | 586 "/albumname 2013-04-16/mapped_name.jpg"), |
| 588 snapshot_callback); | 587 snapshot_callback); |
| 589 loop.Run(); | 588 loop.Run(); |
| 590 EXPECT_EQ(base::File::FILE_OK, error); | 589 EXPECT_EQ(base::File::FILE_OK, error); |
| 591 EXPECT_EQ(image_path, platform_path_result); | 590 EXPECT_EQ(image_path, platform_path_result); |
| 592 } | 591 } |
| 593 | 592 |
| 594 } // namespace picasa | 593 } // namespace picasa |
| OLD | NEW |