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/file_system_url_request_job.h" | 5 #include "storage/browser/fileapi/file_system_url_request_job.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
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/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
15 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
16 #include "base/message_loop/message_loop.h" | |
17 #include "base/message_loop/message_loop_proxy.h" | |
18 #include "base/rand_util.h" | 17 #include "base/rand_util.h" |
19 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
20 #include "base/strings/string_piece.h" | 19 #include "base/strings/string_piece.h" |
21 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
22 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "base/thread_task_runner_handle.h" |
23 #include "content/public/test/async_file_test_helper.h" | 23 #include "content/public/test/async_file_test_helper.h" |
24 #include "content/public/test/test_file_system_backend.h" | 24 #include "content/public/test/test_file_system_backend.h" |
25 #include "content/public/test/test_file_system_context.h" | 25 #include "content/public/test/test_file_system_context.h" |
26 #include "net/base/load_flags.h" | 26 #include "net/base/load_flags.h" |
27 #include "net/base/mime_util.h" | 27 #include "net/base/mime_util.h" |
28 #include "net/base/net_errors.h" | 28 #include "net/base/net_errors.h" |
29 #include "net/base/net_util.h" | 29 #include "net/base/net_util.h" |
30 #include "net/base/request_priority.h" | 30 #include "net/base/request_priority.h" |
31 #include "net/http/http_byte_range.h" | 31 #include "net/http/http_byte_range.h" |
32 #include "net/http/http_request_headers.h" | 32 #include "net/http/http_request_headers.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // FileReader posts a task to close the file in destructor. | 153 // FileReader posts a task to close the file in destructor. |
154 base::RunLoop().RunUntilIdle(); | 154 base::RunLoop().RunUntilIdle(); |
155 } | 155 } |
156 | 156 |
157 void SetUpAutoMountContext() { | 157 void SetUpAutoMountContext() { |
158 base::FilePath mnt_point = temp_dir_.path().AppendASCII("auto_mount_dir"); | 158 base::FilePath mnt_point = temp_dir_.path().AppendASCII("auto_mount_dir"); |
159 ASSERT_TRUE(base::CreateDirectory(mnt_point)); | 159 ASSERT_TRUE(base::CreateDirectory(mnt_point)); |
160 | 160 |
161 ScopedVector<storage::FileSystemBackend> additional_providers; | 161 ScopedVector<storage::FileSystemBackend> additional_providers; |
162 additional_providers.push_back(new TestFileSystemBackend( | 162 additional_providers.push_back(new TestFileSystemBackend( |
163 base::MessageLoopProxy::current().get(), mnt_point)); | 163 base::ThreadTaskRunnerHandle::Get().get(), mnt_point)); |
164 | 164 |
165 std::vector<storage::URLRequestAutoMountHandler> handlers; | 165 std::vector<storage::URLRequestAutoMountHandler> handlers; |
166 handlers.push_back(base::Bind(&TestAutoMountForURLRequest)); | 166 handlers.push_back(base::Bind(&TestAutoMountForURLRequest)); |
167 | 167 |
168 file_system_context_ = CreateFileSystemContextWithAutoMountersForTesting( | 168 file_system_context_ = CreateFileSystemContextWithAutoMountersForTesting( |
169 NULL, additional_providers.Pass(), handlers, temp_dir_.path()); | 169 NULL, additional_providers.Pass(), handlers, temp_dir_.path()); |
170 | 170 |
171 ASSERT_EQ(static_cast<int>(sizeof(kTestFileData)) - 1, | 171 ASSERT_EQ(static_cast<int>(sizeof(kTestFileData)) - 1, |
172 base::WriteFile(mnt_point.AppendASCII("foo"), kTestFileData, | 172 base::WriteFile(mnt_point.AppendASCII("foo"), kTestFileData, |
173 sizeof(kTestFileData) - 1)); | 173 sizeof(kTestFileData) - 1)); |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 EXPECT_TRUE(delegate_->request_failed()); | 471 EXPECT_TRUE(delegate_->request_failed()); |
472 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error()); | 472 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error()); |
473 | 473 |
474 ASSERT_FALSE( | 474 ASSERT_FALSE( |
475 storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( | 475 storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( |
476 kValidExternalMountPoint)); | 476 kValidExternalMountPoint)); |
477 } | 477 } |
478 | 478 |
479 } // namespace | 479 } // namespace |
480 } // namespace content | 480 } // namespace content |
OLD | NEW |