| 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 <string> | 6 #include <string> |
| 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/format_macros.h" | 13 #include "base/format_macros.h" |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/ptr_util.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/rand_util.h" | 18 #include "base/rand_util.h" |
| 19 #include "base/run_loop.h" | 19 #include "base/run_loop.h" |
| 20 #include "base/single_thread_task_runner.h" | 20 #include "base/single_thread_task_runner.h" |
| 21 #include "base/strings/string_piece.h" | 21 #include "base/strings/string_piece.h" |
| 22 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
| 23 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
| 24 #include "base/threading/thread_task_runner_handle.h" | 24 #include "base/threading/thread_task_runner_handle.h" |
| 25 #include "content/public/test/async_file_test_helper.h" | 25 #include "content/public/test/async_file_test_helper.h" |
| 26 #include "content/public/test/test_file_system_backend.h" | 26 #include "content/public/test/test_file_system_backend.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 void TearDown() override { | 154 void TearDown() override { |
| 155 // FileReader posts a task to close the file in destructor. | 155 // FileReader posts a task to close the file in destructor. |
| 156 base::RunLoop().RunUntilIdle(); | 156 base::RunLoop().RunUntilIdle(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void SetUpAutoMountContext() { | 159 void SetUpAutoMountContext() { |
| 160 base::FilePath mnt_point = | 160 base::FilePath mnt_point = |
| 161 temp_dir_.GetPath().AppendASCII("auto_mount_dir"); | 161 temp_dir_.GetPath().AppendASCII("auto_mount_dir"); |
| 162 ASSERT_TRUE(base::CreateDirectory(mnt_point)); | 162 ASSERT_TRUE(base::CreateDirectory(mnt_point)); |
| 163 | 163 |
| 164 ScopedVector<storage::FileSystemBackend> additional_providers; | 164 std::vector<std::unique_ptr<storage::FileSystemBackend>> |
| 165 additional_providers.push_back(new TestFileSystemBackend( | 165 additional_providers; |
| 166 additional_providers.push_back(base::MakeUnique<TestFileSystemBackend>( |
| 166 base::ThreadTaskRunnerHandle::Get().get(), mnt_point)); | 167 base::ThreadTaskRunnerHandle::Get().get(), mnt_point)); |
| 167 | 168 |
| 168 std::vector<storage::URLRequestAutoMountHandler> handlers; | 169 std::vector<storage::URLRequestAutoMountHandler> handlers; |
| 169 handlers.push_back(base::Bind(&TestAutoMountForURLRequest)); | 170 handlers.push_back(base::Bind(&TestAutoMountForURLRequest)); |
| 170 | 171 |
| 171 file_system_context_ = CreateFileSystemContextWithAutoMountersForTesting( | 172 file_system_context_ = CreateFileSystemContextWithAutoMountersForTesting( |
| 172 NULL, std::move(additional_providers), handlers, temp_dir_.GetPath()); | 173 NULL, std::move(additional_providers), handlers, temp_dir_.GetPath()); |
| 173 | 174 |
| 174 ASSERT_EQ(static_cast<int>(sizeof(kTestFileData)) - 1, | 175 ASSERT_EQ(static_cast<int>(sizeof(kTestFileData)) - 1, |
| 175 base::WriteFile(mnt_point.AppendASCII("foo"), kTestFileData, | 176 base::WriteFile(mnt_point.AppendASCII("foo"), kTestFileData, |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 EXPECT_TRUE(delegate_->request_failed()); | 477 EXPECT_TRUE(delegate_->request_failed()); |
| 477 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, delegate_->request_status()); | 478 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, delegate_->request_status()); |
| 478 | 479 |
| 479 ASSERT_FALSE( | 480 ASSERT_FALSE( |
| 480 storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( | 481 storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( |
| 481 kValidExternalMountPoint)); | 482 kValidExternalMountPoint)); |
| 482 } | 483 } |
| 483 | 484 |
| 484 } // namespace | 485 } // namespace |
| 485 } // namespace content | 486 } // namespace content |
| OLD | NEW |