| 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 signin_manager_ = static_cast<FakeSigninManagerForTesting*>( | 566 signin_manager_ = static_cast<FakeSigninManagerForTesting*>( |
| 567 SigninManagerFactory::GetInstance()->GetForProfile(profile())); | 567 SigninManagerFactory::GetInstance()->GetForProfile(profile())); |
| 568 ASSERT_TRUE(signin_manager_); | 568 ASSERT_TRUE(signin_manager_); |
| 569 token_service_ = static_cast<FakeProfileOAuth2TokenService*>( | 569 token_service_ = static_cast<FakeProfileOAuth2TokenService*>( |
| 570 ProfileOAuth2TokenServiceFactory::GetInstance()->GetForProfile( | 570 ProfileOAuth2TokenServiceFactory::GetInstance()->GetForProfile( |
| 571 profile())); | 571 profile())); |
| 572 ASSERT_TRUE(token_service_); | 572 ASSERT_TRUE(token_service_); |
| 573 } | 573 } |
| 574 | 574 |
| 575 protected: | 575 protected: |
| 576 void SignIn(const std::string account_key) { | 576 void SignIn(const std::string& account_key) { |
| 577 #if defined(OS_CHROMEOS) | 577 SignIn(account_key, account_key); |
| 578 signin_manager_->SetAuthenticatedUsername(account_key); | |
| 579 #else | |
| 580 signin_manager_->SignIn(account_key, "password"); | |
| 581 #endif | |
| 582 token_service_->IssueRefreshTokenForUser(account_key, "refresh_token"); | |
| 583 } | 578 } |
| 584 | 579 |
| 585 void SignIn(const std::string& account_key, const std::string& gaia) { | 580 void SignIn(const std::string& email, const std::string& gaia) { |
| 586 AccountTrackerService* account_tracker = | 581 AccountTrackerService* account_tracker = |
| 587 AccountTrackerServiceFactory::GetForProfile(profile()); | 582 AccountTrackerServiceFactory::GetForProfile(profile()); |
| 588 account_tracker->SeedAccountInfo(gaia, account_key); | 583 std::string account_id = |
| 589 SignIn(account_key); | 584 account_tracker->SeedAccountInfo(gaia, email); |
| 585 |
| 586 //SignIn(account_key); |
| 587 #if defined(OS_CHROMEOS) |
| 588 signin_manager_->SetAuthenticatedAccountInfo(gaia, email); |
| 589 #else |
| 590 signin_manager_->SignIn(gaia, email, "password"); |
| 591 #endif |
| 592 token_service_->IssueRefreshTokenForUser(account_id, "refresh_token"); |
| 590 } | 593 } |
| 591 | 594 |
| 592 FakeSigninManagerForTesting* signin_manager_; | 595 FakeSigninManagerForTesting* signin_manager_; |
| 593 FakeProfileOAuth2TokenService* token_service_; | 596 FakeProfileOAuth2TokenService* token_service_; |
| 594 | 597 |
| 595 scoped_ptr<base::CallbackList<void(content::BrowserContext*)>::Subscription> | 598 scoped_ptr<base::CallbackList<void(content::BrowserContext*)>::Subscription> |
| 596 will_create_browser_context_services_subscription_; | 599 will_create_browser_context_services_subscription_; |
| 597 }; | 600 }; |
| 598 | 601 |
| 599 class IdentityGetProfileUserInfoFunctionTest : public IdentityTestWithSignin { | 602 class IdentityGetProfileUserInfoFunctionTest : public IdentityTestWithSignin { |
| (...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1821 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), | 1824 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), |
| 1822 url); | 1825 url); |
| 1823 } | 1826 } |
| 1824 | 1827 |
| 1825 } // namespace extensions | 1828 } // namespace extensions |
| 1826 | 1829 |
| 1827 // Tests the chrome.identity API implemented by custom JS bindings . | 1830 // Tests the chrome.identity API implemented by custom JS bindings . |
| 1828 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeIdentityJsBindings) { | 1831 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeIdentityJsBindings) { |
| 1829 ASSERT_TRUE(RunExtensionTest("identity/js_bindings")) << message_; | 1832 ASSERT_TRUE(RunExtensionTest("identity/js_bindings")) << message_; |
| 1830 } | 1833 } |
| OLD | NEW |