| 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_tracker.h" | 5 #include "chrome/browser/signin/signin_tracker.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 "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 class MockObserver : public SigninTracker::Observer { | 38 class MockObserver : public SigninTracker::Observer { |
| 39 public: | 39 public: |
| 40 MockObserver() {} | 40 MockObserver() {} |
| 41 ~MockObserver() {} | 41 ~MockObserver() {} |
| 42 | 42 |
| 43 MOCK_METHOD1(SigninFailed, void(const GoogleServiceAuthError&)); | 43 MOCK_METHOD1(SigninFailed, void(const GoogleServiceAuthError&)); |
| 44 MOCK_METHOD0(SigninSuccess, void(void)); | 44 MOCK_METHOD0(SigninSuccess, void(void)); |
| 45 MOCK_METHOD1(MergeSessionComplete, void(const GoogleServiceAuthError&)); |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 } // namespace | 48 } // namespace |
| 48 | 49 |
| 49 class SigninTrackerTest : public testing::Test { | 50 class SigninTrackerTest : public testing::Test { |
| 50 public: | 51 public: |
| 51 SigninTrackerTest() {} | 52 SigninTrackerTest() {} |
| 52 virtual void SetUp() OVERRIDE { | 53 virtual void SetUp() OVERRIDE { |
| 53 TestingProfile::Builder builder; | 54 TestingProfile::Builder builder; |
| 54 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), | 55 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 content::Details<const GoogleServiceAuthError>(&error)); | 94 content::Details<const GoogleServiceAuthError>(&error)); |
| 94 } | 95 } |
| 95 | 96 |
| 96 TEST_F(SigninTrackerTest, SignInSucceeds) { | 97 TEST_F(SigninTrackerTest, SignInSucceeds) { |
| 97 EXPECT_CALL(observer_, SigninSuccess()); | 98 EXPECT_CALL(observer_, SigninSuccess()); |
| 98 EXPECT_CALL(observer_, SigninFailed(_)).Times(0); | 99 EXPECT_CALL(observer_, SigninFailed(_)).Times(0); |
| 99 | 100 |
| 100 mock_signin_manager_->SetAuthenticatedUsername("user@gmail.com"); | 101 mock_signin_manager_->SetAuthenticatedUsername("user@gmail.com"); |
| 101 fake_oauth2_token_service_->IssueRefreshToken("refresh_token"); | 102 fake_oauth2_token_service_->IssueRefreshToken("refresh_token"); |
| 102 } | 103 } |
| OLD | NEW |