| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/fileapi/file_system_dir_url_request_job.h" | 5 #include "webkit/fileapi/file_system_dir_url_request_job.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 ClearUnusedJob(); | 77 ClearUnusedJob(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void OnValidateFileSystem(base::PlatformFileError result) { | 80 void OnValidateFileSystem(base::PlatformFileError result) { |
| 81 ASSERT_EQ(base::PLATFORM_FILE_OK, result); | 81 ASSERT_EQ(base::PLATFORM_FILE_OK, result); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void TestRequestHelper(const GURL& url, bool run_to_completion) { | 84 void TestRequestHelper(const GURL& url, bool run_to_completion) { |
| 85 delegate_.reset(new TestDelegate()); | 85 delegate_.reset(new TestDelegate()); |
| 86 delegate_->set_quit_on_redirect(true); | 86 delegate_->set_quit_on_redirect(true); |
| 87 request_.reset(new net::URLRequest(url, | 87 request_.reset(empty_context_.CreateRequest(url, delegate_.get())); |
| 88 delegate_.get(), | |
| 89 &empty_context_)); | |
| 90 job_ = new FileSystemDirURLRequestJob( | 88 job_ = new FileSystemDirURLRequestJob( |
| 91 request_.get(), | 89 request_.get(), |
| 92 empty_context_.network_delegate(), | 90 empty_context_.network_delegate(), |
| 93 file_system_context_.get()); | 91 file_system_context_.get()); |
| 94 | 92 |
| 95 request_->Start(); | 93 request_->Start(); |
| 96 ASSERT_TRUE(request_->is_pending()); // verify that we're starting async | 94 ASSERT_TRUE(request_->is_pending()); // verify that we're starting async |
| 97 if (run_to_completion) | 95 if (run_to_completion) |
| 98 MessageLoop::current()->Run(); | 96 MessageLoop::current()->Run(); |
| 99 } | 97 } |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 CreateDirectory("foo"); | 286 CreateDirectory("foo"); |
| 289 TestRequestNoRun(CreateFileSystemURL("foo/")); | 287 TestRequestNoRun(CreateFileSystemURL("foo/")); |
| 290 // Run StartAsync() and only StartAsync(). | 288 // Run StartAsync() and only StartAsync(). |
| 291 MessageLoop::current()->DeleteSoon(FROM_HERE, request_.release()); | 289 MessageLoop::current()->DeleteSoon(FROM_HERE, request_.release()); |
| 292 MessageLoop::current()->RunAllPending(); | 290 MessageLoop::current()->RunAllPending(); |
| 293 // If we get here, success! we didn't crash! | 291 // If we get here, success! we didn't crash! |
| 294 } | 292 } |
| 295 | 293 |
| 296 } // namespace (anonymous) | 294 } // namespace (anonymous) |
| 297 } // namespace fileapi | 295 } // namespace fileapi |
| OLD | NEW |