| 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/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 using ::testing::ReturnRef; | 28 using ::testing::ReturnRef; |
| 29 | 29 |
| 30 class MockTokenService : public TokenService { | 30 class MockTokenService : public TokenService { |
| 31 public: | 31 public: |
| 32 MockTokenService() { } | 32 MockTokenService() { } |
| 33 virtual ~MockTokenService() { } | 33 virtual ~MockTokenService() { } |
| 34 | 34 |
| 35 MOCK_CONST_METHOD1(HasTokenForService, bool(const char*)); | 35 MOCK_CONST_METHOD1(HasTokenForService, bool(const char*)); |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 ProfileKeyedBase* BuildMockTokenService(Profile* profile) { | 38 ProfileKeyedService* BuildMockTokenService(Profile* profile) { |
| 39 return new MockTokenService; | 39 return new MockTokenService; |
| 40 } | 40 } |
| 41 | 41 |
| 42 class MockObserver : public SigninTracker::Observer { | 42 class MockObserver : public SigninTracker::Observer { |
| 43 public: | 43 public: |
| 44 MockObserver() {} | 44 MockObserver() {} |
| 45 ~MockObserver() {} | 45 ~MockObserver() {} |
| 46 | 46 |
| 47 MOCK_METHOD0(GaiaCredentialsValid, void(void)); | 47 MOCK_METHOD0(GaiaCredentialsValid, void(void)); |
| 48 MOCK_METHOD1(SigninFailed, void(const GoogleServiceAuthError&)); | 48 MOCK_METHOD1(SigninFailed, void(const GoogleServiceAuthError&)); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 // Now mimic an auth error - this should cause us to fail (not waiting for | 267 // Now mimic an auth error - this should cause us to fail (not waiting for |
| 268 // auth, but still have no credentials). | 268 // auth, but still have no credentials). |
| 269 GoogleServiceAuthError error( | 269 GoogleServiceAuthError error( |
| 270 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); | 270 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); |
| 271 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error)); | 271 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error)); |
| 272 EXPECT_CALL(*mock_pss_, waiting_for_auth()).WillOnce(Return(false)); | 272 EXPECT_CALL(*mock_pss_, waiting_for_auth()).WillOnce(Return(false)); |
| 273 EXPECT_CALL(observer_, SigninFailed(error)); | 273 EXPECT_CALL(observer_, SigninFailed(error)); |
| 274 tracker_->OnStateChanged(); | 274 tracker_->OnStateChanged(); |
| 275 } | 275 } |
| 276 | 276 |
| OLD | NEW |