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 TestingPrefServiceSimple); | 48 prefs_.reset(new TestingPrefServiceSimple); |
49 chrome::RegisterLocalState(prefs_.get()); | 49 chrome::RegisterLocalState(prefs_->registry(), prefs_.get()); |
50 TestingBrowserProcess::GetGlobal()->SetLocalState( | 50 TestingBrowserProcess::GetGlobal()->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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 | 490 |
491 manager_->ProvideOAuthChallengeResponse( | 491 manager_->ProvideOAuthChallengeResponse( |
492 GoogleServiceAuthError::CAPTCHA_REQUIRED, "token", "solution"); | 492 GoogleServiceAuthError::CAPTCHA_REQUIRED, "token", "solution"); |
493 | 493 |
494 SimulateProvideOAuthChallengeResponseValid(); | 494 SimulateProvideOAuthChallengeResponseValid(); |
495 EXPECT_EQ("user@gmail.com", manager_->GetAuthenticatedUsername()); | 495 EXPECT_EQ("user@gmail.com", manager_->GetAuthenticatedUsername()); |
496 | 496 |
497 EXPECT_EQ(1U, google_login_success_.size()); | 497 EXPECT_EQ(1U, google_login_success_.size()); |
498 EXPECT_EQ(1U, google_login_failure_.size()); | 498 EXPECT_EQ(1U, google_login_failure_.size()); |
499 } | 499 } |
OLD | NEW |