| 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 "net/url_request/test_url_fetcher_factory.h" | 5 #include "net/url_request/test_url_fetcher_factory.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
| 15 #include "net/base/host_port_pair.h" | 15 #include "net/base/host_port_pair.h" |
| 16 #include "net/base/io_buffer.h" | 16 #include "net/base/io_buffer.h" |
| 17 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
| 18 #include "net/base/upload_data_stream.h" |
| 18 #include "net/http/http_response_headers.h" | 19 #include "net/http/http_response_headers.h" |
| 19 #include "net/url_request/url_fetcher_delegate.h" | 20 #include "net/url_request/url_fetcher_delegate.h" |
| 20 #include "net/url_request/url_fetcher_impl.h" | 21 #include "net/url_request/url_fetcher_impl.h" |
| 21 #include "net/url_request/url_fetcher_response_writer.h" | 22 #include "net/url_request/url_fetcher_response_writer.h" |
| 22 #include "net/url_request/url_request_status.h" | 23 #include "net/url_request/url_request_status.h" |
| 23 | 24 |
| 24 namespace net { | 25 namespace net { |
| 25 | 26 |
| 26 ScopedURLFetcherFactory::ScopedURLFetcherFactory( | 27 ScopedURLFetcherFactory::ScopedURLFetcherFactory( |
| 27 URLFetcherFactory* factory) { | 28 URLFetcherFactory* factory) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 67 |
| 67 void TestURLFetcher::SetUploadFilePath( | 68 void TestURLFetcher::SetUploadFilePath( |
| 68 const std::string& upload_content_type, | 69 const std::string& upload_content_type, |
| 69 const base::FilePath& file_path, | 70 const base::FilePath& file_path, |
| 70 uint64 range_offset, | 71 uint64 range_offset, |
| 71 uint64 range_length, | 72 uint64 range_length, |
| 72 scoped_refptr<base::TaskRunner> file_task_runner) { | 73 scoped_refptr<base::TaskRunner> file_task_runner) { |
| 73 upload_file_path_ = file_path; | 74 upload_file_path_ = file_path; |
| 74 } | 75 } |
| 75 | 76 |
| 77 void TestURLFetcher::SetUploadStreamFactory( |
| 78 const std::string& upload_content_type, |
| 79 const CreateUploadStreamCallback& factory) { |
| 80 } |
| 81 |
| 76 void TestURLFetcher::SetChunkedUpload(const std::string& upload_content_type) { | 82 void TestURLFetcher::SetChunkedUpload(const std::string& upload_content_type) { |
| 77 } | 83 } |
| 78 | 84 |
| 79 void TestURLFetcher::AppendChunkToUpload(const std::string& data, | 85 void TestURLFetcher::AppendChunkToUpload(const std::string& data, |
| 80 bool is_last_chunk) { | 86 bool is_last_chunk) { |
| 81 DCHECK(!did_receive_last_chunk_); | 87 DCHECK(!did_receive_last_chunk_); |
| 82 did_receive_last_chunk_ = is_last_chunk; | 88 did_receive_last_chunk_ = is_last_chunk; |
| 83 chunks_.push_back(data); | 89 chunks_.push_back(data); |
| 84 if (delegate_for_tests_) | 90 if (delegate_for_tests_) |
| 85 delegate_for_tests_->OnChunkUpload(id_); | 91 delegate_for_tests_->OnChunkUpload(id_); |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 | 445 |
| 440 URLFetcher* URLFetcherImplFactory::CreateURLFetcher( | 446 URLFetcher* URLFetcherImplFactory::CreateURLFetcher( |
| 441 int id, | 447 int id, |
| 442 const GURL& url, | 448 const GURL& url, |
| 443 URLFetcher::RequestType request_type, | 449 URLFetcher::RequestType request_type, |
| 444 URLFetcherDelegate* d) { | 450 URLFetcherDelegate* d) { |
| 445 return new URLFetcherImpl(url, request_type, d); | 451 return new URLFetcherImpl(url, request_type, d); |
| 446 } | 452 } |
| 447 | 453 |
| 448 } // namespace net | 454 } // namespace net |
| OLD | NEW |