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(content::BrowserContext* profile) { | 43 BrowserContextKeyedService* BuildMockTokenService( |
| 44 content::BrowserContext* profile) { |
44 return new MockTokenService; | 45 return new MockTokenService; |
45 } | 46 } |
46 | 47 |
47 class MockObserver : public SigninTracker::Observer { | 48 class MockObserver : public SigninTracker::Observer { |
48 public: | 49 public: |
49 MockObserver() {} | 50 MockObserver() {} |
50 ~MockObserver() {} | 51 ~MockObserver() {} |
51 | 52 |
52 MOCK_METHOD0(GaiaCredentialsValid, void(void)); | 53 MOCK_METHOD0(GaiaCredentialsValid, void(void)); |
53 MOCK_METHOD1(SigninFailed, void(const GoogleServiceAuthError&)); | 54 MOCK_METHOD1(SigninFailed, void(const GoogleServiceAuthError&)); |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 | 363 |
363 TEST_F(SigninTrackerTest, SigninFailedWhenInitializing) { | 364 TEST_F(SigninTrackerTest, SigninFailedWhenInitializing) { |
364 tracker_.reset(); | 365 tracker_.reset(); |
365 // SigninFailed() should be called. | 366 // SigninFailed() should be called. |
366 GoogleServiceAuthError error(GoogleServiceAuthError::REQUEST_CANCELED); | 367 GoogleServiceAuthError error(GoogleServiceAuthError::REQUEST_CANCELED); |
367 EXPECT_CALL(observer_, SigninFailed(error)); | 368 EXPECT_CALL(observer_, SigninFailed(error)); |
368 tracker_.reset(new SigninTracker(profile_.get(), &observer_, | 369 tracker_.reset(new SigninTracker(profile_.get(), &observer_, |
369 SigninTracker::SERVICES_INITIALIZING)); | 370 SigninTracker::SERVICES_INITIALIZING)); |
370 tracker_->OnStateChanged(); | 371 tracker_->OnStateChanged(); |
371 } | 372 } |
OLD | NEW |