OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_auth_response_handler.h" | 5 #include "chrome/browser/chromeos/login/mock_auth_response_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
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 25 matching lines...) Expand all Loading... |
36 } | 36 } |
37 | 37 |
38 MockAuthResponseHandler::~MockAuthResponseHandler() {} | 38 MockAuthResponseHandler::~MockAuthResponseHandler() {} |
39 | 39 |
40 void MockAuthResponseHandler::CompleteFetch( | 40 void MockAuthResponseHandler::CompleteFetch( |
41 content::URLFetcherDelegate* delegate, | 41 content::URLFetcherDelegate* delegate, |
42 const GURL remote, | 42 const GURL remote, |
43 const net::URLRequestStatus status, | 43 const net::URLRequestStatus status, |
44 const int http_response_code, | 44 const int http_response_code, |
45 const std::string data) { | 45 const std::string data) { |
46 TestURLFetcher fetcher(0, GURL(), content::URLFetcher::GET, delegate); | 46 TestURLFetcher fetcher(0, GURL(), delegate); |
47 fetcher.set_url(remote); | 47 fetcher.set_url(remote); |
48 fetcher.set_status(status); | 48 fetcher.set_status(status); |
49 fetcher.set_response_code(http_response_code); | 49 fetcher.set_response_code(http_response_code); |
50 fetcher.SetResponseString(data); | 50 fetcher.SetResponseString(data); |
51 delegate->OnURLFetchComplete(&fetcher); | 51 delegate->OnURLFetchComplete(&fetcher); |
52 } | 52 } |
53 | 53 |
54 content::URLFetcher* MockAuthResponseHandler::MockNetwork( | 54 content::URLFetcher* MockAuthResponseHandler::MockNetwork( |
55 std::string data, | 55 std::string data, |
56 content::URLFetcherDelegate* delegate) { | 56 content::URLFetcherDelegate* delegate) { |
57 MessageLoop::current()->PostTask( | 57 MessageLoop::current()->PostTask( |
58 FROM_HERE, | 58 FROM_HERE, |
59 base::Bind(MockAuthResponseHandler::CompleteFetch, delegate, remote_, | 59 base::Bind(MockAuthResponseHandler::CompleteFetch, delegate, remote_, |
60 status_, http_response_code_, data_)); | 60 status_, http_response_code_, data_)); |
61 return content::URLFetcher::Create( | 61 return content::URLFetcher::Create( |
62 GURL(), content::URLFetcher::GET, delegate); | 62 GURL(), content::URLFetcher::GET, delegate); |
63 } | 63 } |
64 | 64 |
65 } // namespace chromeos | 65 } // namespace chromeos |
OLD | NEW |