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

Side by Side Diff: content/test/net/url_request_failed_job.h

Issue 10855209: Refactoring: ProtocolHandler::MaybeCreateJob takes NetworkDelegate as argument (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest merge Created 8 years, 3 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 #ifndef CONTENT_TEST_NET_URL_REQUEST_FAILED_JOB_H_ 5 #ifndef CONTENT_TEST_NET_URL_REQUEST_FAILED_JOB_H_
6 #define CONTENT_TEST_NET_URL_REQUEST_FAILED_JOB_H_ 6 #define CONTENT_TEST_NET_URL_REQUEST_FAILED_JOB_H_
7 7
8 #include <string> 8 #include <string>
9 9
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 "googleurl/src/gurl.h" 12 #include "googleurl/src/gurl.h"
13 #include "net/url_request/url_request_job.h" 13 #include "net/url_request/url_request_job.h"
14 14
15 // This class simulates a URLRequestJob failing with a given error code while 15 // This class simulates a URLRequestJob failing with a given error code while
16 // trying to connect. 16 // trying to connect.
17 class URLRequestFailedJob : public net::URLRequestJob { 17 class URLRequestFailedJob : public net::URLRequestJob {
18 public: 18 public:
19 URLRequestFailedJob(net::URLRequest* request, int net_error); 19 URLRequestFailedJob(net::URLRequest* request,
20 net::NetworkDelegate* network_delegate,
21 int net_error);
20 22
21 virtual void Start() OVERRIDE; 23 virtual void Start() OVERRIDE;
22 24
23 // Adds the testing URLs to the net::URLRequestFilter. 25 // Adds the testing URLs to the net::URLRequestFilter.
24 static void AddUrlHandler(); 26 static void AddUrlHandler();
25 27
26 // Given a net error code, constructs a mock URL that will return that error 28 // Given a net error code, constructs a mock URL that will return that error
27 // asynchronously when started. |net_error| must be a valid net error code 29 // asynchronously when started. |net_error| must be a valid net error code
28 // other than net::OK and net::ERR_IO_PENDING. 30 // other than net::OK and net::ERR_IO_PENDING.
29 static GURL GetMockHttpUrl(int net_error); 31 static GURL GetMockHttpUrl(int net_error);
30 static GURL GetMockHttpsUrl(int net_error); 32 static GURL GetMockHttpsUrl(int net_error);
31 33
32 private: 34 private:
33 static net::URLRequestJob* Factory(net::URLRequest* request, 35 static net::URLRequestJob* Factory(net::URLRequest* request,
36 net::NetworkDelegate* network_delegate,
34 const std::string& scheme); 37 const std::string& scheme);
35 38
36 virtual ~URLRequestFailedJob(); 39 virtual ~URLRequestFailedJob();
37 40
38 // Simulate a failure. 41 // Simulate a failure.
39 void StartAsync(); 42 void StartAsync();
40 43
41 const int net_error_; 44 const int net_error_;
42 45
43 base::WeakPtrFactory<URLRequestFailedJob> weak_factory_; 46 base::WeakPtrFactory<URLRequestFailedJob> weak_factory_;
44 47
45 DISALLOW_COPY_AND_ASSIGN(URLRequestFailedJob); 48 DISALLOW_COPY_AND_ASSIGN(URLRequestFailedJob);
46 }; 49 };
47 50
48 #endif // CONTENT_TEST_NET_URL_REQUEST_FAILED_JOB_H_ 51 #endif // CONTENT_TEST_NET_URL_REQUEST_FAILED_JOB_H_
OLDNEW
« no previous file with comments | « content/test/net/url_request_abort_on_end_job.cc ('k') | content/test/net/url_request_failed_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698