| 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 22 matching lines...) Expand all Loading... |
| 33 using testing::DoAll; | 33 using testing::DoAll; |
| 34 using testing::InvokeArgument; | 34 using testing::InvokeArgument; |
| 35 using testing::Mock; | 35 using testing::Mock; |
| 36 using testing::Return; | 36 using testing::Return; |
| 37 | 37 |
| 38 // TODO(chron): Test not using cros_user flag and use signin_ | 38 // TODO(chron): Test not using cros_user flag and use signin_ |
| 39 class ProfileSyncServiceStartupTest : public testing::Test { | 39 class ProfileSyncServiceStartupTest : public testing::Test { |
| 40 public: | 40 public: |
| 41 ProfileSyncServiceStartupTest() | 41 ProfileSyncServiceStartupTest() |
| 42 : ui_thread_(BrowserThread::UI, &ui_loop_), | 42 : ui_thread_(BrowserThread::UI, &ui_loop_), |
| 43 db_thread_(BrowserThread::DB), |
| 43 file_thread_(BrowserThread::FILE), | 44 file_thread_(BrowserThread::FILE), |
| 44 io_thread_(BrowserThread::IO), | 45 io_thread_(BrowserThread::IO), |
| 45 profile_(new TestingProfile) {} | 46 profile_(new TestingProfile) {} |
| 46 | 47 |
| 47 virtual ~ProfileSyncServiceStartupTest() { | 48 virtual ~ProfileSyncServiceStartupTest() { |
| 48 } | 49 } |
| 49 | 50 |
| 50 virtual void SetUp() { | 51 virtual void SetUp() { |
| 51 file_thread_.Start(); | 52 file_thread_.Start(); |
| 52 io_thread_.StartIOThread(); | 53 io_thread_.StartIOThread(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 WillOnce(Return(data_type_manager)); | 92 WillOnce(Return(data_type_manager)); |
| 92 return data_type_manager; | 93 return data_type_manager; |
| 93 } | 94 } |
| 94 | 95 |
| 95 ProfileSyncComponentsFactoryMock* factory_mock() { | 96 ProfileSyncComponentsFactoryMock* factory_mock() { |
| 96 return static_cast<ProfileSyncComponentsFactoryMock*>(service_->factory()); | 97 return static_cast<ProfileSyncComponentsFactoryMock*>(service_->factory()); |
| 97 } | 98 } |
| 98 | 99 |
| 99 MessageLoop ui_loop_; | 100 MessageLoop ui_loop_; |
| 100 content::TestBrowserThread ui_thread_; | 101 content::TestBrowserThread ui_thread_; |
| 102 content::TestBrowserThread db_thread_; |
| 101 content::TestBrowserThread file_thread_; | 103 content::TestBrowserThread file_thread_; |
| 102 content::TestBrowserThread io_thread_; | 104 content::TestBrowserThread io_thread_; |
| 103 scoped_ptr<TestingProfile> profile_; | 105 scoped_ptr<TestingProfile> profile_; |
| 104 scoped_ptr<TestProfileSyncService> service_; | 106 scoped_ptr<TestProfileSyncService> service_; |
| 105 ProfileSyncServiceObserverMock observer_; | 107 ProfileSyncServiceObserverMock observer_; |
| 106 }; | 108 }; |
| 107 | 109 |
| 108 class ProfileSyncServiceStartupCrosTest : public ProfileSyncServiceStartupTest { | 110 class ProfileSyncServiceStartupCrosTest : public ProfileSyncServiceStartupTest { |
| 109 protected: | 111 protected: |
| 110 virtual void CreateSyncService() { | 112 virtual void CreateSyncService() { |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 338 |
| 337 // Preload the tokens. | 339 // Preload the tokens. |
| 338 TokenServiceFactory::GetForProfile(profile_.get())->IssueAuthTokenForTest( | 340 TokenServiceFactory::GetForProfile(profile_.get())->IssueAuthTokenForTest( |
| 339 GaiaConstants::kSyncService, "sync_token"); | 341 GaiaConstants::kSyncService, "sync_token"); |
| 340 service_->fail_initial_download(); | 342 service_->fail_initial_download(); |
| 341 | 343 |
| 342 service_->Initialize(); | 344 service_->Initialize(); |
| 343 EXPECT_FALSE(service_->sync_initialized()); | 345 EXPECT_FALSE(service_->sync_initialized()); |
| 344 EXPECT_FALSE(service_->GetBackendForTest()); | 346 EXPECT_FALSE(service_->GetBackendForTest()); |
| 345 } | 347 } |
| OLD | NEW |