| 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_dir_url_request_job.h" | |
| 6 | |
| 7 #include <stdint.h> | 5 #include <stdint.h> |
| 8 | |
| 9 #include <string> | 6 #include <string> |
| 7 #include <utility> |
| 10 | 8 |
| 11 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 12 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 13 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
| 14 #include "base/format_macros.h" | 12 #include "base/format_macros.h" |
| 15 #include "base/location.h" | 13 #include "base/location.h" |
| 16 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 17 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 18 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
| 19 #include "base/strings/string_piece.h" | 17 #include "base/strings/string_piece.h" |
| 20 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 21 #include "base/thread_task_runner_handle.h" | 19 #include "base/thread_task_runner_handle.h" |
| 22 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 23 #include "content/public/test/mock_special_storage_policy.h" | 21 #include "content/public/test/mock_special_storage_policy.h" |
| 24 #include "content/public/test/test_file_system_backend.h" | 22 #include "content/public/test/test_file_system_backend.h" |
| 25 #include "content/public/test/test_file_system_context.h" | 23 #include "content/public/test/test_file_system_context.h" |
| 26 #include "net/base/net_errors.h" | 24 #include "net/base/net_errors.h" |
| 27 #include "net/base/net_util.h" | 25 #include "net/base/net_util.h" |
| 28 #include "net/base/request_priority.h" | 26 #include "net/base/request_priority.h" |
| 29 #include "net/http/http_request_headers.h" | 27 #include "net/http/http_request_headers.h" |
| 30 #include "net/url_request/url_request.h" | 28 #include "net/url_request/url_request.h" |
| 31 #include "net/url_request/url_request_context.h" | 29 #include "net/url_request/url_request_context.h" |
| 32 #include "net/url_request/url_request_test_util.h" | 30 #include "net/url_request/url_request_test_util.h" |
| 33 #include "storage/browser/fileapi/external_mount_points.h" | 31 #include "storage/browser/fileapi/external_mount_points.h" |
| 34 #include "storage/browser/fileapi/file_system_context.h" | 32 #include "storage/browser/fileapi/file_system_context.h" |
| 33 #include "storage/browser/fileapi/file_system_dir_url_request_job.h" |
| 35 #include "storage/browser/fileapi/file_system_file_util.h" | 34 #include "storage/browser/fileapi/file_system_file_util.h" |
| 36 #include "storage/browser/fileapi/file_system_operation_context.h" | 35 #include "storage/browser/fileapi/file_system_operation_context.h" |
| 37 #include "storage/browser/fileapi/file_system_url.h" | 36 #include "storage/browser/fileapi/file_system_url.h" |
| 38 #include "testing/gtest/include/gtest/gtest.h" | 37 #include "testing/gtest/include/gtest/gtest.h" |
| 39 #include "third_party/icu/source/i18n/unicode/datefmt.h" | 38 #include "third_party/icu/source/i18n/unicode/datefmt.h" |
| 40 #include "third_party/icu/source/i18n/unicode/regex.h" | 39 #include "third_party/icu/source/i18n/unicode/regex.h" |
| 41 | 40 |
| 42 using storage::FileSystemContext; | 41 using storage::FileSystemContext; |
| 43 using storage::FileSystemOperationContext; | 42 using storage::FileSystemOperationContext; |
| 44 using storage::FileSystemURL; | 43 using storage::FileSystemURL; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 ASSERT_TRUE(base::CreateDirectory(*mnt_point)); | 156 ASSERT_TRUE(base::CreateDirectory(*mnt_point)); |
| 158 | 157 |
| 159 ScopedVector<storage::FileSystemBackend> additional_providers; | 158 ScopedVector<storage::FileSystemBackend> additional_providers; |
| 160 additional_providers.push_back(new TestFileSystemBackend( | 159 additional_providers.push_back(new TestFileSystemBackend( |
| 161 base::ThreadTaskRunnerHandle::Get().get(), *mnt_point)); | 160 base::ThreadTaskRunnerHandle::Get().get(), *mnt_point)); |
| 162 | 161 |
| 163 std::vector<storage::URLRequestAutoMountHandler> handlers; | 162 std::vector<storage::URLRequestAutoMountHandler> handlers; |
| 164 handlers.push_back(base::Bind(&TestAutoMountForURLRequest)); | 163 handlers.push_back(base::Bind(&TestAutoMountForURLRequest)); |
| 165 | 164 |
| 166 file_system_context_ = CreateFileSystemContextWithAutoMountersForTesting( | 165 file_system_context_ = CreateFileSystemContextWithAutoMountersForTesting( |
| 167 NULL, additional_providers.Pass(), handlers, temp_dir_.path()); | 166 NULL, std::move(additional_providers), handlers, temp_dir_.path()); |
| 168 } | 167 } |
| 169 | 168 |
| 170 void OnOpenFileSystem(const GURL& root_url, | 169 void OnOpenFileSystem(const GURL& root_url, |
| 171 const std::string& name, | 170 const std::string& name, |
| 172 base::File::Error result) { | 171 base::File::Error result) { |
| 173 ASSERT_EQ(base::File::FILE_OK, result); | 172 ASSERT_EQ(base::File::FILE_OK, result); |
| 174 } | 173 } |
| 175 | 174 |
| 176 void TestRequestHelper(const GURL& url, bool run_to_completion, | 175 void TestRequestHelper(const GURL& url, bool run_to_completion, |
| 177 FileSystemContext* file_system_context) { | 176 FileSystemContext* file_system_context) { |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 ASSERT_FALSE(request_->status().is_success()); | 452 ASSERT_FALSE(request_->status().is_success()); |
| 454 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error()); | 453 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error()); |
| 455 | 454 |
| 456 ASSERT_FALSE( | 455 ASSERT_FALSE( |
| 457 storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( | 456 storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( |
| 458 kValidExternalMountPoint)); | 457 kValidExternalMountPoint)); |
| 459 } | 458 } |
| 460 | 459 |
| 461 } // namespace | 460 } // namespace |
| 462 } // namespace content | 461 } // namespace content |
| OLD | NEW |