| 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 "chrome/browser/signin/signin_manager.h" | 5 #include "chrome/browser/signin/signin_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 " \"token_type\": \"Bearer\"" | 39 " \"token_type\": \"Bearer\"" |
| 40 "}"; | 40 "}"; |
| 41 | 41 |
| 42 } // namespace | 42 } // namespace |
| 43 | 43 |
| 44 | 44 |
| 45 class SigninManagerTest : public TokenServiceTestHarness { | 45 class SigninManagerTest : public TokenServiceTestHarness { |
| 46 public: | 46 public: |
| 47 virtual void SetUp() OVERRIDE { | 47 virtual void SetUp() OVERRIDE { |
| 48 prefs_.reset(new TestingPrefService); | 48 prefs_.reset(new TestingPrefService); |
| 49 browser::RegisterLocalState(prefs_.get()); | 49 chrome::RegisterLocalState(prefs_.get()); |
| 50 static_cast<TestingBrowserProcess*>(g_browser_process)->SetLocalState( | 50 static_cast<TestingBrowserProcess*>(g_browser_process)->SetLocalState( |
| 51 prefs_.get()); | 51 prefs_.get()); |
| 52 TokenServiceTestHarness::SetUp(); | 52 TokenServiceTestHarness::SetUp(); |
| 53 manager_.reset(new SigninManager()); | 53 manager_.reset(new SigninManager()); |
| 54 google_login_success_.ListenFor( | 54 google_login_success_.ListenFor( |
| 55 chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, | 55 chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, |
| 56 content::Source<Profile>(profile_.get())); | 56 content::Source<Profile>(profile_.get())); |
| 57 google_login_failure_.ListenFor(chrome::NOTIFICATION_GOOGLE_SIGNIN_FAILED, | 57 google_login_failure_.ListenFor(chrome::NOTIFICATION_GOOGLE_SIGNIN_FAILED, |
| 58 content::Source<Profile>(profile_.get())); | 58 content::Source<Profile>(profile_.get())); |
| 59 } | 59 } |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 | 457 |
| 458 manager_->ProvideOAuthChallengeResponse( | 458 manager_->ProvideOAuthChallengeResponse( |
| 459 GoogleServiceAuthError::CAPTCHA_REQUIRED, "token", "solution"); | 459 GoogleServiceAuthError::CAPTCHA_REQUIRED, "token", "solution"); |
| 460 | 460 |
| 461 SimulateProvideOAuthChallengeResponseValid(); | 461 SimulateProvideOAuthChallengeResponseValid(); |
| 462 EXPECT_EQ("user@gmail.com", manager_->GetAuthenticatedUsername()); | 462 EXPECT_EQ("user@gmail.com", manager_->GetAuthenticatedUsername()); |
| 463 | 463 |
| 464 EXPECT_EQ(1U, google_login_success_.size()); | 464 EXPECT_EQ(1U, google_login_success_.size()); |
| 465 EXPECT_EQ(1U, google_login_failure_.size()); | 465 EXPECT_EQ(1U, google_login_failure_.size()); |
| 466 } | 466 } |
| OLD | NEW |