| 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 // NOTE: These tests are run as part of "unit_tests" (in chrome/test/unit) | 5 // NOTE: These tests are run as part of "unit_tests" (in chrome/test/unit) |
| 6 // rather than as part of test_shell_tests because they rely on being able | 6 // rather than as part of test_shell_tests because they rely on being able |
| 7 // to instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses | 7 // to instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses |
| 8 // TYPE_UI, which URLRequest doesn't allow. | 8 // TYPE_UI, which URLRequest doesn't allow. |
| 9 // | 9 // |
| 10 | 10 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 void OnValidateFileSystem(base::PlatformFileError result) { | 87 void OnValidateFileSystem(base::PlatformFileError result) { |
| 88 ASSERT_EQ(base::PLATFORM_FILE_OK, result); | 88 ASSERT_EQ(base::PLATFORM_FILE_OK, result); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void TestRequestHelper(const GURL& url, bool run_to_completion) { | 91 void TestRequestHelper(const GURL& url, bool run_to_completion) { |
| 92 delegate_.reset(new TestDelegate()); | 92 delegate_.reset(new TestDelegate()); |
| 93 delegate_->set_quit_on_redirect(true); | 93 delegate_->set_quit_on_redirect(true); |
| 94 request_.reset(new net::URLRequest(url, delegate_.get())); | 94 request_.reset(new net::URLRequest(url, delegate_.get())); |
| 95 job_ = new FileSystemDirURLRequestJob(request_.get(), | 95 job_ = new FileSystemDirURLRequestJob(request_.get(), |
| 96 file_system_context_.get(), | 96 file_system_context_.get()); |
| 97 file_thread_proxy_); | |
| 98 | 97 |
| 99 request_->Start(); | 98 request_->Start(); |
| 100 ASSERT_TRUE(request_->is_pending()); // verify that we're starting async | 99 ASSERT_TRUE(request_->is_pending()); // verify that we're starting async |
| 101 if (run_to_completion) | 100 if (run_to_completion) |
| 102 MessageLoop::current()->Run(); | 101 MessageLoop::current()->Run(); |
| 103 } | 102 } |
| 104 | 103 |
| 105 void TestRequest(const GURL& url) { | 104 void TestRequest(const GURL& url) { |
| 106 TestRequestHelper(url, true); | 105 TestRequestHelper(url, true); |
| 107 } | 106 } |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 CreateDirectory("foo"); | 289 CreateDirectory("foo"); |
| 291 TestRequestNoRun(CreateFileSystemURL("foo/")); | 290 TestRequestNoRun(CreateFileSystemURL("foo/")); |
| 292 // Run StartAsync() and only StartAsync(). | 291 // Run StartAsync() and only StartAsync(). |
| 293 MessageLoop::current()->DeleteSoon(FROM_HERE, request_.release()); | 292 MessageLoop::current()->DeleteSoon(FROM_HERE, request_.release()); |
| 294 MessageLoop::current()->RunAllPending(); | 293 MessageLoop::current()->RunAllPending(); |
| 295 // If we get here, success! we didn't crash! | 294 // If we get here, success! we didn't crash! |
| 296 } | 295 } |
| 297 | 296 |
| 298 } // namespace (anonymous) | 297 } // namespace (anonymous) |
| 299 } // namespace fileapi | 298 } // namespace fileapi |
| OLD | NEW |