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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
10 #include "chrome/browser/signin/signin_manager.h" | 10 #include "chrome/browser/signin/signin_manager.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } | 71 } |
72 | 72 |
73 virtual void TearDown() { | 73 virtual void TearDown() { |
74 service_->RemoveObserver(&observer_); | 74 service_->RemoveObserver(&observer_); |
75 service_->Shutdown(); | 75 service_->Shutdown(); |
76 service_.reset(); | 76 service_.reset(); |
77 profile_.reset(); | 77 profile_.reset(); |
78 | 78 |
79 // Pump messages posted by the sync core thread (which may end up | 79 // Pump messages posted by the sync core thread (which may end up |
80 // posting on the IO thread). | 80 // posting on the IO thread). |
81 ui_loop_.RunAllPending(); | 81 ui_loop_.RunUntilIdle(); |
82 io_thread_.Stop(); | 82 io_thread_.Stop(); |
83 file_thread_.Stop(); | 83 file_thread_.Stop(); |
84 ui_loop_.RunAllPending(); | 84 ui_loop_.RunUntilIdle(); |
85 } | 85 } |
86 | 86 |
87 protected: | 87 protected: |
88 // Overridden below by ProfileSyncServiceStartupCrosTest. | 88 // Overridden below by ProfileSyncServiceStartupCrosTest. |
89 virtual void CreateSyncService() { | 89 virtual void CreateSyncService() { |
90 SigninManager* signin = static_cast<SigninManager*>( | 90 SigninManager* signin = static_cast<SigninManager*>( |
91 SigninManagerFactory::GetInstance()->SetTestingFactoryAndUse( | 91 SigninManagerFactory::GetInstance()->SetTestingFactoryAndUse( |
92 profile_.get(), FakeSigninManager::Build)); | 92 profile_.get(), FakeSigninManager::Build)); |
93 signin->SetAuthenticatedUsername("test_user"); | 93 signin->SetAuthenticatedUsername("test_user"); |
94 service_.reset(new TestProfileSyncService( | 94 service_.reset(new TestProfileSyncService( |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 400 |
401 // Preload the tokens. | 401 // Preload the tokens. |
402 TokenServiceFactory::GetForProfile(profile_.get())->IssueAuthTokenForTest( | 402 TokenServiceFactory::GetForProfile(profile_.get())->IssueAuthTokenForTest( |
403 GaiaConstants::kSyncService, "sync_token"); | 403 GaiaConstants::kSyncService, "sync_token"); |
404 service_->fail_initial_download(); | 404 service_->fail_initial_download(); |
405 | 405 |
406 service_->Initialize(); | 406 service_->Initialize(); |
407 EXPECT_FALSE(service_->sync_initialized()); | 407 EXPECT_FALSE(service_->sync_initialized()); |
408 EXPECT_FALSE(service_->GetBackendForTest()); | 408 EXPECT_FALSE(service_->GetBackendForTest()); |
409 } | 409 } |
OLD | NEW |