| 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/fake_invalidation_service.h" |
| 10 #include "chrome/browser/invalidation/invalidation_service_factory.h" | 11 #include "chrome/browser/invalidation/invalidation_service_factory.h" |
| 11 #include "chrome/browser/managed_mode/managed_user_signin_manager_wrapper.h" | 12 #include "chrome/browser/managed_mode/managed_user_signin_manager_wrapper.h" |
| 12 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" | 13 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
| 13 #include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h" | 14 #include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h" |
| 14 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 15 #include "chrome/browser/signin/signin_manager.h" | 16 #include "chrome/browser/signin/signin_manager.h" |
| 16 #include "chrome/browser/signin/signin_manager_factory.h" | 17 #include "chrome/browser/signin/signin_manager_factory.h" |
| 17 #include "chrome/browser/sync/glue/data_type_manager_impl.h" | 18 #include "chrome/browser/sync/glue/data_type_manager_impl.h" |
| 18 #include "chrome/browser/sync/glue/sync_backend_host_mock.h" | 19 #include "chrome/browser/sync/glue/sync_backend_host_mock.h" |
| 19 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" | 20 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 31 | 32 |
| 32 ACTION(ReturnNewDataTypeManager) { | 33 ACTION(ReturnNewDataTypeManager) { |
| 33 return new browser_sync::DataTypeManagerImpl(arg0, | 34 return new browser_sync::DataTypeManagerImpl(arg0, |
| 34 arg1, | 35 arg1, |
| 35 arg2, | 36 arg2, |
| 36 arg3, | 37 arg3, |
| 37 arg4, | 38 arg4, |
| 38 arg5); | 39 arg5); |
| 39 } | 40 } |
| 40 | 41 |
| 42 using testing::StrictMock; |
| 41 using testing::_; | 43 using testing::_; |
| 42 using testing::StrictMock; | |
| 43 | 44 |
| 44 class TestProfileSyncServiceObserver : public ProfileSyncServiceObserver { | 45 class TestProfileSyncServiceObserver : public ProfileSyncServiceObserver { |
| 45 public: | 46 public: |
| 46 explicit TestProfileSyncServiceObserver(ProfileSyncService* service) | 47 explicit TestProfileSyncServiceObserver(ProfileSyncService* service) |
| 47 : service_(service), first_setup_in_progress_(false) {} | 48 : service_(service), first_setup_in_progress_(false) {} |
| 48 virtual void OnStateChanged() OVERRIDE { | 49 virtual void OnStateChanged() OVERRIDE { |
| 49 first_setup_in_progress_ = service_->FirstSetupInProgress(); | 50 first_setup_in_progress_ = service_->FirstSetupInProgress(); |
| 50 } | 51 } |
| 51 bool first_setup_in_progress() const { return first_setup_in_progress_; } | 52 bool first_setup_in_progress() const { return first_setup_in_progress_; } |
| 52 private: | 53 private: |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {} | 92 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {} |
| 92 virtual ~ProfileSyncServiceTest() {} | 93 virtual ~ProfileSyncServiceTest() {} |
| 93 | 94 |
| 94 virtual void SetUp() OVERRIDE { | 95 virtual void SetUp() OVERRIDE { |
| 95 TestingProfile::Builder builder; | 96 TestingProfile::Builder builder; |
| 96 | 97 |
| 97 builder.AddTestingFactory( | 98 builder.AddTestingFactory( |
| 98 ProfileOAuth2TokenServiceFactory::GetInstance(), | 99 ProfileOAuth2TokenServiceFactory::GetInstance(), |
| 99 FakeProfileOAuth2TokenServiceWrapper::BuildAutoIssuingTokenService); | 100 FakeProfileOAuth2TokenServiceWrapper::BuildAutoIssuingTokenService); |
| 100 invalidation::InvalidationServiceFactory::GetInstance()-> | 101 invalidation::InvalidationServiceFactory::GetInstance()-> |
| 101 SetBuildOnlyFakeInvalidatorsForTest(true); | 102 RegisterTestingFactory(invalidation::FakeInvalidationService::Build); |
| 102 | 103 |
| 103 profile_ = builder.Build().Pass(); | 104 profile_ = builder.Build().Pass(); |
| 104 } | 105 } |
| 105 | 106 |
| 106 virtual void TearDown() OVERRIDE { | 107 virtual void TearDown() OVERRIDE { |
| 107 // Kill the service before the profile. | 108 // Kill the service before the profile. |
| 108 if (service_) | 109 if (service_) |
| 109 service_->Shutdown(); | 110 service_->Shutdown(); |
| 110 | 111 |
| 111 service_.reset(); | 112 service_.reset(); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 EXPECT_TRUE(token_status.next_token_request_time.is_null()); | 365 EXPECT_TRUE(token_status.next_token_request_time.is_null()); |
| 365 | 366 |
| 366 // Simulate successful connection. | 367 // Simulate successful connection. |
| 367 service()->OnConnectionStatusChange(syncer::CONNECTION_OK); | 368 service()->OnConnectionStatusChange(syncer::CONNECTION_OK); |
| 368 token_status = service()->GetSyncTokenStatus(); | 369 token_status = service()->GetSyncTokenStatus(); |
| 369 EXPECT_EQ(syncer::CONNECTION_OK, token_status.connection_status); | 370 EXPECT_EQ(syncer::CONNECTION_OK, token_status.connection_status); |
| 370 } | 371 } |
| 371 | 372 |
| 372 } // namespace | 373 } // namespace |
| 373 } // namespace browser_sync | 374 } // namespace browser_sync |
| OLD | NEW |