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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/invalidation/invalidation_service_factory.h" | 10 #include "chrome/browser/invalidation/invalidation_service_factory.h" |
11 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 11 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
12 #include "chrome/browser/signin/signin_manager.h" | 12 #include "chrome/browser/signin/signin_manager.h" |
13 #include "chrome/browser/signin/signin_manager_factory.h" | 13 #include "chrome/browser/signin/signin_manager_factory.h" |
14 #include "chrome/browser/sync/fake_oauth2_token_service.h" | 14 #include "chrome/browser/sync/fake_oauth2_token_service_for_sync.h" |
15 #include "chrome/browser/sync/glue/data_type_manager_impl.h" | 15 #include "chrome/browser/sync/glue/data_type_manager_impl.h" |
16 #include "chrome/browser/sync/glue/sync_backend_host_mock.h" | 16 #include "chrome/browser/sync/glue/sync_backend_host_mock.h" |
17 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" | 17 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" |
18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
19 #include "chrome/test/base/testing_pref_service_syncable.h" | 19 #include "chrome/test/base/testing_pref_service_syncable.h" |
20 #include "chrome/test/base/testing_profile.h" | 20 #include "chrome/test/base/testing_profile.h" |
21 #include "content/public/test/test_browser_thread_bundle.h" | 21 #include "content/public/test/test_browser_thread_bundle.h" |
22 #include "google_apis/gaia/gaia_constants.h" | 22 #include "google_apis/gaia/gaia_constants.h" |
23 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 class ProfileSyncServiceTest : public ::testing::Test { | 86 class ProfileSyncServiceTest : public ::testing::Test { |
87 protected: | 87 protected: |
88 ProfileSyncServiceTest() | 88 ProfileSyncServiceTest() |
89 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {} | 89 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {} |
90 virtual ~ProfileSyncServiceTest() {} | 90 virtual ~ProfileSyncServiceTest() {} |
91 | 91 |
92 virtual void SetUp() OVERRIDE { | 92 virtual void SetUp() OVERRIDE { |
93 TestingProfile::Builder builder; | 93 TestingProfile::Builder builder; |
94 | 94 |
95 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), | 95 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), |
96 FakeOAuth2TokenService::BuildTokenService); | 96 FakeOAuth2TokenServiceForSync::BuildTokenService); |
97 invalidation::InvalidationServiceFactory::GetInstance()-> | 97 invalidation::InvalidationServiceFactory::GetInstance()-> |
98 SetBuildOnlyFakeInvalidatorsForTest(true); | 98 SetBuildOnlyFakeInvalidatorsForTest(true); |
99 | 99 |
100 profile_ = builder.Build().Pass(); | 100 profile_ = builder.Build().Pass(); |
101 } | 101 } |
102 | 102 |
103 virtual void TearDown() OVERRIDE { | 103 virtual void TearDown() OVERRIDE { |
104 // Kill the service before the profile. | 104 // Kill the service before the profile. |
105 if (service_) | 105 if (service_) |
106 service_->Shutdown(); | 106 service_->Shutdown(); |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 EXPECT_TRUE(token_status.next_token_request_time.is_null()); | 361 EXPECT_TRUE(token_status.next_token_request_time.is_null()); |
362 | 362 |
363 // Simulate successful connection. | 363 // Simulate successful connection. |
364 service()->OnConnectionStatusChange(syncer::CONNECTION_OK); | 364 service()->OnConnectionStatusChange(syncer::CONNECTION_OK); |
365 token_status = service()->GetSyncTokenStatus(); | 365 token_status = service()->GetSyncTokenStatus(); |
366 EXPECT_EQ(syncer::CONNECTION_OK, token_status.connection_status); | 366 EXPECT_EQ(syncer::CONNECTION_OK, token_status.connection_status); |
367 } | 367 } |
368 | 368 |
369 } // namespace | 369 } // namespace |
370 } // namespace browser_sync | 370 } // namespace browser_sync |
OLD | NEW |