| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/location.h" |
| 11 #include "base/message_loop/message_loop_proxy.h" | |
| 12 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/thread_task_runner_handle.h" |
| 13 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" | 14 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
| 14 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
| 15 #include "content/public/test/browser_test.h" | 16 #include "content/public/test/browser_test.h" |
| 16 #include "content/public/test/test_file_system_backend.h" | 17 #include "content/public/test/test_file_system_backend.h" |
| 17 #include "content/public/test/test_file_system_context.h" | 18 #include "content/public/test/test_file_system_context.h" |
| 18 #include "content/public/test/test_utils.h" | 19 #include "content/public/test/test_utils.h" |
| 19 #include "storage/browser/fileapi/copy_or_move_file_validator.h" | 20 #include "storage/browser/fileapi/copy_or_move_file_validator.h" |
| 20 #include "storage/browser/fileapi/file_system_backend.h" | 21 #include "storage/browser/fileapi/file_system_backend.h" |
| 21 #include "storage/browser/fileapi/file_system_context.h" | 22 #include "storage/browser/fileapi/file_system_context.h" |
| 22 #include "storage/browser/fileapi/file_system_operation_runner.h" | 23 #include "storage/browser/fileapi/file_system_operation_runner.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 void SetupOnFileThread(const std::string& filename, | 103 void SetupOnFileThread(const std::string& filename, |
| 103 const std::string& content, | 104 const std::string& content, |
| 104 bool expected_result) { | 105 bool expected_result) { |
| 105 ASSERT_TRUE(base_dir_.CreateUniqueTempDir()); | 106 ASSERT_TRUE(base_dir_.CreateUniqueTempDir()); |
| 106 base::FilePath base = base_dir_.path(); | 107 base::FilePath base = base_dir_.path(); |
| 107 base::FilePath src_path = base.AppendASCII("src_fs"); | 108 base::FilePath src_path = base.AppendASCII("src_fs"); |
| 108 ASSERT_TRUE(base::CreateDirectory(src_path)); | 109 ASSERT_TRUE(base::CreateDirectory(src_path)); |
| 109 | 110 |
| 110 ScopedVector<storage::FileSystemBackend> additional_providers; | 111 ScopedVector<storage::FileSystemBackend> additional_providers; |
| 111 additional_providers.push_back(new content::TestFileSystemBackend( | 112 additional_providers.push_back(new content::TestFileSystemBackend( |
| 112 base::MessageLoopProxy::current().get(), src_path)); | 113 base::ThreadTaskRunnerHandle::Get().get(), src_path)); |
| 113 additional_providers.push_back(new MediaFileSystemBackend( | 114 additional_providers.push_back(new MediaFileSystemBackend( |
| 114 base, base::MessageLoopProxy::current().get())); | 115 base, base::ThreadTaskRunnerHandle::Get().get())); |
| 115 file_system_context_ = | 116 file_system_context_ = |
| 116 content::CreateFileSystemContextWithAdditionalProvidersForTesting( | 117 content::CreateFileSystemContextWithAdditionalProvidersForTesting( |
| 117 NULL, additional_providers.Pass(), base); | 118 NULL, additional_providers.Pass(), base); |
| 118 | 119 |
| 119 move_src_ = file_system_context_->CreateCrackedFileSystemURL( | 120 move_src_ = file_system_context_->CreateCrackedFileSystemURL( |
| 120 GURL(kOrigin), | 121 GURL(kOrigin), |
| 121 storage::kFileSystemTypeTest, | 122 storage::kFileSystemTypeTest, |
| 122 base::FilePath::FromUTF8Unsafe(filename)); | 123 base::FilePath::FromUTF8Unsafe(filename)); |
| 123 | 124 |
| 124 test_file_size_ = content.size(); | 125 test_file_size_ = content.size(); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 test_file = test_file.AppendASCII("no_streams.webm"); | 277 test_file = test_file.AppendASCII("no_streams.webm"); |
| 277 MoveTestFromFile("no_streams.webm", test_file, false); | 278 MoveTestFromFile("no_streams.webm", test_file, false); |
| 278 } | 279 } |
| 279 | 280 |
| 280 IN_PROC_BROWSER_TEST_F(MediaFileValidatorTest, ValidVideo) { | 281 IN_PROC_BROWSER_TEST_F(MediaFileValidatorTest, ValidVideo) { |
| 281 base::FilePath test_file = GetMediaTestDir(); | 282 base::FilePath test_file = GetMediaTestDir(); |
| 282 ASSERT_FALSE(test_file.empty()); | 283 ASSERT_FALSE(test_file.empty()); |
| 283 test_file = test_file.AppendASCII("bear-320x240-multitrack.webm"); | 284 test_file = test_file.AppendASCII("bear-320x240-multitrack.webm"); |
| 284 MoveTestFromFile("multitrack.webm", test_file, true); | 285 MoveTestFromFile("multitrack.webm", test_file, true); |
| 285 } | 286 } |
| OLD | NEW |