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" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 FileSystemContext* file_system_context_; | 112 FileSystemContext* file_system_context_; |
113 }; | 113 }; |
114 | 114 |
115 } // namespace | 115 } // namespace |
116 | 116 |
117 class FileSystemURLRequestJobTest : public testing::Test { | 117 class FileSystemURLRequestJobTest : public testing::Test { |
118 protected: | 118 protected: |
119 FileSystemURLRequestJobTest() : weak_factory_(this) { | 119 FileSystemURLRequestJobTest() : weak_factory_(this) { |
120 } | 120 } |
121 | 121 |
122 virtual void SetUp() override { | 122 void SetUp() override { |
123 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 123 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
124 | 124 |
125 // We use the main thread so that we can get the root path synchronously. | 125 // We use the main thread so that we can get the root path synchronously. |
126 // TODO(adamk): Run this on the FILE thread we've created as well. | 126 // TODO(adamk): Run this on the FILE thread we've created as well. |
127 file_system_context_ = | 127 file_system_context_ = |
128 CreateFileSystemContextForTesting(NULL, temp_dir_.path()); | 128 CreateFileSystemContextForTesting(NULL, temp_dir_.path()); |
129 | 129 |
130 file_system_context_->OpenFileSystem( | 130 file_system_context_->OpenFileSystem( |
131 GURL("http://remote/"), | 131 GURL("http://remote/"), |
132 storage::kFileSystemTypeTemporary, | 132 storage::kFileSystemTypeTemporary, |
133 storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, | 133 storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, |
134 base::Bind(&FileSystemURLRequestJobTest::OnOpenFileSystem, | 134 base::Bind(&FileSystemURLRequestJobTest::OnOpenFileSystem, |
135 weak_factory_.GetWeakPtr())); | 135 weak_factory_.GetWeakPtr())); |
136 base::RunLoop().RunUntilIdle(); | 136 base::RunLoop().RunUntilIdle(); |
137 } | 137 } |
138 | 138 |
139 virtual void TearDown() override { | 139 void TearDown() override { |
140 // FileReader posts a task to close the file in destructor. | 140 // FileReader posts a task to close the file in destructor. |
141 base::RunLoop().RunUntilIdle(); | 141 base::RunLoop().RunUntilIdle(); |
142 } | 142 } |
143 | 143 |
144 void SetUpAutoMountContext() { | 144 void SetUpAutoMountContext() { |
145 base::FilePath mnt_point = temp_dir_.path().AppendASCII("auto_mount_dir"); | 145 base::FilePath mnt_point = temp_dir_.path().AppendASCII("auto_mount_dir"); |
146 ASSERT_TRUE(base::CreateDirectory(mnt_point)); | 146 ASSERT_TRUE(base::CreateDirectory(mnt_point)); |
147 | 147 |
148 ScopedVector<storage::FileSystemBackend> additional_providers; | 148 ScopedVector<storage::FileSystemBackend> additional_providers; |
149 additional_providers.push_back(new TestFileSystemBackend( | 149 additional_providers.push_back(new TestFileSystemBackend( |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 EXPECT_TRUE(delegate_->request_failed()); | 457 EXPECT_TRUE(delegate_->request_failed()); |
458 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error()); | 458 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error()); |
459 | 459 |
460 ASSERT_FALSE( | 460 ASSERT_FALSE( |
461 storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( | 461 storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( |
462 kValidExternalMountPoint)); | 462 kValidExternalMountPoint)); |
463 } | 463 } |
464 | 464 |
465 } // namespace | 465 } // namespace |
466 } // namespace content | 466 } // namespace content |
OLD | NEW |