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 #include <set> | 5 #include <set> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 AccountTrackerService* account_tracker = | 584 AccountTrackerService* account_tracker = |
585 AccountTrackerServiceFactory::GetForProfile(profile()); | 585 AccountTrackerServiceFactory::GetForProfile(profile()); |
586 std::string account_id = | 586 std::string account_id = |
587 account_tracker->SeedAccountInfo(gaia, email); | 587 account_tracker->SeedAccountInfo(gaia, email); |
588 | 588 |
589 #if defined(OS_CHROMEOS) | 589 #if defined(OS_CHROMEOS) |
590 signin_manager_->SetAuthenticatedAccountInfo(gaia, email); | 590 signin_manager_->SetAuthenticatedAccountInfo(gaia, email); |
591 #else | 591 #else |
592 signin_manager_->SignIn(gaia, email, "password"); | 592 signin_manager_->SignIn(gaia, email, "password"); |
593 #endif | 593 #endif |
594 token_service_->IssueRefreshTokenForUser(account_id, "refresh_token"); | 594 token_service_->UpdateCredentials(account_id, "refresh_token"); |
595 } | 595 } |
596 | 596 |
597 FakeSigninManagerForTesting* signin_manager_; | 597 FakeSigninManagerForTesting* signin_manager_; |
598 FakeProfileOAuth2TokenService* token_service_; | 598 FakeProfileOAuth2TokenService* token_service_; |
599 | 599 |
600 scoped_ptr<base::CallbackList<void(content::BrowserContext*)>::Subscription> | 600 scoped_ptr<base::CallbackList<void(content::BrowserContext*)>::Subscription> |
601 will_create_browser_context_services_subscription_; | 601 will_create_browser_context_services_subscription_; |
602 }; | 602 }; |
603 | 603 |
604 class IdentityGetProfileUserInfoFunctionTest : public IdentityTestWithSignin { | 604 class IdentityGetProfileUserInfoFunctionTest : public IdentityTestWithSignin { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 } | 662 } |
663 | 663 |
664 class GetAuthTokenFunctionTest : public IdentityTestWithSignin { | 664 class GetAuthTokenFunctionTest : public IdentityTestWithSignin { |
665 public: | 665 public: |
666 void SetUpCommandLine(base::CommandLine* command_line) override { | 666 void SetUpCommandLine(base::CommandLine* command_line) override { |
667 IdentityTestWithSignin::SetUpCommandLine(command_line); | 667 IdentityTestWithSignin::SetUpCommandLine(command_line); |
668 command_line->AppendSwitch(switches::kExtensionsMultiAccount); | 668 command_line->AppendSwitch(switches::kExtensionsMultiAccount); |
669 } | 669 } |
670 | 670 |
671 void IssueLoginRefreshTokenForAccount(const std::string account_key) { | 671 void IssueLoginRefreshTokenForAccount(const std::string account_key) { |
672 token_service_->IssueRefreshTokenForUser(account_key, "refresh_token"); | 672 token_service_->UpdateCredentials(account_key, "refresh_token"); |
673 } | 673 } |
674 | 674 |
675 void IssueLoginAccessTokenForAccount(const std::string account_key) { | 675 void IssueLoginAccessTokenForAccount(const std::string account_key) { |
676 token_service_->IssueAllTokensForAccount( | 676 token_service_->IssueAllTokensForAccount( |
677 account_key, | 677 account_key, |
678 "access_token-" + account_key, | 678 "access_token-" + account_key, |
679 base::Time::Now() + base::TimeDelta::FromSeconds(3600)); | 679 base::Time::Now() + base::TimeDelta::FromSeconds(3600)); |
680 } | 680 } |
681 | 681 |
682 void SetAccountState(gaia::AccountIds ids, bool is_signed_in) { | 682 void SetAccountState(gaia::AccountIds ids, bool is_signed_in) { |
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1826 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), | 1826 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), |
1827 url); | 1827 url); |
1828 } | 1828 } |
1829 | 1829 |
1830 } // namespace extensions | 1830 } // namespace extensions |
1831 | 1831 |
1832 // Tests the chrome.identity API implemented by custom JS bindings . | 1832 // Tests the chrome.identity API implemented by custom JS bindings . |
1833 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeIdentityJsBindings) { | 1833 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeIdentityJsBindings) { |
1834 ASSERT_TRUE(RunExtensionTest("identity/js_bindings")) << message_; | 1834 ASSERT_TRUE(RunExtensionTest("identity/js_bindings")) << message_; |
1835 } | 1835 } |
OLD | NEW |