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

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

Issue 23625015: Consolidate TestURLFetcherFactory::SetFakeResponse (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 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 | 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"
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 return default_factory_->CreateURLFetcher(id, url, request_type, d); 350 return default_factory_->CreateURLFetcher(id, url, request_type, d);
351 } 351 }
352 } 352 }
353 353
354 scoped_ptr<FakeURLFetcher> fake_fetcher = 354 scoped_ptr<FakeURLFetcher> fake_fetcher =
355 creator_.Run(url, d, it->second.first, it->second.second); 355 creator_.Run(url, d, it->second.first, it->second.second);
356 // TODO: Make URLFetcherFactory::CreateURLFetcher return a scoped_ptr 356 // TODO: Make URLFetcherFactory::CreateURLFetcher return a scoped_ptr
357 return fake_fetcher.release(); 357 return fake_fetcher.release();
358 } 358 }
359 359
360 void FakeURLFetcherFactory::SetFakeResponseForURL( 360 void FakeURLFetcherFactory::SetFakeResponse(
361 const GURL& url, 361 const GURL& url,
362 const std::string& response_data, 362 const std::string& response_data,
363 bool success) { 363 bool success) {
364 // Overwrite existing URL if it already exists. 364 // Overwrite existing URL if it already exists.
365 fake_responses_[url] = std::make_pair(response_data, success); 365 fake_responses_[url] = std::make_pair(response_data, success);
366 } 366 }
367 367
368 void FakeURLFetcherFactory::SetFakeResponse(const std::string& url,
369 const std::string& response_data,
370 bool success) {
371 SetFakeResponseForURL(GURL(url), response_data, success);
372 }
373
374 void FakeURLFetcherFactory::ClearFakeResponses() { 368 void FakeURLFetcherFactory::ClearFakeResponses() {
375 fake_responses_.clear(); 369 fake_responses_.clear();
376 } 370 }
377 371
378 URLFetcherImplFactory::URLFetcherImplFactory() {} 372 URLFetcherImplFactory::URLFetcherImplFactory() {}
379 373
380 URLFetcherImplFactory::~URLFetcherImplFactory() {} 374 URLFetcherImplFactory::~URLFetcherImplFactory() {}
381 375
382 URLFetcher* URLFetcherImplFactory::CreateURLFetcher( 376 URLFetcher* URLFetcherImplFactory::CreateURLFetcher(
383 int id, 377 int id,
384 const GURL& url, 378 const GURL& url,
385 URLFetcher::RequestType request_type, 379 URLFetcher::RequestType request_type,
386 URLFetcherDelegate* d) { 380 URLFetcherDelegate* d) {
387 return new URLFetcherImpl(url, request_type, d); 381 return new URLFetcherImpl(url, request_type, d);
388 } 382 }
389 383
390 } // namespace net 384 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/test_url_fetcher_factory.h ('k') | remoting/host/token_validator_factory_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698