| 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 "{\"issued_to\": \"1234567890.apps.googleusercontent.com\"," | 164 "{\"issued_to\": \"1234567890.apps.googleusercontent.com\"," |
| 165 "\"audience\": \"1234567890.apps.googleusercontent.com\"," | 165 "\"audience\": \"1234567890.apps.googleusercontent.com\"," |
| 166 "\"scope\": \"https://googleapis.com/oauth2/v2/tokeninfo\"," | 166 "\"scope\": \"https://googleapis.com/oauth2/v2/tokeninfo\"," |
| 167 "\"expires_in\":" + base::IntToString(kTestExpiresIn) + "}"; | 167 "\"expires_in\":" + base::IntToString(kTestExpiresIn) + "}"; |
| 168 } | 168 } |
| 169 | 169 |
| 170 namespace gaia { | 170 namespace gaia { |
| 171 | 171 |
| 172 class GaiaOAuthClientTest : public testing::Test { | 172 class GaiaOAuthClientTest : public testing::Test { |
| 173 protected: | 173 protected: |
| 174 virtual void SetUp() override { | 174 void SetUp() override { |
| 175 client_info_.client_id = "test_client_id"; | 175 client_info_.client_id = "test_client_id"; |
| 176 client_info_.client_secret = "test_client_secret"; | 176 client_info_.client_secret = "test_client_secret"; |
| 177 client_info_.redirect_uri = "test_redirect_uri"; | 177 client_info_.redirect_uri = "test_redirect_uri"; |
| 178 }; | 178 }; |
| 179 | 179 |
| 180 protected: | 180 protected: |
| 181 net::TestURLRequestContextGetter* GetRequestContext() { | 181 net::TestURLRequestContextGetter* GetRequestContext() { |
| 182 if (!request_context_getter_.get()) { | 182 if (!request_context_getter_.get()) { |
| 183 request_context_getter_ = new net::TestURLRequestContextGetter( | 183 request_context_getter_ = new net::TestURLRequestContextGetter( |
| 184 message_loop_.message_loop_proxy()); | 184 message_loop_.message_loop_proxy()); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 | 382 |
| 383 GaiaOAuthClient auth(GetRequestContext()); | 383 GaiaOAuthClient auth(GetRequestContext()); |
| 384 auth.GetTokenInfo("access_token", 1, &delegate); | 384 auth.GetTokenInfo("access_token", 1, &delegate); |
| 385 | 385 |
| 386 std::string issued_to; | 386 std::string issued_to; |
| 387 ASSERT_TRUE(captured_result->GetString("issued_to", &issued_to)); | 387 ASSERT_TRUE(captured_result->GetString("issued_to", &issued_to)); |
| 388 ASSERT_EQ("1234567890.apps.googleusercontent.com", issued_to); | 388 ASSERT_EQ("1234567890.apps.googleusercontent.com", issued_to); |
| 389 } | 389 } |
| 390 | 390 |
| 391 } // namespace gaia | 391 } // namespace gaia |
| OLD | NEW |