| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <utility> | 7 #include <utility> |
| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 empty_context_.set_job_factory(job_factory_.get()); | 195 empty_context_.set_job_factory(job_factory_.get()); |
| 196 | 196 |
| 197 request_ = empty_context_.CreateRequest( | 197 request_ = empty_context_.CreateRequest( |
| 198 url, net::DEFAULT_PRIORITY, delegate_.get()); | 198 url, net::DEFAULT_PRIORITY, delegate_.get()); |
| 199 if (headers) | 199 if (headers) |
| 200 request_->SetExtraRequestHeaders(*headers); | 200 request_->SetExtraRequestHeaders(*headers); |
| 201 | 201 |
| 202 request_->Start(); | 202 request_->Start(); |
| 203 ASSERT_TRUE(request_->is_pending()); // verify that we're starting async | 203 ASSERT_TRUE(request_->is_pending()); // verify that we're starting async |
| 204 if (run_to_completion) | 204 if (run_to_completion) |
| 205 base::MessageLoop::current()->Run(); | 205 base::RunLoop().Run(); |
| 206 } | 206 } |
| 207 | 207 |
| 208 void TestRequest(const GURL& url) { | 208 void TestRequest(const GURL& url) { |
| 209 TestRequestHelper(url, NULL, true, file_system_context_.get()); | 209 TestRequestHelper(url, NULL, true, file_system_context_.get()); |
| 210 } | 210 } |
| 211 | 211 |
| 212 void TestRequestWithContext(const GURL& url, | 212 void TestRequestWithContext(const GURL& url, |
| 213 FileSystemContext* file_system_context) { | 213 FileSystemContext* file_system_context) { |
| 214 TestRequestHelper(url, NULL, true, file_system_context); | 214 TestRequestHelper(url, NULL, true, file_system_context); |
| 215 } | 215 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 TEST_F(FileSystemURLRequestJobTest, FileDirRedirect) { | 356 TEST_F(FileSystemURLRequestJobTest, FileDirRedirect) { |
| 357 CreateDirectory("dir"); | 357 CreateDirectory("dir"); |
| 358 TestRequest(CreateFileSystemURL("dir")); | 358 TestRequest(CreateFileSystemURL("dir")); |
| 359 | 359 |
| 360 EXPECT_EQ(1, delegate_->received_redirect_count()); | 360 EXPECT_EQ(1, delegate_->received_redirect_count()); |
| 361 EXPECT_TRUE(request_->status().is_success()); | 361 EXPECT_TRUE(request_->status().is_success()); |
| 362 EXPECT_FALSE(delegate_->request_failed()); | 362 EXPECT_FALSE(delegate_->request_failed()); |
| 363 | 363 |
| 364 // We've deferred the redirect; now cancel the request to avoid following it. | 364 // We've deferred the redirect; now cancel the request to avoid following it. |
| 365 request_->Cancel(); | 365 request_->Cancel(); |
| 366 base::MessageLoop::current()->Run(); | 366 base::RunLoop().Run(); |
| 367 } | 367 } |
| 368 | 368 |
| 369 TEST_F(FileSystemURLRequestJobTest, InvalidURL) { | 369 TEST_F(FileSystemURLRequestJobTest, InvalidURL) { |
| 370 TestRequest(GURL("filesystem:/foo/bar/baz")); | 370 TestRequest(GURL("filesystem:/foo/bar/baz")); |
| 371 ASSERT_FALSE(request_->is_pending()); | 371 ASSERT_FALSE(request_->is_pending()); |
| 372 EXPECT_TRUE(delegate_->request_failed()); | 372 EXPECT_TRUE(delegate_->request_failed()); |
| 373 EXPECT_EQ(net::ERR_INVALID_URL, request_->status().error()); | 373 EXPECT_EQ(net::ERR_INVALID_URL, request_->status().error()); |
| 374 } | 374 } |
| 375 | 375 |
| 376 TEST_F(FileSystemURLRequestJobTest, NoSuchRoot) { | 376 TEST_F(FileSystemURLRequestJobTest, NoSuchRoot) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 EXPECT_TRUE(delegate_->request_failed()); | 476 EXPECT_TRUE(delegate_->request_failed()); |
| 477 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error()); | 477 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error()); |
| 478 | 478 |
| 479 ASSERT_FALSE( | 479 ASSERT_FALSE( |
| 480 storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( | 480 storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( |
| 481 kValidExternalMountPoint)); | 481 kValidExternalMountPoint)); |
| 482 } | 482 } |
| 483 | 483 |
| 484 } // namespace | 484 } // namespace |
| 485 } // namespace content | 485 } // namespace content |
| OLD | NEW |