| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
| 13 #include "base/location.h" | 13 #include "base/location.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ptr_util.h" |
| 15 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 16 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 17 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
| 18 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" | 19 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
| 19 #include "chrome/test/base/in_process_browser_test.h" | 20 #include "chrome/test/base/in_process_browser_test.h" |
| 20 #include "content/public/test/browser_test.h" | 21 #include "content/public/test/browser_test.h" |
| 21 #include "content/public/test/test_file_system_backend.h" | 22 #include "content/public/test/test_file_system_backend.h" |
| 22 #include "content/public/test/test_file_system_context.h" | 23 #include "content/public/test/test_file_system_context.h" |
| 23 #include "content/public/test/test_utils.h" | 24 #include "content/public/test/test_utils.h" |
| 24 #include "storage/browser/fileapi/copy_or_move_file_validator.h" | 25 #include "storage/browser/fileapi/copy_or_move_file_validator.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 private: | 106 private: |
| 106 // Create the test files, filesystem objects, etc. | 107 // Create the test files, filesystem objects, etc. |
| 107 void SetupOnFileThread(const std::string& filename, | 108 void SetupOnFileThread(const std::string& filename, |
| 108 const std::string& content, | 109 const std::string& content, |
| 109 bool expected_result) { | 110 bool expected_result) { |
| 110 ASSERT_TRUE(base_dir_.CreateUniqueTempDir()); | 111 ASSERT_TRUE(base_dir_.CreateUniqueTempDir()); |
| 111 base::FilePath base = base_dir_.GetPath(); | 112 base::FilePath base = base_dir_.GetPath(); |
| 112 base::FilePath src_path = base.AppendASCII("src_fs"); | 113 base::FilePath src_path = base.AppendASCII("src_fs"); |
| 113 ASSERT_TRUE(base::CreateDirectory(src_path)); | 114 ASSERT_TRUE(base::CreateDirectory(src_path)); |
| 114 | 115 |
| 115 ScopedVector<storage::FileSystemBackend> additional_providers; | 116 std::vector<std::unique_ptr<storage::FileSystemBackend>> |
| 116 additional_providers.push_back(new content::TestFileSystemBackend( | 117 additional_providers; |
| 117 base::ThreadTaskRunnerHandle::Get().get(), src_path)); | 118 additional_providers.push_back( |
| 118 additional_providers.push_back(new MediaFileSystemBackend( | 119 base::MakeUnique<content::TestFileSystemBackend>( |
| 120 base::ThreadTaskRunnerHandle::Get().get(), src_path)); |
| 121 additional_providers.push_back(base::MakeUnique<MediaFileSystemBackend>( |
| 119 base, base::ThreadTaskRunnerHandle::Get().get())); | 122 base, base::ThreadTaskRunnerHandle::Get().get())); |
| 120 file_system_context_ = | 123 file_system_context_ = |
| 121 content::CreateFileSystemContextWithAdditionalProvidersForTesting( | 124 content::CreateFileSystemContextWithAdditionalProvidersForTesting( |
| 122 NULL, std::move(additional_providers), base); | 125 NULL, std::move(additional_providers), base); |
| 123 | 126 |
| 124 move_src_ = file_system_context_->CreateCrackedFileSystemURL( | 127 move_src_ = file_system_context_->CreateCrackedFileSystemURL( |
| 125 GURL(kOrigin), | 128 GURL(kOrigin), |
| 126 storage::kFileSystemTypeTest, | 129 storage::kFileSystemTypeTest, |
| 127 base::FilePath::FromUTF8Unsafe(filename)); | 130 base::FilePath::FromUTF8Unsafe(filename)); |
| 128 | 131 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 test_file = test_file.AppendASCII("no_streams.webm"); | 284 test_file = test_file.AppendASCII("no_streams.webm"); |
| 282 MoveTestFromFile("no_streams.webm", test_file, false); | 285 MoveTestFromFile("no_streams.webm", test_file, false); |
| 283 } | 286 } |
| 284 | 287 |
| 285 IN_PROC_BROWSER_TEST_F(MediaFileValidatorTest, ValidVideo) { | 288 IN_PROC_BROWSER_TEST_F(MediaFileValidatorTest, ValidVideo) { |
| 286 base::FilePath test_file = GetMediaTestDir(); | 289 base::FilePath test_file = GetMediaTestDir(); |
| 287 ASSERT_FALSE(test_file.empty()); | 290 ASSERT_FALSE(test_file.empty()); |
| 288 test_file = test_file.AppendASCII("bear-320x240-multitrack.webm"); | 291 test_file = test_file.AppendASCII("bear-320x240-multitrack.webm"); |
| 289 MoveTestFromFile("multitrack.webm", test_file, true); | 292 MoveTestFromFile("multitrack.webm", test_file, true); |
| 290 } | 293 } |
| OLD | NEW |