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

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

Issue 14335017: content: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 "content/test/net/url_request_failed_job.h" 5 #include "content/test/net/url_request_failed_job.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 URLRequestFailedJob::URLRequestFailedJob(net::URLRequest* request, 44 URLRequestFailedJob::URLRequestFailedJob(net::URLRequest* request,
45 net::NetworkDelegate* network_delegate, 45 net::NetworkDelegate* network_delegate,
46 int net_error) 46 int net_error)
47 : net::URLRequestJob(request, network_delegate), 47 : net::URLRequestJob(request, network_delegate),
48 net_error_(net_error), 48 net_error_(net_error),
49 weak_factory_(this) {} 49 weak_factory_(this) {}
50 50
51 URLRequestFailedJob::~URLRequestFailedJob() {} 51 URLRequestFailedJob::~URLRequestFailedJob() {}
52 52
53 void URLRequestFailedJob::Start() { 53 void URLRequestFailedJob::Start() {
54 MessageLoop::current()->PostTask( 54 base::MessageLoop::current()->PostTask(
55 FROM_HERE, 55 FROM_HERE,
56 base::Bind(&URLRequestFailedJob::StartAsync, 56 base::Bind(&URLRequestFailedJob::StartAsync, weak_factory_.GetWeakPtr()));
57 weak_factory_.GetWeakPtr()));
58 } 57 }
59 58
60 // static 59 // static
61 void URLRequestFailedJob::AddUrlHandler() { 60 void URLRequestFailedJob::AddUrlHandler() {
62 // Add kMockHostname to net::URLRequestFilter for HTTP and HTTPS. 61 // Add kMockHostname to net::URLRequestFilter for HTTP and HTTPS.
63 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); 62 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
64 filter->AddHostnameHandler("http", kMockHostname, 63 filter->AddHostnameHandler("http", kMockHostname,
65 URLRequestFailedJob::Factory); 64 URLRequestFailedJob::Factory);
66 filter->AddHostnameHandler("https", kMockHostname, 65 filter->AddHostnameHandler("https", kMockHostname,
67 URLRequestFailedJob::Factory); 66 URLRequestFailedJob::Factory);
(...skipping 17 matching lines...) Expand all
85 return new URLRequestFailedJob( 84 return new URLRequestFailedJob(
86 request, network_delegate, GetErrorCode(request)); 85 request, network_delegate, GetErrorCode(request));
87 } 86 }
88 87
89 void URLRequestFailedJob::StartAsync() { 88 void URLRequestFailedJob::StartAsync() {
90 NotifyStartError(net::URLRequestStatus(net::URLRequestStatus::FAILED, 89 NotifyStartError(net::URLRequestStatus(net::URLRequestStatus::FAILED,
91 net_error_)); 90 net_error_));
92 } 91 }
93 92
94 } // namespace content 93 } // namespace content
OLDNEW
« no previous file with comments | « content/test/net/url_request_abort_on_end_job.cc ('k') | content/test/net/url_request_slow_download_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698