| 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_url_request_job.h" | 5 #include "webkit/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/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 bool run_to_completion) { | 101 bool run_to_completion) { |
| 102 delegate_.reset(new net::TestDelegate()); | 102 delegate_.reset(new net::TestDelegate()); |
| 103 // Make delegate_ exit the MessageLoop when the request is done. | 103 // Make delegate_ exit the MessageLoop when the request is done. |
| 104 delegate_->set_quit_on_complete(true); | 104 delegate_->set_quit_on_complete(true); |
| 105 delegate_->set_quit_on_redirect(true); | 105 delegate_->set_quit_on_redirect(true); |
| 106 request_.reset(empty_context_.CreateRequest(url, delegate_.get())); | 106 request_.reset(empty_context_.CreateRequest(url, delegate_.get())); |
| 107 if (headers) | 107 if (headers) |
| 108 request_->SetExtraRequestHeaders(*headers); | 108 request_->SetExtraRequestHeaders(*headers); |
| 109 ASSERT_TRUE(!job_); | 109 ASSERT_TRUE(!job_); |
| 110 job_ = new FileSystemURLRequestJob( | 110 job_ = new FileSystemURLRequestJob( |
| 111 request_.get(), | 111 request_.get(), NULL, file_system_context_.get()); |
| 112 empty_context_.network_delegate(), | |
| 113 file_system_context_.get()); | |
| 114 pending_job_ = job_; | 112 pending_job_ = job_; |
| 115 | 113 |
| 116 request_->Start(); | 114 request_->Start(); |
| 117 ASSERT_TRUE(request_->is_pending()); // verify that we're starting async | 115 ASSERT_TRUE(request_->is_pending()); // verify that we're starting async |
| 118 if (run_to_completion) | 116 if (run_to_completion) |
| 119 MessageLoop::current()->Run(); | 117 MessageLoop::current()->Run(); |
| 120 } | 118 } |
| 121 | 119 |
| 122 void TestRequest(const GURL& url) { | 120 void TestRequest(const GURL& url) { |
| 123 TestRequestHelper(url, NULL, true); | 121 TestRequestHelper(url, NULL, true); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 | 360 |
| 363 TestRequest(CreateFileSystemURL(kFilename)); | 361 TestRequest(CreateFileSystemURL(kFilename)); |
| 364 | 362 |
| 365 std::string mime_type_from_job; | 363 std::string mime_type_from_job; |
| 366 request_->GetMimeType(&mime_type_from_job); | 364 request_->GetMimeType(&mime_type_from_job); |
| 367 EXPECT_EQ(mime_type_direct, mime_type_from_job); | 365 EXPECT_EQ(mime_type_direct, mime_type_from_job); |
| 368 } | 366 } |
| 369 | 367 |
| 370 } // namespace | 368 } // namespace |
| 371 } // namespace fileapi | 369 } // namespace fileapi |
| OLD | NEW |