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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 class GaiaOAuthClientTest : public testing::Test { | 173 class GaiaOAuthClientTest : public testing::Test { |
174 protected: | 174 protected: |
175 virtual void SetUp() OVERRIDE { | 175 virtual void SetUp() OVERRIDE { |
176 client_info_.client_id = "test_client_id"; | 176 client_info_.client_id = "test_client_id"; |
177 client_info_.client_secret = "test_client_secret"; | 177 client_info_.client_secret = "test_client_secret"; |
178 client_info_.redirect_uri = "test_redirect_uri"; | 178 client_info_.redirect_uri = "test_redirect_uri"; |
179 }; | 179 }; |
180 | 180 |
181 protected: | 181 protected: |
182 net::TestURLRequestContextGetter* GetRequestContext() { | 182 net::TestURLRequestContextGetter* GetRequestContext() { |
183 if (!request_context_getter_) { | 183 if (!request_context_getter_.get()) { |
184 request_context_getter_ = new net::TestURLRequestContextGetter( | 184 request_context_getter_ = new net::TestURLRequestContextGetter( |
185 message_loop_.message_loop_proxy()); | 185 message_loop_.message_loop_proxy()); |
186 } | 186 } |
187 return request_context_getter_; | 187 return request_context_getter_.get(); |
188 } | 188 } |
189 | 189 |
190 base::MessageLoop message_loop_; | 190 base::MessageLoop message_loop_; |
191 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; | 191 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; |
192 OAuthClientInfo client_info_; | 192 OAuthClientInfo client_info_; |
193 }; | 193 }; |
194 | 194 |
195 class MockGaiaOAuthClientDelegate : public gaia::GaiaOAuthClient::Delegate { | 195 class MockGaiaOAuthClientDelegate : public gaia::GaiaOAuthClient::Delegate { |
196 public: | 196 public: |
197 MockGaiaOAuthClientDelegate() {} | 197 MockGaiaOAuthClientDelegate() {} |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 | 383 |
384 GaiaOAuthClient auth(GetRequestContext()); | 384 GaiaOAuthClient auth(GetRequestContext()); |
385 auth.GetTokenInfo("access_token", 1, &delegate); | 385 auth.GetTokenInfo("access_token", 1, &delegate); |
386 | 386 |
387 std::string issued_to; | 387 std::string issued_to; |
388 ASSERT_TRUE(captured_result->GetString("issued_to", &issued_to)); | 388 ASSERT_TRUE(captured_result->GetString("issued_to", &issued_to)); |
389 ASSERT_EQ("1234567890.apps.googleusercontent.com", issued_to); | 389 ASSERT_EQ("1234567890.apps.googleusercontent.com", issued_to); |
390 } | 390 } |
391 | 391 |
392 } // namespace gaia | 392 } // namespace gaia |
OLD | NEW |