| 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/message_loop/message_loop.h" | |
| 11 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 12 #include "net/http/http_status_code.h" | 11 #include "net/http/http_status_code.h" |
| 13 #include "net/url_request/url_fetcher.h" | 12 #include "net/url_request/url_fetcher.h" |
| 14 #include "net/url_request/url_fetcher_delegate.h" | 13 #include "net/url_request/url_fetcher_delegate.h" |
| 15 #include "net/url_request/url_request_status.h" | |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include "url/gurl.h" | |
| 18 | 15 |
| 19 namespace chromeos { | 16 namespace chromeos { |
| 20 | 17 |
| 21 ExpectCanceledFetcher::ExpectCanceledFetcher( | 18 ExpectCanceledFetcher::ExpectCanceledFetcher( |
| 22 bool success, | 19 bool success, |
| 23 const GURL& url, | 20 const GURL& url, |
| 24 const std::string& results, | 21 const std::string& results, |
| 25 net::URLFetcher::RequestType request_type, | 22 net::URLFetcher::RequestType request_type, |
| 26 net::URLFetcherDelegate* d) | 23 net::URLFetcherDelegate* d) |
| 27 : net::TestURLFetcher(0, url, d), weak_factory_(this) { | 24 : net::TestURLFetcher(0, url, d), weak_factory_(this) { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 VLOG(1) << upload_data(); | 164 VLOG(1) << upload_data(); |
| 168 if (upload_data().find("HOSTED") == std::string::npos) { | 165 if (upload_data().find("HOSTED") == std::string::npos) { |
| 169 VLOG(1) << "HostedFetcher failing request"; | 166 VLOG(1) << "HostedFetcher failing request"; |
| 170 set_response_code(net::HTTP_FORBIDDEN); | 167 set_response_code(net::HTTP_FORBIDDEN); |
| 171 SetResponseString("Error=BadAuthentication"); | 168 SetResponseString("Error=BadAuthentication"); |
| 172 } | 169 } |
| 173 delegate()->OnURLFetchComplete(this); | 170 delegate()->OnURLFetchComplete(this); |
| 174 } | 171 } |
| 175 | 172 |
| 176 } // namespace chromeos | 173 } // namespace chromeos |
| OLD | NEW |