| 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_path.h" | 10 #include "base/file_path.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 ASSERT_EQ(base::PLATFORM_FILE_OK, result); | 104 ASSERT_EQ(base::PLATFORM_FILE_OK, result); |
| 105 } | 105 } |
| 106 | 106 |
| 107 void TestRequestHelper(const GURL& url, | 107 void TestRequestHelper(const GURL& url, |
| 108 const net::HttpRequestHeaders* headers, | 108 const net::HttpRequestHeaders* headers, |
| 109 bool run_to_completion) { | 109 bool run_to_completion) { |
| 110 delegate_.reset(new TestDelegate()); | 110 delegate_.reset(new TestDelegate()); |
| 111 // Make delegate_ exit the MessageLoop when the request is done. | 111 // Make delegate_ exit the MessageLoop when the request is done. |
| 112 delegate_->set_quit_on_complete(true); | 112 delegate_->set_quit_on_complete(true); |
| 113 delegate_->set_quit_on_redirect(true); | 113 delegate_->set_quit_on_redirect(true); |
| 114 request_.reset( | 114 request_.reset(empty_context_.CreateRequest(url, delegate_.get())); |
| 115 new net::URLRequest(url, delegate_.get(), &empty_context_)); | |
| 116 if (headers) | 115 if (headers) |
| 117 request_->SetExtraRequestHeaders(*headers); | 116 request_->SetExtraRequestHeaders(*headers); |
| 118 ASSERT_TRUE(!job_); | 117 ASSERT_TRUE(!job_); |
| 119 job_ = new FileSystemURLRequestJob( | 118 job_ = new FileSystemURLRequestJob( |
| 120 request_.get(), | 119 request_.get(), |
| 121 empty_context_.network_delegate(), | 120 empty_context_.network_delegate(), |
| 122 file_system_context_.get()); | 121 file_system_context_.get()); |
| 123 pending_job_ = job_; | 122 pending_job_ = job_; |
| 124 | 123 |
| 125 request_->Start(); | 124 request_->Start(); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 368 |
| 370 TestRequest(CreateFileSystemURL(kFilename)); | 369 TestRequest(CreateFileSystemURL(kFilename)); |
| 371 | 370 |
| 372 std::string mime_type_from_job; | 371 std::string mime_type_from_job; |
| 373 request_->GetMimeType(&mime_type_from_job); | 372 request_->GetMimeType(&mime_type_from_job); |
| 374 EXPECT_EQ(mime_type_direct, mime_type_from_job); | 373 EXPECT_EQ(mime_type_direct, mime_type_from_job); |
| 375 } | 374 } |
| 376 | 375 |
| 377 } // namespace | 376 } // namespace |
| 378 } // namespace fileapi | 377 } // namespace fileapi |
| OLD | NEW |