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

Side by Side Diff: content/test/test_url_fetcher_factory.cc

Issue 8054013: Recover from bad proxy settings pointing to non-proxy servers that reply anyway. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/test/test_url_fetcher_factory.h" 5 #include "content/test/test_url_fetcher_factory.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "net/http/http_response_headers.h"
11 #include "net/url_request/url_request_status.h" 12 #include "net/url_request/url_request_status.h"
12 13
13 ScopedURLFetcherFactory::ScopedURLFetcherFactory(URLFetcher::Factory* factory) { 14 ScopedURLFetcherFactory::ScopedURLFetcherFactory(URLFetcher::Factory* factory) {
14 DCHECK(!URLFetcher::factory()); 15 DCHECK(!URLFetcher::factory());
15 URLFetcher::set_factory(factory); 16 URLFetcher::set_factory(factory);
16 } 17 }
17 18
18 ScopedURLFetcherFactory::~ScopedURLFetcherFactory() { 19 ScopedURLFetcherFactory::~ScopedURLFetcherFactory() {
19 DCHECK(URLFetcher::factory()); 20 DCHECK(URLFetcher::factory());
20 URLFetcher::set_factory(NULL); 21 URLFetcher::set_factory(NULL);
(...skipping 20 matching lines...) Expand all
41 } 42 }
42 43
43 const GURL& TestURLFetcher::original_url() const { 44 const GURL& TestURLFetcher::original_url() const {
44 return original_url_; 45 return original_url_;
45 } 46 }
46 47
47 void TestURLFetcher::set_status(const net::URLRequestStatus& status) { 48 void TestURLFetcher::set_status(const net::URLRequestStatus& status) {
48 fake_status_ = status; 49 fake_status_ = status;
49 } 50 }
50 51
52 void TestURLFetcher::set_was_fetched_via_proxy(bool flag) {
53 URLFetcher::set_was_fetched_via_proxy(flag);
54 }
55
56 void TestURLFetcher::set_response_headers(
57 scoped_refptr<net::HttpResponseHeaders> headers) {
58 URLFetcher::set_response_headers(headers);
59 }
60
51 void TestURLFetcher::SetResponseString(const std::string& response) { 61 void TestURLFetcher::SetResponseString(const std::string& response) {
52 SetResponseDestinationForTesting(STRING); 62 SetResponseDestinationForTesting(STRING);
53 fake_response_string_ = response; 63 fake_response_string_ = response;
54 } 64 }
55 65
56 void TestURLFetcher::SetResponseFilePath(const FilePath& path) { 66 void TestURLFetcher::SetResponseFilePath(const FilePath& path) {
57 SetResponseDestinationForTesting(TEMP_FILE); 67 SetResponseDestinationForTesting(TEMP_FILE);
58 fake_response_file_path_ = path; 68 fake_response_file_path_ = path;
59 } 69 }
60 70
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 250
241 URLFetcherFactory::~URLFetcherFactory() {} 251 URLFetcherFactory::~URLFetcherFactory() {}
242 252
243 URLFetcher* URLFetcherFactory::CreateURLFetcher( 253 URLFetcher* URLFetcherFactory::CreateURLFetcher(
244 int id, 254 int id,
245 const GURL& url, 255 const GURL& url,
246 URLFetcher::RequestType request_type, 256 URLFetcher::RequestType request_type,
247 URLFetcher::Delegate* d) { 257 URLFetcher::Delegate* d) {
248 return new URLFetcher(url, request_type, d); 258 return new URLFetcher(url, request_type, d);
249 } 259 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698