| 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" | |
| 6 | |
| 7 #include <stddef.h> | 5 #include <stddef.h> |
| 8 | |
| 9 #include <string> | 6 #include <string> |
| 7 #include <utility> |
| 10 | 8 |
| 11 #include "base/bind.h" | 9 #include "base/bind.h" |
| 12 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 13 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 14 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
| 15 #include "base/format_macros.h" | 13 #include "base/format_macros.h" |
| 16 #include "base/location.h" | 14 #include "base/location.h" |
| 17 #include "base/macros.h" | 15 #include "base/macros.h" |
| 18 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
| 19 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 32 #include "net/base/net_util.h" | 30 #include "net/base/net_util.h" |
| 33 #include "net/base/request_priority.h" | 31 #include "net/base/request_priority.h" |
| 34 #include "net/http/http_byte_range.h" | 32 #include "net/http/http_byte_range.h" |
| 35 #include "net/http/http_request_headers.h" | 33 #include "net/http/http_request_headers.h" |
| 36 #include "net/url_request/url_request.h" | 34 #include "net/url_request/url_request.h" |
| 37 #include "net/url_request/url_request_context.h" | 35 #include "net/url_request/url_request_context.h" |
| 38 #include "net/url_request/url_request_test_util.h" | 36 #include "net/url_request/url_request_test_util.h" |
| 39 #include "storage/browser/fileapi/external_mount_points.h" | 37 #include "storage/browser/fileapi/external_mount_points.h" |
| 40 #include "storage/browser/fileapi/file_system_context.h" | 38 #include "storage/browser/fileapi/file_system_context.h" |
| 41 #include "storage/browser/fileapi/file_system_file_util.h" | 39 #include "storage/browser/fileapi/file_system_file_util.h" |
| 40 #include "storage/browser/fileapi/file_system_url_request_job.h" |
| 42 #include "testing/gtest/include/gtest/gtest.h" | 41 #include "testing/gtest/include/gtest/gtest.h" |
| 43 | 42 |
| 44 using content::AsyncFileTestHelper; | 43 using content::AsyncFileTestHelper; |
| 45 using storage::FileSystemContext; | 44 using storage::FileSystemContext; |
| 46 using storage::FileSystemURL; | 45 using storage::FileSystemURL; |
| 47 using storage::FileSystemURLRequestJob; | 46 using storage::FileSystemURLRequestJob; |
| 48 | 47 |
| 49 namespace content { | 48 namespace content { |
| 50 namespace { | 49 namespace { |
| 51 | 50 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 ASSERT_TRUE(base::CreateDirectory(mnt_point)); | 161 ASSERT_TRUE(base::CreateDirectory(mnt_point)); |
| 163 | 162 |
| 164 ScopedVector<storage::FileSystemBackend> additional_providers; | 163 ScopedVector<storage::FileSystemBackend> additional_providers; |
| 165 additional_providers.push_back(new TestFileSystemBackend( | 164 additional_providers.push_back(new TestFileSystemBackend( |
| 166 base::ThreadTaskRunnerHandle::Get().get(), mnt_point)); | 165 base::ThreadTaskRunnerHandle::Get().get(), mnt_point)); |
| 167 | 166 |
| 168 std::vector<storage::URLRequestAutoMountHandler> handlers; | 167 std::vector<storage::URLRequestAutoMountHandler> handlers; |
| 169 handlers.push_back(base::Bind(&TestAutoMountForURLRequest)); | 168 handlers.push_back(base::Bind(&TestAutoMountForURLRequest)); |
| 170 | 169 |
| 171 file_system_context_ = CreateFileSystemContextWithAutoMountersForTesting( | 170 file_system_context_ = CreateFileSystemContextWithAutoMountersForTesting( |
| 172 NULL, additional_providers.Pass(), handlers, temp_dir_.path()); | 171 NULL, std::move(additional_providers), handlers, temp_dir_.path()); |
| 173 | 172 |
| 174 ASSERT_EQ(static_cast<int>(sizeof(kTestFileData)) - 1, | 173 ASSERT_EQ(static_cast<int>(sizeof(kTestFileData)) - 1, |
| 175 base::WriteFile(mnt_point.AppendASCII("foo"), kTestFileData, | 174 base::WriteFile(mnt_point.AppendASCII("foo"), kTestFileData, |
| 176 sizeof(kTestFileData) - 1)); | 175 sizeof(kTestFileData) - 1)); |
| 177 } | 176 } |
| 178 | 177 |
| 179 void OnOpenFileSystem(const GURL& root_url, | 178 void OnOpenFileSystem(const GURL& root_url, |
| 180 const std::string& name, | 179 const std::string& name, |
| 181 base::File::Error result) { | 180 base::File::Error result) { |
| 182 ASSERT_EQ(base::File::FILE_OK, result); | 181 ASSERT_EQ(base::File::FILE_OK, result); |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 EXPECT_TRUE(delegate_->request_failed()); | 475 EXPECT_TRUE(delegate_->request_failed()); |
| 477 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error()); | 476 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error()); |
| 478 | 477 |
| 479 ASSERT_FALSE( | 478 ASSERT_FALSE( |
| 480 storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( | 479 storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( |
| 481 kValidExternalMountPoint)); | 480 kValidExternalMountPoint)); |
| 482 } | 481 } |
| 483 | 482 |
| 484 } // namespace | 483 } // namespace |
| 485 } // namespace content | 484 } // namespace content |
| OLD | NEW |