OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "chrome/browser/sync/profile_sync_service_factory.h" | 6 #include "chrome/browser/sync/profile_sync_service_factory.h" |
7 #include "chrome/browser/sync/profile_sync_service_mock.h" | 7 #include "chrome/browser/sync/profile_sync_service_mock.h" |
8 #include "chrome/browser/sync/sync_startup_tracker.h" | 8 #include "chrome/browser/sync/sync_startup_tracker.h" |
9 #include "content/public/test/test_browser_thread_bundle.h" | 9 #include "content/public/test/test_browser_thread_bundle.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 using ::testing::_; | 13 using ::testing::_; |
14 using ::testing::AnyNumber; | 14 using ::testing::AnyNumber; |
15 using ::testing::Mock; | 15 using ::testing::Mock; |
16 using ::testing::Return; | 16 using ::testing::Return; |
17 using ::testing::ReturnRef; | 17 using ::testing::ReturnRef; |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 class MockObserver : public SyncStartupTracker::Observer { | 21 class MockObserver : public SyncStartupTracker::Observer { |
22 public: | 22 public: |
23 MockObserver() {} | |
24 ~MockObserver() {} | |
25 | |
26 MOCK_METHOD0(SyncStartupCompleted, void(void)); | 23 MOCK_METHOD0(SyncStartupCompleted, void(void)); |
27 MOCK_METHOD0(SyncStartupFailed, void(void)); | 24 MOCK_METHOD0(SyncStartupFailed, void(void)); |
28 }; | 25 }; |
29 | 26 |
30 class SyncStartupTrackerTest : public testing::Test { | 27 class SyncStartupTrackerTest : public testing::Test { |
31 public: | 28 public: |
32 SyncStartupTrackerTest() : | 29 SyncStartupTrackerTest() : |
33 no_error_(GoogleServiceAuthError::NONE) { | 30 no_error_(GoogleServiceAuthError::NONE) { |
34 } | 31 } |
35 virtual void SetUp() OVERRIDE { | 32 virtual void SetUp() OVERRIDE { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()).WillRepeatedly( | 146 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()).WillRepeatedly( |
150 Return(true)); | 147 Return(true)); |
151 GoogleServiceAuthError error( | 148 GoogleServiceAuthError error( |
152 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); | 149 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); |
153 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error)); | 150 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error)); |
154 EXPECT_CALL(observer_, SyncStartupFailed()); | 151 EXPECT_CALL(observer_, SyncStartupFailed()); |
155 tracker.OnStateChanged(); | 152 tracker.OnStateChanged(); |
156 } | 153 } |
157 | 154 |
158 } // namespace | 155 } // namespace |
OLD | NEW |