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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 | 365 |
366 MockOAuthFetcherFactory factory; | 366 MockOAuthFetcherFactory factory; |
367 factory.set_results(kDummyFullUserInfoResult); | 367 factory.set_results(kDummyFullUserInfoResult); |
368 | 368 |
369 GaiaOAuthClient auth(GetRequestContext()); | 369 GaiaOAuthClient auth(GetRequestContext()); |
370 auth.GetUserInfo("access_token", 1, &delegate); | 370 auth.GetUserInfo("access_token", 1, &delegate); |
371 | 371 |
372 std::unique_ptr<base::Value> value = | 372 std::unique_ptr<base::Value> value = |
373 base::JSONReader::Read(kDummyFullUserInfoResult); | 373 base::JSONReader::Read(kDummyFullUserInfoResult); |
374 DCHECK(value); | 374 DCHECK(value); |
375 ASSERT_TRUE(value->IsType(base::Value::TYPE_DICTIONARY)); | 375 ASSERT_TRUE(value->IsType(base::Value::Type::DICTIONARY)); |
376 base::DictionaryValue* expected_result; | 376 base::DictionaryValue* expected_result; |
377 value->GetAsDictionary(&expected_result); | 377 value->GetAsDictionary(&expected_result); |
378 | 378 |
379 ASSERT_TRUE(expected_result->Equals(captured_result)); | 379 ASSERT_TRUE(expected_result->Equals(captured_result)); |
380 } | 380 } |
381 | 381 |
382 TEST_F(GaiaOAuthClientTest, GetTokenInfo) { | 382 TEST_F(GaiaOAuthClientTest, GetTokenInfo) { |
383 const base::DictionaryValue* captured_result; | 383 const base::DictionaryValue* captured_result; |
384 | 384 |
385 MockGaiaOAuthClientDelegate delegate; | 385 MockGaiaOAuthClientDelegate delegate; |
(...skipping 23 matching lines...) Expand all Loading... |
409 | 409 |
410 GaiaOAuthClient auth(GetRequestContext()); | 410 GaiaOAuthClient auth(GetRequestContext()); |
411 auth.GetTokenHandleInfo("some_handle", 1, &delegate); | 411 auth.GetTokenHandleInfo("some_handle", 1, &delegate); |
412 | 412 |
413 std::string audience; | 413 std::string audience; |
414 ASSERT_TRUE(captured_result->GetString("audience", &audience)); | 414 ASSERT_TRUE(captured_result->GetString("audience", &audience)); |
415 ASSERT_EQ("1234567890.apps.googleusercontent.com", audience); | 415 ASSERT_EQ("1234567890.apps.googleusercontent.com", audience); |
416 } | 416 } |
417 | 417 |
418 } // namespace gaia | 418 } // namespace gaia |
OLD | NEW |