OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/fileapi/file_system_url_request_job.h" | 5 #include "webkit/browser/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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 90 } |
91 | 91 |
92 void TestRequestHelper(const GURL& url, | 92 void TestRequestHelper(const GURL& url, |
93 const net::HttpRequestHeaders* headers, | 93 const net::HttpRequestHeaders* headers, |
94 bool run_to_completion, | 94 bool run_to_completion, |
95 FileSystemContext* file_system_context) { | 95 FileSystemContext* file_system_context) { |
96 delegate_.reset(new net::TestDelegate()); | 96 delegate_.reset(new net::TestDelegate()); |
97 // Make delegate_ exit the MessageLoop when the request is done. | 97 // Make delegate_ exit the MessageLoop when the request is done. |
98 delegate_->set_quit_on_complete(true); | 98 delegate_->set_quit_on_complete(true); |
99 delegate_->set_quit_on_redirect(true); | 99 delegate_->set_quit_on_redirect(true); |
100 request_.reset(empty_context_.CreateRequest(url, delegate_.get())); | 100 request_ = empty_context_.CreateRequest( |
| 101 url, net::DEFAULT_PRIORITY, delegate_.get()); |
101 if (headers) | 102 if (headers) |
102 request_->SetExtraRequestHeaders(*headers); | 103 request_->SetExtraRequestHeaders(*headers); |
103 ASSERT_TRUE(!job_); | 104 ASSERT_TRUE(!job_); |
104 job_ = new FileSystemURLRequestJob( | 105 job_ = new FileSystemURLRequestJob( |
105 request_.get(), NULL, file_system_context); | 106 request_.get(), NULL, file_system_context); |
106 pending_job_ = job_; | 107 pending_job_ = job_; |
107 | 108 |
108 request_->Start(); | 109 request_->Start(); |
109 ASSERT_TRUE(request_->is_pending()); // verify that we're starting async | 110 ASSERT_TRUE(request_->is_pending()); // verify that we're starting async |
110 if (run_to_completion) | 111 if (run_to_completion) |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 355 |
355 // Make sure it returns success with regular (non-incognito) context. | 356 // Make sure it returns success with regular (non-incognito) context. |
356 TestRequest(CreateFileSystemURL("file")); | 357 TestRequest(CreateFileSystemURL("file")); |
357 ASSERT_FALSE(request_->is_pending()); | 358 ASSERT_FALSE(request_->is_pending()); |
358 EXPECT_EQ(kTestFileData, delegate_->data_received()); | 359 EXPECT_EQ(kTestFileData, delegate_->data_received()); |
359 EXPECT_EQ(200, request_->GetResponseCode()); | 360 EXPECT_EQ(200, request_->GetResponseCode()); |
360 } | 361 } |
361 | 362 |
362 } // namespace | 363 } // namespace |
363 } // namespace fileapi | 364 } // namespace fileapi |
OLD | NEW |