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

Side by Side Diff: content/test/net/url_request_failed_dns_job.cc

Issue 9704023: Replace URLRequestFailedDnsJob with URLRequestFailedJob (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix weak ptr factory usage Created 8 years, 9 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/test/net/url_request_failed_dns_job.h"
6
7 #include "base/bind.h"
8 #include "base/compiler_specific.h"
9 #include "base/message_loop.h"
10 #include "googleurl/src/gurl.h"
11 #include "net/base/net_errors.h"
12 #include "net/url_request/url_request.h"
13 #include "net/url_request/url_request_filter.h"
14
15 const char URLRequestFailedDnsJob::kTestUrl[] =
16 "http://url.handled.by.fake.dns/";
17
18 URLRequestFailedDnsJob::URLRequestFailedDnsJob(net::URLRequest* request)
19 : net::URLRequestJob(request),
20 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {}
21
22 URLRequestFailedDnsJob::~URLRequestFailedDnsJob() {}
23
24 void URLRequestFailedDnsJob::Start() {
25 MessageLoop::current()->PostTask(
26 FROM_HERE,
27 base::Bind(&URLRequestFailedDnsJob::StartAsync,
28 weak_factory_.GetWeakPtr()));
29 }
30
31 // static
32 void URLRequestFailedDnsJob::AddUrlHandler() {
33 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
34 filter->AddUrlHandler(GURL(kTestUrl),
35 &URLRequestFailedDnsJob::Factory);
36 }
37
38 /*static */
39 net::URLRequestJob* URLRequestFailedDnsJob::Factory(net::URLRequest* request,
40 const std::string& scheme) {
41 return new URLRequestFailedDnsJob(request);
42 }
43
44 void URLRequestFailedDnsJob::StartAsync() {
45 NotifyStartError(net::URLRequestStatus(net::URLRequestStatus::FAILED,
46 net::ERR_NAME_NOT_RESOLVED));
47 }
OLDNEW
« no previous file with comments | « content/test/net/url_request_failed_dns_job.h ('k') | content/test/net/url_request_failed_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698