| 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 <set> | 5 #include <set> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 16 #include "base/message_loop/message_loop_proxy.h" | 16 #include "base/message_loop/message_loop_proxy.h" |
| 17 #include "base/platform_file.h" | 17 #include "base/platform_file.h" |
| 18 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
| 19 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
| 20 #include "base/time/time.h" | 20 #include "base/time/time.h" |
| 21 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" | 21 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
| 22 #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" | 22 #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" |
| 23 #include "chrome/browser/media_galleries/fileapi/picasa_data_provider.h" | 23 #include "chrome/browser/media_galleries/fileapi/picasa_data_provider.h" |
| 24 #include "chrome/browser/media_galleries/fileapi/picasa_file_util.h" | 24 #include "chrome/browser/media_galleries/fileapi/picasa_file_util.h" |
| 25 #include "chrome/browser/media_galleries/imported_media_gallery_registry.h" | 25 #include "chrome/browser/media_galleries/imported_media_gallery_registry.h" |
| 26 #include "chrome/common/media_galleries/picasa_types.h" | 26 #include "chrome/common/media_galleries/picasa_types.h" |
| 27 #include "chrome/common/media_galleries/pmp_constants.h" | 27 #include "chrome/common/media_galleries/pmp_constants.h" |
| 28 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
| 29 #include "content/public/test/mock_special_storage_policy.h" |
| 29 #include "content/public/test/test_browser_thread.h" | 30 #include "content/public/test/test_browser_thread.h" |
| 30 #include "content/public/test/test_file_system_options.h" | 31 #include "content/public/test/test_file_system_options.h" |
| 31 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
| 32 #include "webkit/browser/fileapi/async_file_util.h" | 33 #include "webkit/browser/fileapi/async_file_util.h" |
| 33 #include "webkit/browser/fileapi/external_mount_points.h" | 34 #include "webkit/browser/fileapi/external_mount_points.h" |
| 34 #include "webkit/browser/fileapi/file_system_context.h" | 35 #include "webkit/browser/fileapi/file_system_context.h" |
| 35 #include "webkit/browser/fileapi/file_system_operation_context.h" | 36 #include "webkit/browser/fileapi/file_system_operation_context.h" |
| 36 #include "webkit/browser/fileapi/file_system_operation_runner.h" | 37 #include "webkit/browser/fileapi/file_system_operation_runner.h" |
| 37 #include "webkit/browser/fileapi/isolated_context.h" | 38 #include "webkit/browser/fileapi/isolated_context.h" |
| 38 #include "webkit/browser/quota/mock_special_storage_policy.h" | |
| 39 #include "webkit/common/blob/shareable_file_reference.h" | 39 #include "webkit/common/blob/shareable_file_reference.h" |
| 40 | 40 |
| 41 using fileapi::FileSystemOperationContext; | 41 using fileapi::FileSystemOperationContext; |
| 42 using fileapi::FileSystemOperation; | 42 using fileapi::FileSystemOperation; |
| 43 using fileapi::FileSystemURL; | 43 using fileapi::FileSystemURL; |
| 44 | 44 |
| 45 namespace picasa { | 45 namespace picasa { |
| 46 | 46 |
| 47 namespace { | 47 namespace { |
| 48 | 48 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 PicasaFileUtilTest() | 225 PicasaFileUtilTest() |
| 226 : io_thread_(content::BrowserThread::IO, &message_loop_) { | 226 : io_thread_(content::BrowserThread::IO, &message_loop_) { |
| 227 } | 227 } |
| 228 virtual ~PicasaFileUtilTest() {} | 228 virtual ~PicasaFileUtilTest() {} |
| 229 | 229 |
| 230 virtual void SetUp() OVERRIDE { | 230 virtual void SetUp() OVERRIDE { |
| 231 ASSERT_TRUE(profile_dir_.CreateUniqueTempDir()); | 231 ASSERT_TRUE(profile_dir_.CreateUniqueTempDir()); |
| 232 ImportedMediaGalleryRegistry::GetInstance()->Initialize(); | 232 ImportedMediaGalleryRegistry::GetInstance()->Initialize(); |
| 233 | 233 |
| 234 scoped_refptr<quota::SpecialStoragePolicy> storage_policy = | 234 scoped_refptr<quota::SpecialStoragePolicy> storage_policy = |
| 235 new quota::MockSpecialStoragePolicy(); | 235 new content::MockSpecialStoragePolicy(); |
| 236 | 236 |
| 237 SynchronouslyRunOnMediaTaskRunner(base::Bind( | 237 SynchronouslyRunOnMediaTaskRunner(base::Bind( |
| 238 &PicasaFileUtilTest::SetUpOnMediaTaskRunner, base::Unretained(this))); | 238 &PicasaFileUtilTest::SetUpOnMediaTaskRunner, base::Unretained(this))); |
| 239 | 239 |
| 240 media_path_filter_.reset(new MediaPathFilter()); | 240 media_path_filter_.reset(new MediaPathFilter()); |
| 241 | 241 |
| 242 ScopedVector<fileapi::FileSystemBackend> additional_providers; | 242 ScopedVector<fileapi::FileSystemBackend> additional_providers; |
| 243 additional_providers.push_back(new TestMediaFileSystemBackend( | 243 additional_providers.push_back(new TestMediaFileSystemBackend( |
| 244 profile_dir_.path(), | 244 profile_dir_.path(), |
| 245 new TestPicasaFileUtil(media_path_filter_.get(), | 245 new TestPicasaFileUtil(media_path_filter_.get(), |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 operation_runner()->CreateSnapshotFile( | 592 operation_runner()->CreateSnapshotFile( |
| 593 CreateURL(std::string(kPicasaDirAlbums) + | 593 CreateURL(std::string(kPicasaDirAlbums) + |
| 594 "/albumname 2013-04-16/mapped_name.jpg"), | 594 "/albumname 2013-04-16/mapped_name.jpg"), |
| 595 snapshot_callback); | 595 snapshot_callback); |
| 596 loop.Run(); | 596 loop.Run(); |
| 597 EXPECT_EQ(base::File::FILE_OK, error); | 597 EXPECT_EQ(base::File::FILE_OK, error); |
| 598 EXPECT_EQ(image_path, platform_path_result); | 598 EXPECT_EQ(image_path, platform_path_result); |
| 599 } | 599 } |
| 600 | 600 |
| 601 } // namespace picasa | 601 } // namespace picasa |
| OLD | NEW |