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 "storage/browser/fileapi/recursive_operation_delegate.h" | 5 #include "storage/browser/fileapi/recursive_operation_delegate.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
16 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 18 #include "base/test/scoped_task_environment.h" |
18 #include "base/threading/thread_task_runner_handle.h" | 19 #include "base/threading/thread_task_runner_handle.h" |
19 #include "content/public/test/sandbox_file_system_test_helper.h" | 20 #include "content/public/test/sandbox_file_system_test_helper.h" |
20 #include "storage/browser/fileapi/file_system_file_util.h" | 21 #include "storage/browser/fileapi/file_system_file_util.h" |
21 #include "storage/browser/fileapi/file_system_operation.h" | 22 #include "storage/browser/fileapi/file_system_operation.h" |
22 #include "storage/browser/fileapi/file_system_operation_runner.h" | 23 #include "storage/browser/fileapi/file_system_operation_runner.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
24 | 25 |
25 using storage::FileSystemContext; | 26 using storage::FileSystemContext; |
26 using storage::FileSystemOperationContext; | 27 using storage::FileSystemOperationContext; |
27 using storage::FileSystemURL; | 28 using storage::FileSystemURL; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 184 |
184 FileSystemURL CreateDirectory(const std::string& path) { | 185 FileSystemURL CreateDirectory(const std::string& path) { |
185 FileSystemURL url = URLForPath(path); | 186 FileSystemURL url = URLForPath(path); |
186 EXPECT_EQ(base::File::FILE_OK, | 187 EXPECT_EQ(base::File::FILE_OK, |
187 file_util()->CreateDirectory(NewContext().get(), url, | 188 file_util()->CreateDirectory(NewContext().get(), url, |
188 false /* exclusive */, true)); | 189 false /* exclusive */, true)); |
189 return url; | 190 return url; |
190 } | 191 } |
191 | 192 |
192 private: | 193 private: |
193 base::MessageLoop message_loop_; | 194 base::test::ScopedTaskEnvironment scoped_task_environment_; |
194 | 195 |
195 // Common temp base for nondestructive uses. | 196 // Common temp base for nondestructive uses. |
196 base::ScopedTempDir base_; | 197 base::ScopedTempDir base_; |
197 SandboxFileSystemTestHelper sandbox_file_system_; | 198 SandboxFileSystemTestHelper sandbox_file_system_; |
198 }; | 199 }; |
199 | 200 |
200 TEST_F(RecursiveOperationDelegateTest, RootIsFile) { | 201 TEST_F(RecursiveOperationDelegateTest, RootIsFile) { |
201 FileSystemURL src_file(CreateFile("src")); | 202 FileSystemURL src_file(CreateFile("src")); |
202 | 203 |
203 base::File::Error error = base::File::FILE_ERROR_FAILED; | 204 base::File::Error error = base::File::FILE_ERROR_FAILED; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 EXPECT_EQ(LoggingRecursiveOperation::LogEntry::POST_PROCESS_DIRECTORY, | 380 EXPECT_EQ(LoggingRecursiveOperation::LogEntry::POST_PROCESS_DIRECTORY, |
380 log_entries[6].type); | 381 log_entries[6].type); |
381 EXPECT_EQ(src_dir1, log_entries[6].url); | 382 EXPECT_EQ(src_dir1, log_entries[6].url); |
382 | 383 |
383 EXPECT_EQ(LoggingRecursiveOperation::LogEntry::POST_PROCESS_DIRECTORY, | 384 EXPECT_EQ(LoggingRecursiveOperation::LogEntry::POST_PROCESS_DIRECTORY, |
384 log_entries[7].type); | 385 log_entries[7].type); |
385 EXPECT_EQ(src_root, log_entries[7].url); | 386 EXPECT_EQ(src_root, log_entries[7].url); |
386 } | 387 } |
387 | 388 |
388 } // namespace content | 389 } // namespace content |
OLD | NEW |