| 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 <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_vector.h" | |
| 11 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 12 #include "base/threading/thread_restrictions.h" | 11 #include "base/threading/thread_restrictions.h" |
| 13 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/test/mock_special_storage_policy.h" | 14 #include "content/public/test/mock_special_storage_policy.h" |
| 16 #include "content/public/test/test_browser_thread_bundle.h" | 15 #include "content/public/test/test_browser_thread_bundle.h" |
| 17 #include "content/public/test/test_file_system_context.h" | 16 #include "content/public/test/test_file_system_context.h" |
| 18 #include "content/public/test/test_file_system_options.h" | 17 #include "content/public/test/test_file_system_options.h" |
| 19 #include "storage/browser/fileapi/external_mount_points.h" | 18 #include "storage/browser/fileapi/external_mount_points.h" |
| 20 #include "storage/browser/fileapi/file_system_backend.h" | 19 #include "storage/browser/fileapi/file_system_backend.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 public: | 183 public: |
| 185 MultiThreadFileSystemOperationRunnerTest() | 184 MultiThreadFileSystemOperationRunnerTest() |
| 186 : thread_bundle_( | 185 : thread_bundle_( |
| 187 content::TestBrowserThreadBundle::REAL_FILE_THREAD | | 186 content::TestBrowserThreadBundle::REAL_FILE_THREAD | |
| 188 content::TestBrowserThreadBundle::IO_MAINLOOP) {} | 187 content::TestBrowserThreadBundle::IO_MAINLOOP) {} |
| 189 | 188 |
| 190 void SetUp() override { | 189 void SetUp() override { |
| 191 ASSERT_TRUE(base_.CreateUniqueTempDir()); | 190 ASSERT_TRUE(base_.CreateUniqueTempDir()); |
| 192 | 191 |
| 193 base::FilePath base_dir = base_.GetPath(); | 192 base::FilePath base_dir = base_.GetPath(); |
| 194 ScopedVector<storage::FileSystemBackend> additional_providers; | |
| 195 file_system_context_ = new FileSystemContext( | 193 file_system_context_ = new FileSystemContext( |
| 196 base::ThreadTaskRunnerHandle::Get().get(), | 194 base::ThreadTaskRunnerHandle::Get().get(), |
| 197 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get(), | 195 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get(), |
| 198 storage::ExternalMountPoints::CreateRefCounted().get(), | 196 storage::ExternalMountPoints::CreateRefCounted().get(), |
| 199 make_scoped_refptr(new MockSpecialStoragePolicy()).get(), nullptr, | 197 make_scoped_refptr(new MockSpecialStoragePolicy()).get(), nullptr, |
| 200 std::move(additional_providers), | 198 std::vector<std::unique_ptr<storage::FileSystemBackend>>(), |
| 201 std::vector<storage::URLRequestAutoMountHandler>(), base_dir, | 199 std::vector<storage::URLRequestAutoMountHandler>(), base_dir, |
| 202 CreateAllowFileAccessOptions()); | 200 CreateAllowFileAccessOptions()); |
| 203 | 201 |
| 204 // Disallow IO on the main loop. | 202 // Disallow IO on the main loop. |
| 205 base::ThreadRestrictions::SetIOAllowed(false); | 203 base::ThreadRestrictions::SetIOAllowed(false); |
| 206 } | 204 } |
| 207 | 205 |
| 208 void TearDown() override { | 206 void TearDown() override { |
| 209 base::ThreadRestrictions::SetIOAllowed(true); | 207 base::ThreadRestrictions::SetIOAllowed(true); |
| 210 file_system_context_ = nullptr; | 208 file_system_context_ = nullptr; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 241 base::RunLoop run_loop; | 239 base::RunLoop run_loop; |
| 242 BrowserThread::PostTaskAndReply( | 240 BrowserThread::PostTaskAndReply( |
| 243 BrowserThread::FILE, FROM_HERE, | 241 BrowserThread::FILE, FROM_HERE, |
| 244 base::Bind(&base::DoNothing), | 242 base::Bind(&base::DoNothing), |
| 245 run_loop.QuitClosure()); | 243 run_loop.QuitClosure()); |
| 246 run_loop.Run(); | 244 run_loop.Run(); |
| 247 // This should finish without thread assertion failure on debug build. | 245 // This should finish without thread assertion failure on debug build. |
| 248 } | 246 } |
| 249 | 247 |
| 250 } // namespace content | 248 } // namespace content |
| OLD | NEW |