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/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 class ProfileSyncServiceTestHarness { | 53 class ProfileSyncServiceTestHarness { |
54 public: | 54 public: |
55 ProfileSyncServiceTestHarness() | 55 ProfileSyncServiceTestHarness() |
56 : thread_bundle_(content::TestBrowserThreadBundle::REAL_DB_THREAD | | 56 : thread_bundle_(content::TestBrowserThreadBundle::REAL_DB_THREAD | |
57 content::TestBrowserThreadBundle::REAL_FILE_THREAD | | 57 content::TestBrowserThreadBundle::REAL_FILE_THREAD | |
58 content::TestBrowserThreadBundle::REAL_IO_THREAD) { | 58 content::TestBrowserThreadBundle::REAL_IO_THREAD) { |
59 } | 59 } |
60 | 60 |
61 void SetUp() { | 61 void SetUp() { |
62 profile.reset(new TestingProfile()); | 62 TestingProfile::Builder builder; |
| 63 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), |
| 64 FakeOAuth2TokenService::BuildTokenService); |
| 65 profile = builder.Build().Pass(); |
63 invalidation::InvalidationServiceFactory::GetInstance()-> | 66 invalidation::InvalidationServiceFactory::GetInstance()-> |
64 SetBuildOnlyFakeInvalidatorsForTest(true); | 67 SetBuildOnlyFakeInvalidatorsForTest(true); |
65 ProfileOAuth2TokenServiceFactory::GetInstance()->SetTestingFactory( | |
66 profile.get(), FakeOAuth2TokenService::BuildTokenService); | |
67 } | 68 } |
68 | 69 |
69 void TearDown() { | 70 void TearDown() { |
70 // Kill the service before the profile. | 71 // Kill the service before the profile. |
71 if (service) { | 72 if (service) { |
72 service->Shutdown(); | 73 service->Shutdown(); |
73 } | 74 } |
74 service.reset(); | 75 service.reset(); |
75 profile.reset(); | 76 profile.reset(); |
76 // Pump messages posted by the sync thread (which may end up | 77 // Pump messages posted by the sync thread (which may end up |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 TEST_F(ProfileSyncServiceTest, FailToDownloadControlTypes) { | 478 TEST_F(ProfileSyncServiceTest, FailToDownloadControlTypes) { |
478 harness_.StartSyncServiceAndSetInitialSyncEnded(false, true, true, true, | 479 harness_.StartSyncServiceAndSetInitialSyncEnded(false, true, true, true, |
479 syncer::STORAGE_IN_MEMORY); | 480 syncer::STORAGE_IN_MEMORY); |
480 | 481 |
481 // The backend is not ready. Ensure the PSS knows this. | 482 // The backend is not ready. Ensure the PSS knows this. |
482 EXPECT_FALSE(harness_.service->sync_initialized()); | 483 EXPECT_FALSE(harness_.service->sync_initialized()); |
483 } | 484 } |
484 | 485 |
485 } // namespace | 486 } // namespace |
486 } // namespace browser_sync | 487 } // namespace browser_sync |
OLD | NEW |