| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 void TestRequestHelper(const GURL& url, | 99 void TestRequestHelper(const GURL& url, |
| 100 const net::HttpRequestHeaders* headers, | 100 const net::HttpRequestHeaders* headers, |
| 101 bool run_to_completion, | 101 bool run_to_completion, |
| 102 FileSystemContext* file_system_context) { | 102 FileSystemContext* file_system_context) { |
| 103 delegate_.reset(new net::TestDelegate()); | 103 delegate_.reset(new net::TestDelegate()); |
| 104 // Make delegate_ exit the MessageLoop when the request is done. | 104 // Make delegate_ exit the MessageLoop when the request is done. |
| 105 delegate_->set_quit_on_complete(true); | 105 delegate_->set_quit_on_complete(true); |
| 106 delegate_->set_quit_on_redirect(true); | 106 delegate_->set_quit_on_redirect(true); |
| 107 request_ = empty_context_.CreateRequest( | 107 request_ = empty_context_.CreateRequest( |
| 108 url, net::DEFAULT_PRIORITY, delegate_.get(), NULL); | 108 url, net::DEFAULT_PRIORITY, delegate_.get()); |
| 109 if (headers) | 109 if (headers) |
| 110 request_->SetExtraRequestHeaders(*headers); | 110 request_->SetExtraRequestHeaders(*headers); |
| 111 ASSERT_TRUE(!job_); | 111 ASSERT_TRUE(!job_); |
| 112 job_ = new FileSystemURLRequestJob( | 112 job_ = new FileSystemURLRequestJob( |
| 113 request_.get(), NULL, file_system_context); | 113 request_.get(), NULL, file_system_context); |
| 114 pending_job_ = job_; | 114 pending_job_ = job_; |
| 115 | 115 |
| 116 request_->Start(); | 116 request_->Start(); |
| 117 ASSERT_TRUE(request_->is_pending()); // verify that we're starting async | 117 ASSERT_TRUE(request_->is_pending()); // verify that we're starting async |
| 118 if (run_to_completion) | 118 if (run_to_completion) |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 | 364 |
| 365 // Make sure it returns success with regular (non-incognito) context. | 365 // Make sure it returns success with regular (non-incognito) context. |
| 366 TestRequest(CreateFileSystemURL("file")); | 366 TestRequest(CreateFileSystemURL("file")); |
| 367 ASSERT_FALSE(request_->is_pending()); | 367 ASSERT_FALSE(request_->is_pending()); |
| 368 EXPECT_EQ(kTestFileData, delegate_->data_received()); | 368 EXPECT_EQ(kTestFileData, delegate_->data_received()); |
| 369 EXPECT_EQ(200, request_->GetResponseCode()); | 369 EXPECT_EQ(200, request_->GetResponseCode()); |
| 370 } | 370 } |
| 371 | 371 |
| 372 } // namespace | 372 } // namespace |
| 373 } // namespace content | 373 } // namespace content |
| OLD | NEW |