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/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "base/test/scoped_task_environment.h" |
11 #include "base/threading/thread_restrictions.h" | 12 #include "base/threading/thread_restrictions.h" |
12 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
14 #include "content/public/test/mock_special_storage_policy.h" | 15 #include "content/public/test/mock_special_storage_policy.h" |
15 #include "content/public/test/test_browser_thread_bundle.h" | 16 #include "content/public/test/test_browser_thread_bundle.h" |
16 #include "content/public/test/test_file_system_context.h" | 17 #include "content/public/test/test_file_system_context.h" |
17 #include "content/public/test/test_file_system_options.h" | 18 #include "content/public/test/test_file_system_options.h" |
18 #include "storage/browser/fileapi/external_mount_points.h" | 19 #include "storage/browser/fileapi/external_mount_points.h" |
19 #include "storage/browser/fileapi/file_system_backend.h" | 20 #include "storage/browser/fileapi/file_system_backend.h" |
20 #include "storage/browser/fileapi/file_system_context.h" | 21 #include "storage/browser/fileapi/file_system_context.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 storage::kFileSystemTypeTemporary, | 76 storage::kFileSystemTypeTemporary, |
76 base::FilePath::FromUTF8Unsafe(path)); | 77 base::FilePath::FromUTF8Unsafe(path)); |
77 } | 78 } |
78 | 79 |
79 FileSystemOperationRunner* operation_runner() { | 80 FileSystemOperationRunner* operation_runner() { |
80 return file_system_context_->operation_runner(); | 81 return file_system_context_->operation_runner(); |
81 } | 82 } |
82 | 83 |
83 private: | 84 private: |
84 base::ScopedTempDir base_; | 85 base::ScopedTempDir base_; |
85 base::MessageLoop message_loop_; | 86 base::test::ScopedTaskEnvironment scoped_task_environment_; |
86 scoped_refptr<FileSystemContext> file_system_context_; | 87 scoped_refptr<FileSystemContext> file_system_context_; |
87 | 88 |
88 DISALLOW_COPY_AND_ASSIGN(FileSystemOperationRunnerTest); | 89 DISALLOW_COPY_AND_ASSIGN(FileSystemOperationRunnerTest); |
89 }; | 90 }; |
90 | 91 |
91 TEST_F(FileSystemOperationRunnerTest, NotFoundError) { | 92 TEST_F(FileSystemOperationRunnerTest, NotFoundError) { |
92 bool done = false; | 93 bool done = false; |
93 base::File::Error status = base::File::FILE_ERROR_FAILED; | 94 base::File::Error status = base::File::FILE_ERROR_FAILED; |
94 | 95 |
95 // Regular NOT_FOUND error, which is called asynchronously. | 96 // Regular NOT_FOUND error, which is called asynchronously. |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 base::RunLoop run_loop; | 240 base::RunLoop run_loop; |
240 BrowserThread::PostTaskAndReply( | 241 BrowserThread::PostTaskAndReply( |
241 BrowserThread::FILE, FROM_HERE, | 242 BrowserThread::FILE, FROM_HERE, |
242 base::Bind(&base::DoNothing), | 243 base::Bind(&base::DoNothing), |
243 run_loop.QuitClosure()); | 244 run_loop.QuitClosure()); |
244 run_loop.Run(); | 245 run_loop.Run(); |
245 // This should finish without thread assertion failure on debug build. | 246 // This should finish without thread assertion failure on debug build. |
246 } | 247 } |
247 | 248 |
248 } // namespace content | 249 } // namespace content |
OLD | NEW |