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

Side by Side Diff: chrome/browser/chromeos/login/mock_url_fetchers.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 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 #include "chrome/browser/chromeos/login/mock_url_fetchers.h" 5 #include "chrome/browser/chromeos/login/mock_url_fetchers.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 14 matching lines...) Expand all
25 net::URLFetcher::RequestType request_type, 25 net::URLFetcher::RequestType request_type,
26 net::URLFetcherDelegate* d) 26 net::URLFetcherDelegate* d)
27 : net::TestURLFetcher(0, url, d), 27 : net::TestURLFetcher(0, url, d),
28 weak_factory_(this) { 28 weak_factory_(this) {
29 } 29 }
30 30
31 ExpectCanceledFetcher::~ExpectCanceledFetcher() { 31 ExpectCanceledFetcher::~ExpectCanceledFetcher() {
32 } 32 }
33 33
34 void ExpectCanceledFetcher::Start() { 34 void ExpectCanceledFetcher::Start() {
35 MessageLoop::current()->PostDelayedTask( 35 base::MessageLoop::current()->PostDelayedTask(
36 FROM_HERE, 36 FROM_HERE,
37 base::Bind(&ExpectCanceledFetcher::CompleteFetch, 37 base::Bind(&ExpectCanceledFetcher::CompleteFetch,
38 weak_factory_.GetWeakPtr()), 38 weak_factory_.GetWeakPtr()),
39 base::TimeDelta::FromMilliseconds(100)); 39 base::TimeDelta::FromMilliseconds(100));
40 } 40 }
41 41
42 void ExpectCanceledFetcher::CompleteFetch() { 42 void ExpectCanceledFetcher::CompleteFetch() {
43 ADD_FAILURE() << "Fetch completed in ExpectCanceledFetcher!"; 43 ADD_FAILURE() << "Fetch completed in ExpectCanceledFetcher!";
44 MessageLoop::current()->Quit(); // Allow exiting even if we mess up. 44 base::MessageLoop::current()->Quit(); // Allow exiting even if we mess up.
45 } 45 }
46 46
47 GotCanceledFetcher::GotCanceledFetcher( 47 GotCanceledFetcher::GotCanceledFetcher(
48 bool success, 48 bool success,
49 const GURL& url, 49 const GURL& url,
50 const std::string& results, 50 const std::string& results,
51 net::URLFetcher::RequestType request_type, 51 net::URLFetcher::RequestType request_type,
52 net::URLFetcherDelegate* d) 52 net::URLFetcherDelegate* d)
53 : net::TestURLFetcher(0, url, d) { 53 : net::TestURLFetcher(0, url, d) {
54 set_url(url); 54 set_url(url);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 VLOG(1) << upload_data(); 163 VLOG(1) << upload_data();
164 if (upload_data().find("HOSTED") == std::string::npos) { 164 if (upload_data().find("HOSTED") == std::string::npos) {
165 VLOG(1) << "HostedFetcher failing request"; 165 VLOG(1) << "HostedFetcher failing request";
166 set_response_code(net::HTTP_FORBIDDEN); 166 set_response_code(net::HTTP_FORBIDDEN);
167 SetResponseString("Error=BadAuthentication"); 167 SetResponseString("Error=BadAuthentication");
168 } 168 }
169 delegate()->OnURLFetchComplete(this); 169 delegate()->OnURLFetchComplete(this);
170 } 170 }
171 171
172 } // namespace chromeos 172 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/mock_login_status_consumer.cc ('k') | chrome/browser/chromeos/login/online_attempt_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698