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/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/signin/signin_manager.h" | 9 #include "chrome/browser/signin/signin_manager.h" |
10 #include "chrome/browser/signin/signin_manager_factory.h" | 10 #include "chrome/browser/signin/signin_manager_factory.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 using testing::_; | 40 using testing::_; |
41 using testing::AtLeast; | 41 using testing::AtLeast; |
42 using testing::AtMost; | 42 using testing::AtMost; |
43 using testing::Return; | 43 using testing::Return; |
44 using testing::StrictMock; | 44 using testing::StrictMock; |
45 | 45 |
46 class ProfileSyncServiceTest : public testing::Test { | 46 class ProfileSyncServiceTest : public testing::Test { |
47 protected: | 47 protected: |
48 ProfileSyncServiceTest() | 48 ProfileSyncServiceTest() |
49 : ui_thread_(BrowserThread::UI, &ui_loop_), | 49 : ui_thread_(BrowserThread::UI, &ui_loop_), |
| 50 db_thread_(BrowserThread::DB), |
50 file_thread_(BrowserThread::FILE), | 51 file_thread_(BrowserThread::FILE), |
51 io_thread_(BrowserThread::IO) {} | 52 io_thread_(BrowserThread::IO) {} |
52 | 53 |
53 virtual ~ProfileSyncServiceTest() {} | 54 virtual ~ProfileSyncServiceTest() {} |
54 | 55 |
55 virtual void SetUp() { | 56 virtual void SetUp() { |
56 file_thread_.Start(); | 57 file_thread_.Start(); |
57 io_thread_.StartIOThread(); | 58 io_thread_.StartIOThread(); |
58 profile_.reset(new TestingProfile()); | 59 profile_.reset(new TestingProfile()); |
59 profile_->CreateRequestContext(); | 60 profile_->CreateRequestContext(); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 TokenServiceFactory::GetForProfile(profile_.get()); | 138 TokenServiceFactory::GetForProfile(profile_.get()); |
138 token_service->IssueAuthTokenForTest( | 139 token_service->IssueAuthTokenForTest( |
139 GaiaConstants::kSyncService, "token1"); | 140 GaiaConstants::kSyncService, "token1"); |
140 token_service->IssueAuthTokenForTest( | 141 token_service->IssueAuthTokenForTest( |
141 GaiaConstants::kGaiaOAuth2LoginRefreshToken, "token2"); | 142 GaiaConstants::kGaiaOAuth2LoginRefreshToken, "token2"); |
142 } | 143 } |
143 | 144 |
144 MessageLoop ui_loop_; | 145 MessageLoop ui_loop_; |
145 // Needed by |service_|. | 146 // Needed by |service_|. |
146 content::TestBrowserThread ui_thread_; | 147 content::TestBrowserThread ui_thread_; |
| 148 content::TestBrowserThread db_thread_; |
147 // Needed by DisableAndEnableSyncTemporarily test case. | 149 // Needed by DisableAndEnableSyncTemporarily test case. |
148 content::TestBrowserThread file_thread_; | 150 content::TestBrowserThread file_thread_; |
149 // Needed by |service| and |profile_|'s request context. | 151 // Needed by |service| and |profile_|'s request context. |
150 content::TestBrowserThread io_thread_; | 152 content::TestBrowserThread io_thread_; |
151 | 153 |
152 scoped_ptr<TestProfileSyncService> service_; | 154 scoped_ptr<TestProfileSyncService> service_; |
153 scoped_ptr<TestingProfile> profile_; | 155 scoped_ptr<TestingProfile> profile_; |
154 }; | 156 }; |
155 | 157 |
156 TEST_F(ProfileSyncServiceTest, InitialState) { | 158 TEST_F(ProfileSyncServiceTest, InitialState) { |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 // The backend is not ready. Ensure the PSS knows this. | 381 // The backend is not ready. Ensure the PSS knows this. |
380 EXPECT_FALSE(service_->sync_initialized()); | 382 EXPECT_FALSE(service_->sync_initialized()); |
381 | 383 |
382 // Ensure we will be prepared to initialize a fresh DB next time. | 384 // Ensure we will be prepared to initialize a fresh DB next time. |
383 EXPECT_FALSE(service_->HasSyncSetupCompleted()); | 385 EXPECT_FALSE(service_->HasSyncSetupCompleted()); |
384 } | 386 } |
385 | 387 |
386 } // namespace | 388 } // namespace |
387 | 389 |
388 } // namespace browser_sync | 390 } // namespace browser_sync |
OLD | NEW |