| 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 244 |
| 245 GURL CreateFileSystemURL(const std::string& path) { | 245 GURL CreateFileSystemURL(const std::string& path) { |
| 246 return GURL(kFileSystemURLPrefix + path); | 246 return GURL(kFileSystemURLPrefix + path); |
| 247 } | 247 } |
| 248 | 248 |
| 249 // Put the message loop at the top, so that it's the last thing deleted. | 249 // Put the message loop at the top, so that it's the last thing deleted. |
| 250 base::MessageLoopForIO message_loop_; | 250 base::MessageLoopForIO message_loop_; |
| 251 | 251 |
| 252 base::ScopedTempDir temp_dir_; | 252 base::ScopedTempDir temp_dir_; |
| 253 scoped_refptr<storage::FileSystemContext> file_system_context_; | 253 scoped_refptr<storage::FileSystemContext> file_system_context_; |
| 254 base::WeakPtrFactory<FileSystemURLRequestJobTest> weak_factory_; | |
| 255 | 254 |
| 256 net::URLRequestContext empty_context_; | 255 net::URLRequestContext empty_context_; |
| 257 scoped_ptr<FileSystemURLRequestJobFactory> job_factory_; | 256 scoped_ptr<FileSystemURLRequestJobFactory> job_factory_; |
| 258 | 257 |
| 259 // NOTE: order matters, request must die before delegate | 258 // NOTE: order matters, request must die before delegate |
| 260 scoped_ptr<net::TestDelegate> delegate_; | 259 scoped_ptr<net::TestDelegate> delegate_; |
| 261 scoped_ptr<net::URLRequest> request_; | 260 scoped_ptr<net::URLRequest> request_; |
| 261 |
| 262 base::WeakPtrFactory<FileSystemURLRequestJobTest> weak_factory_; |
| 262 }; | 263 }; |
| 263 | 264 |
| 264 namespace { | 265 namespace { |
| 265 | 266 |
| 266 TEST_F(FileSystemURLRequestJobTest, FileTest) { | 267 TEST_F(FileSystemURLRequestJobTest, FileTest) { |
| 267 WriteFile("file1.dat", kTestFileData, arraysize(kTestFileData) - 1); | 268 WriteFile("file1.dat", kTestFileData, arraysize(kTestFileData) - 1); |
| 268 TestRequest(CreateFileSystemURL("file1.dat")); | 269 TestRequest(CreateFileSystemURL("file1.dat")); |
| 269 | 270 |
| 270 ASSERT_FALSE(request_->is_pending()); | 271 ASSERT_FALSE(request_->is_pending()); |
| 271 EXPECT_EQ(1, delegate_->response_started_count()); | 272 EXPECT_EQ(1, delegate_->response_started_count()); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 EXPECT_TRUE(delegate_->request_failed()); | 471 EXPECT_TRUE(delegate_->request_failed()); |
| 471 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error()); | 472 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error()); |
| 472 | 473 |
| 473 ASSERT_FALSE( | 474 ASSERT_FALSE( |
| 474 storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( | 475 storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( |
| 475 kValidExternalMountPoint)); | 476 kValidExternalMountPoint)); |
| 476 } | 477 } |
| 477 | 478 |
| 478 } // namespace | 479 } // namespace |
| 479 } // namespace content | 480 } // namespace content |
| OLD | NEW |