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

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

Issue 2425673006: Make URLFetcherFileWriter::Finish() skip closing file when there is an error (Closed)
Patch Set: Fix test Created 4 years, 2 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
« no previous file with comments | « google_apis/drive/base_requests.cc ('k') | net/url_request/url_fetcher_core.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 response_writer_ = std::move(response_writer); 181 response_writer_ = std::move(response_writer);
182 int response = response_writer_->Initialize(CompletionCallback()); 182 int response = response_writer_->Initialize(CompletionCallback());
183 // The TestURLFetcher doesn't handle asynchronous writes. 183 // The TestURLFetcher doesn't handle asynchronous writes.
184 DCHECK_EQ(OK, response); 184 DCHECK_EQ(OK, response);
185 185
186 scoped_refptr<IOBuffer> buffer(new StringIOBuffer(fake_response_string_)); 186 scoped_refptr<IOBuffer> buffer(new StringIOBuffer(fake_response_string_));
187 response = response_writer_->Write(buffer.get(), 187 response = response_writer_->Write(buffer.get(),
188 fake_response_string_.size(), 188 fake_response_string_.size(),
189 CompletionCallback()); 189 CompletionCallback());
190 DCHECK_EQ(static_cast<int>(fake_response_string_.size()), response); 190 DCHECK_EQ(static_cast<int>(fake_response_string_.size()), response);
191 response = response_writer_->Finish(CompletionCallback()); 191 response = response_writer_->Finish(OK, CompletionCallback());
192 DCHECK_EQ(OK, response); 192 DCHECK_EQ(OK, response);
193 } else if (fake_response_destination_ == TEMP_FILE) { 193 } else if (fake_response_destination_ == TEMP_FILE) {
194 // SaveResponseToFileAtPath() should be called instead of this method to 194 // SaveResponseToFileAtPath() should be called instead of this method to
195 // save file. Asynchronous file writing using URLFetcherFileWriter is not 195 // save file. Asynchronous file writing using URLFetcherFileWriter is not
196 // supported. 196 // supported.
197 NOTIMPLEMENTED(); 197 NOTIMPLEMENTED();
198 } else { 198 } else {
199 NOTREACHED(); 199 NOTREACHED();
200 } 200 }
201 } 201 }
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 481
482 std::unique_ptr<URLFetcher> URLFetcherImplFactory::CreateURLFetcher( 482 std::unique_ptr<URLFetcher> URLFetcherImplFactory::CreateURLFetcher(
483 int id, 483 int id,
484 const GURL& url, 484 const GURL& url,
485 URLFetcher::RequestType request_type, 485 URLFetcher::RequestType request_type,
486 URLFetcherDelegate* d) { 486 URLFetcherDelegate* d) {
487 return std::unique_ptr<URLFetcher>(new URLFetcherImpl(url, request_type, d)); 487 return std::unique_ptr<URLFetcher>(new URLFetcherImpl(url, request_type, d));
488 } 488 }
489 489
490 } // namespace net 490 } // namespace net
OLDNEW
« no previous file with comments | « google_apis/drive/base_requests.cc ('k') | net/url_request/url_fetcher_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698