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/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 void OnValidateFileSystem(base::PlatformFileError result) { | 82 void OnValidateFileSystem(base::PlatformFileError result) { |
83 ASSERT_EQ(base::PLATFORM_FILE_OK, result); | 83 ASSERT_EQ(base::PLATFORM_FILE_OK, result); |
84 } | 84 } |
85 | 85 |
86 void TestRequestHelper(const GURL& url, bool run_to_completion) { | 86 void TestRequestHelper(const GURL& url, bool run_to_completion) { |
87 delegate_.reset(new net::TestDelegate()); | 87 delegate_.reset(new net::TestDelegate()); |
88 delegate_->set_quit_on_redirect(true); | 88 delegate_->set_quit_on_redirect(true); |
89 request_.reset(empty_context_.CreateRequest(url, delegate_.get())); | 89 request_.reset(empty_context_.CreateRequest(url, delegate_.get())); |
90 job_ = new FileSystemDirURLRequestJob( | 90 job_ = new FileSystemDirURLRequestJob( |
91 request_.get(), | 91 request_.get(), NULL, file_system_context_.get()); |
92 empty_context_.network_delegate(), | |
93 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 } |
100 | 98 |
101 void TestRequest(const GURL& url) { | 99 void TestRequest(const GURL& url) { |
102 TestRequestHelper(url, true); | 100 TestRequestHelper(url, true); |
103 } | 101 } |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 CreateDirectory("foo"); | 287 CreateDirectory("foo"); |
290 TestRequestNoRun(CreateFileSystemURL("foo/")); | 288 TestRequestNoRun(CreateFileSystemURL("foo/")); |
291 // Run StartAsync() and only StartAsync(). | 289 // Run StartAsync() and only StartAsync(). |
292 MessageLoop::current()->DeleteSoon(FROM_HERE, request_.release()); | 290 MessageLoop::current()->DeleteSoon(FROM_HERE, request_.release()); |
293 MessageLoop::current()->RunUntilIdle(); | 291 MessageLoop::current()->RunUntilIdle(); |
294 // If we get here, success! we didn't crash! | 292 // If we get here, success! we didn't crash! |
295 } | 293 } |
296 | 294 |
297 } // namespace (anonymous) | 295 } // namespace (anonymous) |
298 } // namespace fileapi | 296 } // namespace fileapi |
OLD | NEW |