| OLD | NEW |
| 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 // A complete set of unit tests for GaiaAuthFetcher. | 5 // A complete set of unit tests for GaiaAuthFetcher. |
| 6 // Originally ported from GoogleAuthenticator tests. | 6 // Originally ported from GoogleAuthenticator tests. |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 GURL oauth2_token_source_; | 149 GURL oauth2_token_source_; |
| 150 GURL token_auth_source_; | 150 GURL token_auth_source_; |
| 151 GURL merge_session_source_; | 151 GURL merge_session_source_; |
| 152 GURL uberauth_token_source_; | 152 GURL uberauth_token_source_; |
| 153 GURL oauth_login_gurl_; | 153 GURL oauth_login_gurl_; |
| 154 | 154 |
| 155 protected: | 155 protected: |
| 156 net::TestURLRequestContextGetter* GetRequestContext() { | 156 net::TestURLRequestContextGetter* GetRequestContext() { |
| 157 if (!request_context_getter_.get()) { | 157 if (!request_context_getter_.get()) { |
| 158 request_context_getter_ = new net::TestURLRequestContextGetter( | 158 request_context_getter_ = new net::TestURLRequestContextGetter( |
| 159 message_loop_.message_loop_proxy()); | 159 message_loop_.task_runner()); |
| 160 } | 160 } |
| 161 return request_context_getter_.get(); | 161 return request_context_getter_.get(); |
| 162 } | 162 } |
| 163 | 163 |
| 164 base::MessageLoop message_loop_; | 164 base::MessageLoop message_loop_; |
| 165 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; | 165 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 class MockGaiaConsumer : public GaiaAuthConsumer { | 168 class MockGaiaConsumer : public GaiaAuthConsumer { |
| 169 public: | 169 public: |
| (...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 GaiaAuthFetcher auth(&consumer, std::string(), GetRequestContext()); | 890 GaiaAuthFetcher auth(&consumer, std::string(), GetRequestContext()); |
| 891 auth.StartGetTokenResponse(std::string(), std::string(), std::string()); | 891 auth.StartGetTokenResponse(std::string(), std::string(), std::string()); |
| 892 | 892 |
| 893 net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0); | 893 net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0); |
| 894 MockFetcher mock_fetcher( | 894 MockFetcher mock_fetcher( |
| 895 GaiaUrls::GetInstance()->oauth2_iframe_url(), | 895 GaiaUrls::GetInstance()->oauth2_iframe_url(), |
| 896 status, net::HTTP_OK, cookies_, kGetTokenPairValidResponse, | 896 status, net::HTTP_OK, cookies_, kGetTokenPairValidResponse, |
| 897 net::URLFetcher::GET, &auth); | 897 net::URLFetcher::GET, &auth); |
| 898 auth.OnURLFetchComplete(&mock_fetcher); | 898 auth.OnURLFetchComplete(&mock_fetcher); |
| 899 } | 899 } |
| OLD | NEW |