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

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

Issue 10020051: Open a login tab on captive portal detection on SSL loads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Update comments Created 8 years, 6 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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
15 #include "net/url_request/url_request_job.h" 15 #include "net/url_request/url_request_job.h"
16 16
17 // This class simulates a URLRequestJob failing with a given error code while 17 // This class simulates a URLRequestJob failing with a given error code while
18 // trying to connect. 18 // trying to connect.
19 class URLRequestFailedJob : public net::URLRequestJob { 19 class CONTENT_EXPORT URLRequestFailedJob : public net::URLRequestJob {
20 public: 20 public:
21 URLRequestFailedJob(net::URLRequest* request, int net_error); 21 URLRequestFailedJob(net::URLRequest* request, int net_error);
22 22
23 virtual void Start() OVERRIDE; 23 virtual void Start() OVERRIDE;
24 24
25 // Adds the testing URLs to the net::URLRequestFilter. 25 // Adds the testing URLs to the net::URLRequestFilter.
26 CONTENT_EXPORT static void AddUrlHandler(); 26 static void AddUrlHandler();
27 27
28 // 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
29 // 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
30 // other than net::OK and net::ERR_IO_PENDING. 30 // other than net::OK and net::ERR_IO_PENDING.
31 CONTENT_EXPORT static GURL GetMockHttpUrl(int net_error); 31 static GURL GetMockHttpUrl(int net_error);
32 CONTENT_EXPORT static GURL GetMockHttpsUrl(int net_error); 32 static GURL GetMockHttpsUrl(int net_error);
33 33
34 private: 34 private:
35 static net::URLRequestJob* Factory(net::URLRequest* request, 35 static net::URLRequestJob* Factory(net::URLRequest* request,
36 const std::string& scheme); 36 const std::string& scheme);
37 37
38 virtual ~URLRequestFailedJob(); 38 virtual ~URLRequestFailedJob();
39 39
40 // Simulate a failure. 40 // Simulate a failure.
41 void StartAsync(); 41 void StartAsync();
42 42
43 const int net_error_; 43 const int net_error_;
44 44
45 base::WeakPtrFactory<URLRequestFailedJob> weak_factory_; 45 base::WeakPtrFactory<URLRequestFailedJob> weak_factory_;
46 46
47 DISALLOW_COPY_AND_ASSIGN(URLRequestFailedJob); 47 DISALLOW_COPY_AND_ASSIGN(URLRequestFailedJob);
48 }; 48 };
49 49
50 #endif // CONTENT_TEST_NET_URL_REQUEST_FAILED_JOB_H_ 50 #endif // CONTENT_TEST_NET_URL_REQUEST_FAILED_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698