| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // thread, if it does not already exist. But it must be created on the IO | 56 // thread, if it does not already exist. But it must be created on the IO |
| 57 // thread or else it will DCHECK upon destruction. | 57 // thread or else it will DCHECK upon destruction. |
| 58 // Force it to be created here. | 58 // Force it to be created here. |
| 59 profile_->CreateRequestContext(); | 59 profile_->CreateRequestContext(); |
| 60 profile_->GetRequestContext()->GetURLRequestContext(); | 60 profile_->GetRequestContext()->GetURLRequestContext(); |
| 61 io_setup_complete->Signal(); | 61 io_setup_complete->Signal(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 virtual void SetUp() OVERRIDE { | 64 virtual void SetUp() OVERRIDE { |
| 65 prefs_.reset(new TestingPrefServiceSimple); | 65 prefs_.reset(new TestingPrefServiceSimple); |
| 66 chrome::RegisterLocalState(prefs_.get()); | 66 chrome::RegisterLocalState(prefs_->registry(), prefs_.get()); |
| 67 TestingBrowserProcess::GetGlobal()->SetLocalState( | 67 TestingBrowserProcess::GetGlobal()->SetLocalState( |
| 68 prefs_.get()); | 68 prefs_.get()); |
| 69 TokenServiceTestHarness::SetUp(); | 69 TokenServiceTestHarness::SetUp(); |
| 70 manager_.reset(new SigninManager()); | 70 manager_.reset(new SigninManager()); |
| 71 google_login_success_.ListenFor( | 71 google_login_success_.ListenFor( |
| 72 chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, | 72 chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, |
| 73 content::Source<Profile>(profile_.get())); | 73 content::Source<Profile>(profile_.get())); |
| 74 google_login_failure_.ListenFor(chrome::NOTIFICATION_GOOGLE_SIGNIN_FAILED, | 74 google_login_failure_.ListenFor(chrome::NOTIFICATION_GOOGLE_SIGNIN_FAILED, |
| 75 content::Source<Profile>(profile_.get())); | 75 content::Source<Profile>(profile_.get())); |
| 76 | 76 |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 | 611 |
| 612 manager_->ProvideOAuthChallengeResponse( | 612 manager_->ProvideOAuthChallengeResponse( |
| 613 GoogleServiceAuthError::CAPTCHA_REQUIRED, "token", "solution"); | 613 GoogleServiceAuthError::CAPTCHA_REQUIRED, "token", "solution"); |
| 614 | 614 |
| 615 SimulateProvideOAuthChallengeResponseValid(); | 615 SimulateProvideOAuthChallengeResponseValid(); |
| 616 EXPECT_EQ("user@gmail.com", manager_->GetAuthenticatedUsername()); | 616 EXPECT_EQ("user@gmail.com", manager_->GetAuthenticatedUsername()); |
| 617 | 617 |
| 618 EXPECT_EQ(1U, google_login_success_.size()); | 618 EXPECT_EQ(1U, google_login_success_.size()); |
| 619 EXPECT_EQ(1U, google_login_failure_.size()); | 619 EXPECT_EQ(1U, google_login_failure_.size()); |
| 620 } | 620 } |
| OLD | NEW |