| 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 22 matching lines...) Expand all Loading... |
| 33 namespace { | 33 namespace { |
| 34 | 34 |
| 35 class MockTokenService : public TokenService { | 35 class MockTokenService : public TokenService { |
| 36 public: | 36 public: |
| 37 MockTokenService() { } | 37 MockTokenService() { } |
| 38 virtual ~MockTokenService() { } | 38 virtual ~MockTokenService() { } |
| 39 | 39 |
| 40 MOCK_CONST_METHOD1(HasTokenForService, bool(const char*)); | 40 MOCK_CONST_METHOD1(HasTokenForService, bool(const char*)); |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 ProfileKeyedService* BuildMockTokenService(Profile* profile) { | 43 ProfileKeyedService* BuildMockTokenService(content::BrowserContext* profile) { |
| 44 return new MockTokenService; | 44 return new MockTokenService; |
| 45 } | 45 } |
| 46 | 46 |
| 47 class MockObserver : public SigninTracker::Observer { | 47 class MockObserver : public SigninTracker::Observer { |
| 48 public: | 48 public: |
| 49 MockObserver() {} | 49 MockObserver() {} |
| 50 ~MockObserver() {} | 50 ~MockObserver() {} |
| 51 | 51 |
| 52 MOCK_METHOD0(GaiaCredentialsValid, void(void)); | 52 MOCK_METHOD0(GaiaCredentialsValid, void(void)); |
| 53 MOCK_METHOD1(SigninFailed, void(const GoogleServiceAuthError&)); | 53 MOCK_METHOD1(SigninFailed, void(const GoogleServiceAuthError&)); |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 | 363 |
| 364 TEST_F(SigninTrackerTest, SigninFailedWhenInitializing) { | 364 TEST_F(SigninTrackerTest, SigninFailedWhenInitializing) { |
| 365 tracker_.reset(); | 365 tracker_.reset(); |
| 366 // SigninFailed() should be called. | 366 // SigninFailed() should be called. |
| 367 GoogleServiceAuthError error(GoogleServiceAuthError::REQUEST_CANCELED); | 367 GoogleServiceAuthError error(GoogleServiceAuthError::REQUEST_CANCELED); |
| 368 EXPECT_CALL(observer_, SigninFailed(error)); | 368 EXPECT_CALL(observer_, SigninFailed(error)); |
| 369 tracker_.reset(new SigninTracker(profile_.get(), &observer_, | 369 tracker_.reset(new SigninTracker(profile_.get(), &observer_, |
| 370 SigninTracker::SERVICES_INITIALIZING)); | 370 SigninTracker::SERVICES_INITIALIZING)); |
| 371 tracker_->OnStateChanged(); | 371 tracker_->OnStateChanged(); |
| 372 } | 372 } |
| OLD | NEW |