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

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

Issue 1545233002: Convert Pass()→std::move() in //net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
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 #include <utility>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
11 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
12 #include "base/location.h" 13 #include "base/location.h"
13 #include "base/logging.h" 14 #include "base/logging.h"
14 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
15 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
16 #include "base/thread_task_runner_handle.h" 17 #include "base/thread_task_runner_handle.h"
17 #include "base/threading/thread_restrictions.h" 18 #include "base/threading/thread_restrictions.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 173
173 void TestURLFetcher::SaveResponseWithWriter( 174 void TestURLFetcher::SaveResponseWithWriter(
174 scoped_ptr<URLFetcherResponseWriter> response_writer) { 175 scoped_ptr<URLFetcherResponseWriter> response_writer) {
175 // In class URLFetcherCore this method is called by all three: 176 // In class URLFetcherCore this method is called by all three:
176 // GetResponseAsString() / SaveResponseToFileAtPath() / 177 // GetResponseAsString() / SaveResponseToFileAtPath() /
177 // SaveResponseToTemporaryFile(). But here (in TestURLFetcher), this method 178 // SaveResponseToTemporaryFile(). But here (in TestURLFetcher), this method
178 // is never used by any of these three methods. So, file writing is expected 179 // is never used by any of these three methods. So, file writing is expected
179 // to be done in SaveResponseToFileAtPath(), and this method supports only 180 // to be done in SaveResponseToFileAtPath(), and this method supports only
180 // URLFetcherStringWriter (for testing of this method only). 181 // URLFetcherStringWriter (for testing of this method only).
181 if (fake_response_destination_ == STRING) { 182 if (fake_response_destination_ == STRING) {
182 response_writer_ = response_writer.Pass(); 183 response_writer_ = std::move(response_writer);
183 int response = response_writer_->Initialize(CompletionCallback()); 184 int response = response_writer_->Initialize(CompletionCallback());
184 // The TestURLFetcher doesn't handle asynchronous writes. 185 // The TestURLFetcher doesn't handle asynchronous writes.
185 DCHECK_EQ(OK, response); 186 DCHECK_EQ(OK, response);
186 187
187 scoped_refptr<IOBuffer> buffer(new StringIOBuffer(fake_response_string_)); 188 scoped_refptr<IOBuffer> buffer(new StringIOBuffer(fake_response_string_));
188 response = response_writer_->Write(buffer.get(), 189 response = response_writer_->Write(buffer.get(),
189 fake_response_string_.size(), 190 fake_response_string_.size(),
190 CompletionCallback()); 191 CompletionCallback());
191 DCHECK_EQ(static_cast<int>(fake_response_string_.size()), response); 192 DCHECK_EQ(static_cast<int>(fake_response_string_.size()), response);
192 response = response_writer_->Finish(CompletionCallback()); 193 response = response_writer_->Finish(CompletionCallback());
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 486
486 scoped_ptr<URLFetcher> URLFetcherImplFactory::CreateURLFetcher( 487 scoped_ptr<URLFetcher> URLFetcherImplFactory::CreateURLFetcher(
487 int id, 488 int id,
488 const GURL& url, 489 const GURL& url,
489 URLFetcher::RequestType request_type, 490 URLFetcher::RequestType request_type,
490 URLFetcherDelegate* d) { 491 URLFetcherDelegate* d) {
491 return scoped_ptr<URLFetcher>(new URLFetcherImpl(url, request_type, d)); 492 return scoped_ptr<URLFetcher>(new URLFetcherImpl(url, request_type, d));
492 } 493 }
493 494
494 } // namespace net 495 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/sdch_dictionary_fetcher_unittest.cc ('k') | net/url_request/url_fetcher_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698