OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromeos/login/auth/mock_url_fetchers.h" | 5 #include "chromeos/login/auth/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/location.h" | 10 #include "base/location.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 void ExpectCanceledFetcher::Start() { | 34 void ExpectCanceledFetcher::Start() { |
35 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 35 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
36 FROM_HERE, base::Bind(&ExpectCanceledFetcher::CompleteFetch, | 36 FROM_HERE, base::Bind(&ExpectCanceledFetcher::CompleteFetch, |
37 weak_factory_.GetWeakPtr()), | 37 weak_factory_.GetWeakPtr()), |
38 base::TimeDelta::FromMilliseconds(100)); | 38 base::TimeDelta::FromMilliseconds(100)); |
39 } | 39 } |
40 | 40 |
41 void ExpectCanceledFetcher::CompleteFetch() { | 41 void ExpectCanceledFetcher::CompleteFetch() { |
42 ADD_FAILURE() << "Fetch completed in ExpectCanceledFetcher!"; | 42 ADD_FAILURE() << "Fetch completed in ExpectCanceledFetcher!"; |
43 base::MessageLoop::current()->Quit(); // Allow exiting even if we mess up. | 43 |
| 44 // Allow exiting even if we mess up. |
| 45 base::MessageLoop::current()->QuitWhenIdle(); |
44 } | 46 } |
45 | 47 |
46 GotCanceledFetcher::GotCanceledFetcher( | 48 GotCanceledFetcher::GotCanceledFetcher( |
47 bool success, | 49 bool success, |
48 const GURL& url, | 50 const GURL& url, |
49 const std::string& results, | 51 const std::string& results, |
50 net::URLFetcher::RequestType request_type, | 52 net::URLFetcher::RequestType request_type, |
51 net::URLFetcherDelegate* d) | 53 net::URLFetcherDelegate* d) |
52 : net::TestURLFetcher(0, url, d) { | 54 : net::TestURLFetcher(0, url, d) { |
53 set_url(url); | 55 set_url(url); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 VLOG(1) << upload_data(); | 169 VLOG(1) << upload_data(); |
168 if (upload_data().find("HOSTED") == std::string::npos) { | 170 if (upload_data().find("HOSTED") == std::string::npos) { |
169 VLOG(1) << "HostedFetcher failing request"; | 171 VLOG(1) << "HostedFetcher failing request"; |
170 set_response_code(net::HTTP_FORBIDDEN); | 172 set_response_code(net::HTTP_FORBIDDEN); |
171 SetResponseString("Error=BadAuthentication"); | 173 SetResponseString("Error=BadAuthentication"); |
172 } | 174 } |
173 delegate()->OnURLFetchComplete(this); | 175 delegate()->OnURLFetchComplete(this); |
174 } | 176 } |
175 | 177 |
176 } // namespace chromeos | 178 } // namespace chromeos |
OLD | NEW |