| 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 <stack> | 5 #include <stack> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 base::Thread::Options options(MessageLoop::TYPE_IO, 0); | 137 base::Thread::Options options(MessageLoop::TYPE_IO, 0); |
| 138 io_thread_->StartWithOptions(options); | 138 io_thread_->StartWithOptions(options); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void TearDown() { | 141 void TearDown() { |
| 142 io_thread_.reset(NULL); | 142 io_thread_.reset(NULL); |
| 143 } | 143 } |
| 144 | 144 |
| 145 static net::URLRequestJob* BlobURLRequestJobFactory( | 145 static net::URLRequestJob* BlobURLRequestJobFactory( |
| 146 net::URLRequest* request, | 146 net::URLRequest* request, |
| 147 net::NetworkDelegate* network_delegate, |
| 147 const std::string& scheme) { | 148 const std::string& scheme) { |
| 148 BlobURLRequestJob* temp = blob_url_request_job_; | 149 BlobURLRequestJob* temp = blob_url_request_job_; |
| 149 blob_url_request_job_ = NULL; | 150 blob_url_request_job_ = NULL; |
| 150 return temp; | 151 return temp; |
| 151 } | 152 } |
| 152 | 153 |
| 153 BlobURLRequestJobTest() | 154 BlobURLRequestJobTest() |
| 154 : expected_status_code_(0) { | 155 : expected_status_code_(0) { |
| 155 } | 156 } |
| 156 | 157 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 void TestRequest(const std::string& method, | 242 void TestRequest(const std::string& method, |
| 242 const net::HttpRequestHeaders& extra_headers, | 243 const net::HttpRequestHeaders& extra_headers, |
| 243 BlobData* blob_data) { | 244 BlobData* blob_data) { |
| 244 // This test has async steps. | 245 // This test has async steps. |
| 245 request_.reset(new net::URLRequest(GURL("blob:blah"), | 246 request_.reset(new net::URLRequest(GURL("blob:blah"), |
| 246 url_request_delegate_.get(), | 247 url_request_delegate_.get(), |
| 247 &empty_context_)); | 248 &empty_context_)); |
| 248 request_->set_method(method); | 249 request_->set_method(method); |
| 249 blob_url_request_job_ = new BlobURLRequestJob( | 250 blob_url_request_job_ = new BlobURLRequestJob( |
| 250 request_.get(), | 251 request_.get(), |
| 252 empty_context_.network_delegate(), |
| 251 blob_data, | 253 blob_data, |
| 252 base::MessageLoopProxy::current()); | 254 base::MessageLoopProxy::current()); |
| 253 | 255 |
| 254 // Start the request. | 256 // Start the request. |
| 255 if (!extra_headers.IsEmpty()) | 257 if (!extra_headers.IsEmpty()) |
| 256 request_->SetExtraRequestHeaders(extra_headers); | 258 request_->SetExtraRequestHeaders(extra_headers); |
| 257 request_->Start(); | 259 request_->Start(); |
| 258 | 260 |
| 259 // Completion is async. | 261 // Completion is async. |
| 260 } | 262 } |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 | 446 |
| 445 TEST_F(BlobURLRequestJobTest, TestGetRangeRequest2) { | 447 TEST_F(BlobURLRequestJobTest, TestGetRangeRequest2) { |
| 446 RunTestOnIOThread(&BlobURLRequestJobTest::TestGetRangeRequest2); | 448 RunTestOnIOThread(&BlobURLRequestJobTest::TestGetRangeRequest2); |
| 447 } | 449 } |
| 448 | 450 |
| 449 TEST_F(BlobURLRequestJobTest, TestExtraHeaders) { | 451 TEST_F(BlobURLRequestJobTest, TestExtraHeaders) { |
| 450 RunTestOnIOThread(&BlobURLRequestJobTest::TestExtraHeaders); | 452 RunTestOnIOThread(&BlobURLRequestJobTest::TestExtraHeaders); |
| 451 } | 453 } |
| 452 | 454 |
| 453 } // namespace webkit_blob | 455 } // namespace webkit_blob |
| OLD | NEW |