Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Side by Side Diff: net/url_request/test_url_fetcher_factory.cc

Issue 151133002: libaddressinput - one less copy when downloading data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move ownership of urlfetcher Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "net/base/host_port_pair.h" 13 #include "net/base/host_port_pair.h"
14 #include "net/base/io_buffer.h"
14 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
15 #include "net/http/http_response_headers.h" 16 #include "net/http/http_response_headers.h"
16 #include "net/url_request/url_fetcher_delegate.h" 17 #include "net/url_request/url_fetcher_delegate.h"
17 #include "net/url_request/url_fetcher_impl.h" 18 #include "net/url_request/url_fetcher_impl.h"
18 #include "net/url_request/url_fetcher_response_writer.h" 19 #include "net/url_request/url_fetcher_response_writer.h"
19 #include "net/url_request/url_request_status.h" 20 #include "net/url_request/url_request_status.h"
20 21
21 namespace net { 22 namespace net {
22 23
23 ScopedURLFetcherFactory::ScopedURLFetcherFactory( 24 ScopedURLFetcherFactory::ScopedURLFetcherFactory(
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 const base::FilePath& file_path, 149 const base::FilePath& file_path,
149 scoped_refptr<base::SequencedTaskRunner> file_task_runner) { 150 scoped_refptr<base::SequencedTaskRunner> file_task_runner) {
150 } 151 }
151 152
152 void TestURLFetcher::SaveResponseToTemporaryFile( 153 void TestURLFetcher::SaveResponseToTemporaryFile(
153 scoped_refptr<base::SequencedTaskRunner> file_task_runner) { 154 scoped_refptr<base::SequencedTaskRunner> file_task_runner) {
154 } 155 }
155 156
156 void TestURLFetcher::SaveResponseWithWriter( 157 void TestURLFetcher::SaveResponseWithWriter(
157 scoped_ptr<URLFetcherResponseWriter> response_writer) { 158 scoped_ptr<URLFetcherResponseWriter> response_writer) {
159 if (fake_response_destination_ == STRING) {
160 response_writer_ = response_writer.Pass();
161 response_writer_->Initialize(CompletionCallback());
162
163 scoped_refptr<IOBuffer> buffer = new StringIOBuffer(fake_response_string_);
Ryan Sleevi 2014/01/31 21:03:17 pedantic nit: buffer(new StringIOBuffer(...)) ?
Evan Stade 2014/01/31 22:56:47 Done.
164 response_writer_->Write(buffer.get(),
165 fake_response_string_.size(),
166 CompletionCallback());
Ryan Sleevi 2014/01/31 21:03:17 This doesn't fully match the URLFetcher / URLFetch
Evan Stade 2014/01/31 22:24:57 well, it has several flaws: a) SetResponseString
Evan Stade 2014/01/31 22:56:47 Done.
167 response_writer_->Finish(CompletionCallback());
168 }
158 } 169 }
159 170
160 HttpResponseHeaders* TestURLFetcher::GetResponseHeaders() const { 171 HttpResponseHeaders* TestURLFetcher::GetResponseHeaders() const {
161 return fake_response_headers_.get(); 172 return fake_response_headers_.get();
162 } 173 }
163 174
164 HostPortPair TestURLFetcher::GetSocketAddress() const { 175 HostPortPair TestURLFetcher::GetSocketAddress() const {
165 NOTIMPLEMENTED(); 176 NOTIMPLEMENTED();
166 return HostPortPair(); 177 return HostPortPair();
167 } 178 }
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 412
402 URLFetcher* URLFetcherImplFactory::CreateURLFetcher( 413 URLFetcher* URLFetcherImplFactory::CreateURLFetcher(
403 int id, 414 int id,
404 const GURL& url, 415 const GURL& url,
405 URLFetcher::RequestType request_type, 416 URLFetcher::RequestType request_type,
406 URLFetcherDelegate* d) { 417 URLFetcherDelegate* d) {
407 return new URLFetcherImpl(url, request_type, d); 418 return new URLFetcherImpl(url, request_type, d);
408 } 419 }
409 420
410 } // namespace net 421 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/test_url_fetcher_factory.h ('k') | third_party/libaddressinput/chromium/chrome_downloader_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698