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 GaiaOAuthClient. | 5 // A complete set of unit tests for GaiaOAuthClient. |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 void SetUp() override { | 181 void SetUp() override { |
182 client_info_.client_id = "test_client_id"; | 182 client_info_.client_id = "test_client_id"; |
183 client_info_.client_secret = "test_client_secret"; | 183 client_info_.client_secret = "test_client_secret"; |
184 client_info_.redirect_uri = "test_redirect_uri"; | 184 client_info_.redirect_uri = "test_redirect_uri"; |
185 }; | 185 }; |
186 | 186 |
187 protected: | 187 protected: |
188 net::TestURLRequestContextGetter* GetRequestContext() { | 188 net::TestURLRequestContextGetter* GetRequestContext() { |
189 if (!request_context_getter_.get()) { | 189 if (!request_context_getter_.get()) { |
190 request_context_getter_ = new net::TestURLRequestContextGetter( | 190 request_context_getter_ = new net::TestURLRequestContextGetter( |
191 message_loop_.message_loop_proxy()); | 191 message_loop_.task_runner()); |
192 } | 192 } |
193 return request_context_getter_.get(); | 193 return request_context_getter_.get(); |
194 } | 194 } |
195 | 195 |
196 base::MessageLoop message_loop_; | 196 base::MessageLoop message_loop_; |
197 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; | 197 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; |
198 OAuthClientInfo client_info_; | 198 OAuthClientInfo client_info_; |
199 }; | 199 }; |
200 | 200 |
201 class MockGaiaOAuthClientDelegate : public gaia::GaiaOAuthClient::Delegate { | 201 class MockGaiaOAuthClientDelegate : public gaia::GaiaOAuthClient::Delegate { |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 | 407 |
408 GaiaOAuthClient auth(GetRequestContext()); | 408 GaiaOAuthClient auth(GetRequestContext()); |
409 auth.GetTokenHandleInfo("some_handle", 1, &delegate); | 409 auth.GetTokenHandleInfo("some_handle", 1, &delegate); |
410 | 410 |
411 std::string audience; | 411 std::string audience; |
412 ASSERT_TRUE(captured_result->GetString("audience", &audience)); | 412 ASSERT_TRUE(captured_result->GetString("audience", &audience)); |
413 ASSERT_EQ("1234567890.apps.googleusercontent.com", audience); | 413 ASSERT_EQ("1234567890.apps.googleusercontent.com", audience); |
414 } | 414 } |
415 | 415 |
416 } // namespace gaia | 416 } // namespace gaia |
OLD | NEW |