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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 delegate_.reset(new TestDelegate()); | 115 delegate_.reset(new TestDelegate()); |
116 // Make delegate_ exit the MessageLoop when the request is done. | 116 // Make delegate_ exit the MessageLoop when the request is done. |
117 delegate_->set_quit_on_complete(true); | 117 delegate_->set_quit_on_complete(true); |
118 delegate_->set_quit_on_redirect(true); | 118 delegate_->set_quit_on_redirect(true); |
119 request_.reset(new net::URLRequest(url, delegate_.get())); | 119 request_.reset(new net::URLRequest(url, delegate_.get())); |
120 if (headers) | 120 if (headers) |
121 request_->SetExtraRequestHeaders(*headers); | 121 request_->SetExtraRequestHeaders(*headers); |
122 ASSERT_TRUE(!job_); | 122 ASSERT_TRUE(!job_); |
123 job_ = new FileSystemURLRequestJob( | 123 job_ = new FileSystemURLRequestJob( |
124 request_.get(), | 124 request_.get(), |
125 file_system_context_.get(), | 125 file_system_context_.get()); |
126 base::MessageLoopProxy::current()); | |
127 pending_job_ = job_; | 126 pending_job_ = job_; |
128 | 127 |
129 request_->Start(); | 128 request_->Start(); |
130 ASSERT_TRUE(request_->is_pending()); // verify that we're starting async | 129 ASSERT_TRUE(request_->is_pending()); // verify that we're starting async |
131 if (run_to_completion) | 130 if (run_to_completion) |
132 MessageLoop::current()->Run(); | 131 MessageLoop::current()->Run(); |
133 } | 132 } |
134 | 133 |
135 void TestRequest(const GURL& url) { | 134 void TestRequest(const GURL& url) { |
136 TestRequestHelper(url, NULL, true); | 135 TestRequestHelper(url, NULL, true); |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 | 369 |
371 TestRequest(CreateFileSystemURL(kFilename)); | 370 TestRequest(CreateFileSystemURL(kFilename)); |
372 | 371 |
373 std::string mime_type_from_job; | 372 std::string mime_type_from_job; |
374 request_->GetMimeType(&mime_type_from_job); | 373 request_->GetMimeType(&mime_type_from_job); |
375 EXPECT_EQ(mime_type_direct, mime_type_from_job); | 374 EXPECT_EQ(mime_type_direct, mime_type_from_job); |
376 } | 375 } |
377 | 376 |
378 } // namespace | 377 } // namespace |
379 } // namespace fileapi | 378 } // namespace fileapi |
OLD | NEW |