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/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/message_loop_proxy.h" |
11 #include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_p
rovider.h" | 12 #include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_p
rovider.h" |
12 #include "chrome/test/base/in_process_browser_test.h" | 13 #include "chrome/test/base/in_process_browser_test.h" |
13 #include "content/public/test/browser_test.h" | 14 #include "content/public/test/browser_test.h" |
14 #include "content/public/test/test_utils.h" | 15 #include "content/public/test/test_utils.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" | 17 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" |
17 #include "webkit/browser/fileapi/file_system_context.h" | 18 #include "webkit/browser/fileapi/file_system_context.h" |
18 #include "webkit/browser/fileapi/file_system_mount_point_provider.h" | 19 #include "webkit/browser/fileapi/file_system_mount_point_provider.h" |
19 #include "webkit/browser/fileapi/file_system_operation_runner.h" | 20 #include "webkit/browser/fileapi/file_system_operation_runner.h" |
20 #include "webkit/browser/fileapi/file_system_url.h" | 21 #include "webkit/browser/fileapi/file_system_url.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 bool expected_result) { | 86 bool expected_result) { |
86 ASSERT_TRUE(base_dir_.CreateUniqueTempDir()); | 87 ASSERT_TRUE(base_dir_.CreateUniqueTempDir()); |
87 base::FilePath base = base_dir_.path(); | 88 base::FilePath base = base_dir_.path(); |
88 base::FilePath src_path = base.AppendASCII("src_fs"); | 89 base::FilePath src_path = base.AppendASCII("src_fs"); |
89 ASSERT_TRUE(file_util::CreateDirectory(src_path)); | 90 ASSERT_TRUE(file_util::CreateDirectory(src_path)); |
90 | 91 |
91 ScopedVector<fileapi::FileSystemMountPointProvider> additional_providers; | 92 ScopedVector<fileapi::FileSystemMountPointProvider> additional_providers; |
92 additional_providers.push_back(new fileapi::TestMountPointProvider( | 93 additional_providers.push_back(new fileapi::TestMountPointProvider( |
93 base::MessageLoopProxy::current(), src_path)); | 94 base::MessageLoopProxy::current(), src_path)); |
94 additional_providers.push_back( | 95 additional_providers.push_back( |
95 new MediaFileSystemMountPointProvider(base)); | 96 new MediaFileSystemMountPointProvider( |
| 97 base, base::MessageLoopProxy::current())); |
96 file_system_context_ = | 98 file_system_context_ = |
97 fileapi::CreateFileSystemContextWithAdditionalProvidersForTesting( | 99 fileapi::CreateFileSystemContextWithAdditionalProvidersForTesting( |
98 NULL, additional_providers.Pass(), base); | 100 NULL, additional_providers.Pass(), base); |
99 | 101 |
100 move_src_ = file_system_context_->CreateCrackedFileSystemURL( | 102 move_src_ = file_system_context_->CreateCrackedFileSystemURL( |
101 GURL(kOrigin), fileapi::kFileSystemTypeTest, | 103 GURL(kOrigin), fileapi::kFileSystemTypeTest, |
102 base::FilePath::FromUTF8Unsafe(filename)); | 104 base::FilePath::FromUTF8Unsafe(filename)); |
103 | 105 |
104 test_file_size_ = content.size(); | 106 test_file_size_ = content.size(); |
105 base::FilePath test_file = src_path.AppendASCII(filename); | 107 base::FilePath test_file = src_path.AppendASCII(filename); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 IN_PROC_BROWSER_TEST_F(MediaFileValidatorTest, InvalidImage) { | 221 IN_PROC_BROWSER_TEST_F(MediaFileValidatorTest, InvalidImage) { |
220 MoveTest("a.webp", std::string(kInvalidImage, arraysize(kInvalidImage)), | 222 MoveTest("a.webp", std::string(kInvalidImage, arraysize(kInvalidImage)), |
221 false); | 223 false); |
222 } | 224 } |
223 | 225 |
224 IN_PROC_BROWSER_TEST_F(MediaFileValidatorTest, UnsupportedExtension) { | 226 IN_PROC_BROWSER_TEST_F(MediaFileValidatorTest, UnsupportedExtension) { |
225 MoveTest("a.txt", std::string(kValidImage, arraysize(kValidImage)), false); | 227 MoveTest("a.txt", std::string(kValidImage, arraysize(kValidImage)), false); |
226 } | 228 } |
227 | 229 |
228 } // namespace chrome | 230 } // namespace chrome |
OLD | NEW |