Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(508)

Side by Side Diff: chrome/browser/sync/profile_sync_service_unittest.cc

Issue 69583002: Refactor some ProfileSyncServiceTests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add another suppress tests Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "chrome/browser/invalidation/invalidation_service_factory.h" 11 #include "chrome/browser/invalidation/invalidation_service_factory.h"
12 #include "chrome/browser/signin/signin_manager.h" 12 #include "chrome/browser/signin/signin_manager.h"
13 #include "chrome/browser/signin/signin_manager_factory.h" 13 #include "chrome/browser/signin/signin_manager_factory.h"
14 #include "chrome/browser/signin/token_service.h" 14 #include "chrome/browser/signin/token_service.h"
15 #include "chrome/browser/signin/token_service_factory.h" 15 #include "chrome/browser/signin/token_service_factory.h"
16 #include "chrome/browser/sync/fake_oauth2_token_service.h" 16 #include "chrome/browser/sync/fake_oauth2_token_service.h"
17 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" 17 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h"
18 #include "chrome/browser/sync/glue/data_type_controller.h" 18 #include "chrome/browser/sync/glue/data_type_controller.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"
20 #include "chrome/browser/sync/test_profile_sync_service.h" 21 #include "chrome/browser/sync/test_profile_sync_service.h"
21 #include "chrome/common/chrome_version_info.h" 22 #include "chrome/common/chrome_version_info.h"
22 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
23 #include "chrome/test/base/testing_pref_service_syncable.h" 24 #include "chrome/test/base/testing_pref_service_syncable.h"
24 #include "chrome/test/base/testing_profile.h" 25 #include "chrome/test/base/testing_profile.h"
25 #include "content/public/test/test_browser_thread_bundle.h" 26 #include "content/public/test/test_browser_thread_bundle.h"
26 #include "content/public/test/test_utils.h" 27 #include "content/public/test/test_utils.h"
27 #include "google/cacheinvalidation/include/types.h" 28 #include "google/cacheinvalidation/include/types.h"
28 #include "google_apis/gaia/gaia_constants.h" 29 #include "google_apis/gaia/gaia_constants.h"
(...skipping 23 matching lines...) Expand all
52 } 53 }
53 54
54 class ProfileSyncServiceTest : public testing::Test { 55 class ProfileSyncServiceTest : public testing::Test {
55 protected: 56 protected:
56 ProfileSyncServiceTest() 57 ProfileSyncServiceTest()
57 : thread_bundle_(content::TestBrowserThreadBundle::REAL_DB_THREAD | 58 : thread_bundle_(content::TestBrowserThreadBundle::REAL_DB_THREAD |
58 content::TestBrowserThreadBundle::REAL_FILE_THREAD | 59 content::TestBrowserThreadBundle::REAL_FILE_THREAD |
59 content::TestBrowserThreadBundle::REAL_IO_THREAD) { 60 content::TestBrowserThreadBundle::REAL_IO_THREAD) {
60 } 61 }
61 62
62 virtual void SetUp() OVERRIDE { 63 virtual ~ProfileSyncServiceTest() {}
64
65 virtual void SetUp() OVERRIDE {
63 TestingProfile::Builder builder; 66 TestingProfile::Builder builder;
64 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), 67 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(),
65 FakeOAuth2TokenService::BuildTokenService); 68 FakeOAuth2TokenService::BuildTokenService);
66 profile_ = builder.Build().Pass(); 69 profile_ = builder.Build().Pass();
67 invalidation::InvalidationServiceFactory::GetInstance()-> 70 invalidation::InvalidationServiceFactory::GetInstance()->
68 SetBuildOnlyFakeInvalidatorsForTest(true); 71 SetBuildOnlyFakeInvalidatorsForTest(true);
69 } 72 }
70 73
71 virtual void TearDown() OVERRIDE { 74 virtual void TearDown() OVERRIDE {
72 // Kill the service before the profile. 75 // Kill the service before the profile.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 : service_(service), first_setup_in_progress_(false) {} 168 : service_(service), first_setup_in_progress_(false) {}
166 virtual void OnStateChanged() OVERRIDE { 169 virtual void OnStateChanged() OVERRIDE {
167 first_setup_in_progress_ = service_->FirstSetupInProgress(); 170 first_setup_in_progress_ = service_->FirstSetupInProgress();
168 } 171 }
169 bool first_setup_in_progress() const { return first_setup_in_progress_; } 172 bool first_setup_in_progress() const { return first_setup_in_progress_; }
170 private: 173 private:
171 ProfileSyncService* service_; 174 ProfileSyncService* service_;
172 bool first_setup_in_progress_; 175 bool first_setup_in_progress_;
173 }; 176 };
174 177
175 TEST_F(ProfileSyncServiceTest, InitialState) { 178 // A variant of the SyncBackendHostMock that won't automatically
176 SigninManagerBase* signin = 179 // call back when asked to initialized. Allows us to test things
177 SigninManagerFactory::GetForProfile(profile_.get()); 180 // that could happen while backend init is in progress.
178 ProfileOAuth2TokenService* oauth2_token_service = 181 class SyncBackendHostNoReturn : public SyncBackendHostMock {
179 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()); 182 virtual void Initialize(
180 service_.reset(new TestProfileSyncService( 183 SyncFrontend* frontend,
181 new ProfileSyncComponentsFactoryMock(), 184 scoped_ptr<base::Thread> sync_thread,
182 profile_.get(), 185 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler,
183 signin, 186 const GURL& service_url,
184 oauth2_token_service, 187 const syncer::SyncCredentials& credentials,
185 ProfileSyncService::MANUAL_START, 188 bool delete_sync_data_folder,
186 true)); 189 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory,
187 service_->Initialize(); 190 scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler,
188 EXPECT_TRUE( 191 syncer::ReportUnrecoverableErrorFunction
189 service_->sync_service_url().spec() == 192 report_unrecoverable_error_function) OVERRIDE {}
190 ProfileSyncService::kSyncServerUrl || 193 };
191 service_->sync_service_url().spec() == 194
192 ProfileSyncService::kDevServerUrl); 195 ACTION(ReturnNewSyncBackendHostMock) {
193 } 196 return new browser_sync::SyncBackendHostMock();
194 197 }
195 // Tests that the sync service doesn't forget to notify observers about 198
196 // setup state. 199 ACTION(ReturnNewSyncBackendHostNoReturn) {
197 TEST(ProfileSyncServiceTestBasic, SetupInProgress) { 200 return new browser_sync::SyncBackendHostNoReturn();
198 ProfileSyncService service( 201 }
199 NULL, NULL, NULL, NULL, ProfileSyncService::MANUAL_START); 202
200 TestProfileSyncServiceObserver observer(&service); 203 // A test harness that uses a real ProfileSyncService and in most cases a
201 service.AddObserver(&observer); 204 // MockSyncBackendHost.
202 service.SetSetupInProgress(true); 205 //
206 // This is useful if we want to test the ProfileSyncService and don't care about
207 // testing the SyncBackendHost. It's easier to use than the other tests, since
208 // it doesn't involve any threads.
209 class ProfileSyncServiceSimpleTest : public ::testing::Test {
210 protected:
211 ProfileSyncServiceSimpleTest()
212 : thread_bundle_(content::TestBrowserThreadBundle::REAL_DB_THREAD |
Nicolas Zea 2013/11/13 23:49:00 if these test don't involve threads, is the thread
rlarocque 2013/11/14 00:41:38 Apparently yes. There seems to be something in th
213 content::TestBrowserThreadBundle::REAL_FILE_THREAD |
214 content::TestBrowserThreadBundle::REAL_IO_THREAD) {}
215 virtual ~ProfileSyncServiceSimpleTest() {}
216
217 virtual void SetUp() OVERRIDE {
218 TestingProfile::Builder builder;
219
220 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(),
221 FakeOAuth2TokenService::BuildTokenService);
222 invalidation::InvalidationServiceFactory::GetInstance()->
223 SetBuildOnlyFakeInvalidatorsForTest(true);
224
225 profile_ = builder.Build().Pass();
226 }
227
228 virtual void TearDown() OVERRIDE {
229 // Kill the service before the profile.
230 if (service_)
231 service_->Shutdown();
232
233 service_.reset();
234 profile_.reset();
235
236 // Pump messages posted by the sync thread (which may end up
237 // posting on the IO thread).
238 base::RunLoop().RunUntilIdle();
239 content::RunAllPendingInMessageLoop(content::BrowserThread::IO);
Nicolas Zea 2013/11/13 23:49:00 Similar question about this?
rlarocque 2013/11/14 00:41:38 I'm mostly sure this is unnecessary. The ThreadBu
240 base::RunLoop().RunUntilIdle();
241 }
242
243 void IssueTestTokens() {
244 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get())
245 ->UpdateCredentials("test", "oauth2_login_token");
246 }
247
248 void CreateService(ProfileSyncService::StartBehavior behavior) {
249 SigninManagerBase* signin =
250 SigninManagerFactory::GetForProfile(profile_.get());
251 signin->SetAuthenticatedUsername("test");
252 ProfileOAuth2TokenService* oauth2_token_service =
253 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get());
254 components_factory_ = new StrictMock<ProfileSyncComponentsFactoryMock>();
255 service_.reset(new ProfileSyncService(
256 components_factory_,
257 profile_.get(),
258 signin,
259 oauth2_token_service,
260 behavior));
261 }
262
263 void ShutdownAndDeleteService() {
264 if (service_)
265 service_->Shutdown();
266 service_.reset();
267 }
268
269 void Initialize() {
270 service_->Initialize();
271 }
272
273 void ExpectDataTypeManagerCreation() {
274 EXPECT_CALL(*components_factory_, CreateDataTypeManager(_, _, _, _, _, _)).
275 WillOnce(ReturnNewDataTypeManager());
276 }
277
278 void ExpectSyncBackendHostCreation() {
279 EXPECT_CALL(*components_factory_, CreateSyncBackendHost(_, _, _)).
280 WillOnce(ReturnNewSyncBackendHostMock());
281 }
282
283 void PrepareDelayedInitSyncBackendHost() {
284 EXPECT_CALL(*components_factory_, CreateSyncBackendHost(_, _, _)).
285 WillOnce(ReturnNewSyncBackendHostNoReturn());
286 }
287
288 TestingProfile* profile() {
289 return profile_.get();
290 }
291
292 ProfileSyncService* service() {
293 return service_.get();
294 }
295
296 ProfileSyncComponentsFactoryMock* components_factory() {
297 return components_factory_;
298 }
299
300 private:
301 scoped_ptr<TestingProfile> profile_;
302 scoped_ptr<ProfileSyncService> service_;
303
304 // Pointer to the components factory. Not owned. May be null.
305 ProfileSyncComponentsFactoryMock* components_factory_;
306
307 content::TestBrowserThreadBundle thread_bundle_;
308 };
309
310 // Verify that the server URLs are sane.
311 TEST_F(ProfileSyncServiceSimpleTest, InitialState) {
312 CreateService(ProfileSyncService::AUTO_START);
313 Initialize();
314 const std::string& url = service()->sync_service_url().spec();
315 EXPECT_TRUE(url == ProfileSyncService::kSyncServerUrl ||
316 url == ProfileSyncService::kDevServerUrl);
317 }
318
319 // Verify a successful initialization.
320 TEST_F(ProfileSyncServiceSimpleTest, SuccessfulInitialization) {
321 profile()->GetTestingPrefService()->SetManagedPref(
322 prefs::kSyncManaged,
323 Value::CreateBooleanValue(false));
324 IssueTestTokens();
325 CreateService(ProfileSyncService::AUTO_START);
326 ExpectDataTypeManagerCreation();
327 ExpectSyncBackendHostCreation();
328 Initialize();
329 EXPECT_FALSE(service()->IsManaged());
330 EXPECT_TRUE(service()->sync_initialized());
331 }
332
333
334 // Verify that the SetSetupInProgress function call updates state
335 // and notifies observers.
336 TEST_F(ProfileSyncServiceSimpleTest, SetupInProgress) {
337 CreateService(ProfileSyncService::MANUAL_START);
338 Initialize();
339
340 TestProfileSyncServiceObserver observer(service());
341 service()->AddObserver(&observer);
342
343 service()->SetSetupInProgress(true);
203 EXPECT_TRUE(observer.first_setup_in_progress()); 344 EXPECT_TRUE(observer.first_setup_in_progress());
204 service.SetSetupInProgress(false); 345 service()->SetSetupInProgress(false);
205 EXPECT_FALSE(observer.first_setup_in_progress()); 346 EXPECT_FALSE(observer.first_setup_in_progress());
206 service.RemoveObserver(&observer); 347
207 } 348 service()->RemoveObserver(&observer);
208 349 }
209 TEST_F(ProfileSyncServiceTest, DisabledByPolicy) { 350
210 profile_->GetTestingPrefService()->SetManagedPref( 351 // Verify that disable by enterprise policy works.
352 TEST_F(ProfileSyncServiceSimpleTest, DisabledByPolicyBeforeInit) {
353 profile()->GetTestingPrefService()->SetManagedPref(
211 prefs::kSyncManaged, 354 prefs::kSyncManaged,
212 Value::CreateBooleanValue(true)); 355 Value::CreateBooleanValue(true));
213 SigninManagerBase* signin = 356 IssueTestTokens();
214 SigninManagerFactory::GetForProfile(profile_.get()); 357 CreateService(ProfileSyncService::AUTO_START);
215 ProfileOAuth2TokenService* oauth2_token_service = 358 Initialize();
216 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()); 359 EXPECT_TRUE(service()->IsManaged());
217 service_.reset(new TestProfileSyncService( 360 EXPECT_FALSE(service()->sync_initialized());
218 new ProfileSyncComponentsFactoryMock(), 361 }
219 profile_.get(), 362
220 signin, 363 // Verify that disable by enterprise policy works even after the backend has
221 oauth2_token_service, 364 // been initialized.
222 ProfileSyncService::MANUAL_START, 365 TEST_F(ProfileSyncServiceSimpleTest, DisabledByPolicyAfterInit) {
223 true)); 366 IssueTestTokens();
224 service_->Initialize(); 367 CreateService(ProfileSyncService::AUTO_START);
225 EXPECT_TRUE(service_->IsManaged()); 368 ExpectDataTypeManagerCreation();
226 } 369 ExpectSyncBackendHostCreation();
227 370 Initialize();
228 TEST_F(ProfileSyncServiceTest, AbortedByShutdown) { 371
229 SigninManagerBase* signin = 372 EXPECT_FALSE(service()->IsManaged());
230 SigninManagerFactory::GetForProfile(profile_.get()); 373 EXPECT_TRUE(service()->sync_initialized());
231 signin->SetAuthenticatedUsername("test"); 374
232 ProfileOAuth2TokenService* oauth2_token_service = 375 profile()->GetTestingPrefService()->SetManagedPref(
233 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()); 376 prefs::kSyncManaged,
234 ProfileSyncComponentsFactoryMock* factory = 377 Value::CreateBooleanValue(true));
235 new ProfileSyncComponentsFactoryMock(); 378
236 service_.reset(new TestProfileSyncService( 379 EXPECT_TRUE(service()->IsManaged());
237 factory, 380 EXPECT_FALSE(service()->sync_initialized());
238 profile_.get(), 381 }
239 signin, 382
240 oauth2_token_service, 383 // Exercies the ProfileSyncService's code paths related to getting shut down
241 ProfileSyncService::AUTO_START, 384 // before the backend initialize call returns.
242 true)); 385 TEST_F(ProfileSyncServiceSimpleTest, AbortedByShutdown) {
243 EXPECT_CALL(*factory, CreateDataTypeManager(_, _, _, _, _, _)).Times(0); 386 CreateService(ProfileSyncService::AUTO_START);
244 EXPECT_CALL(*factory, CreateBookmarkSyncComponents(_, _)). 387 PrepareDelayedInitSyncBackendHost();
245 Times(0); 388
246 service_->RegisterDataTypeController( 389 IssueTestTokens();
247 new BookmarkDataTypeController(service_->factory(), 390 Initialize();
248 profile_.get(), 391 EXPECT_FALSE(service()->sync_initialized());
249 service_.get())); 392
250 393 ShutdownAndDeleteService();
251 service_->Initialize(); 394 }
252 service_->Shutdown(); 395
253 service_.reset(); 396 // Test StopAndSuppress() before we've initialized the backend.
254 } 397 TEST_F(ProfileSyncServiceSimpleTest, EarlyStopAndSuppress) {
255 398 CreateService(ProfileSyncService::AUTO_START);
256 TEST_F(ProfileSyncServiceTest, DisableAndEnableSyncTemporarily) { 399 IssueTestTokens();
257 SigninManagerBase* signin = 400
258 SigninManagerFactory::GetForProfile(profile_.get()); 401 service()->StopAndSuppress();
259 signin->SetAuthenticatedUsername("test"); 402 EXPECT_TRUE(profile()->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart));
260 ProfileOAuth2TokenService* oauth2_token_service = 403
261 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()); 404 // Because of supression, this should fail.
262 ProfileSyncComponentsFactoryMock* factory = 405 Initialize();
263 new ProfileSyncComponentsFactoryMock(); 406 EXPECT_FALSE(service()->sync_initialized());
264 service_.reset(new TestProfileSyncService( 407
265 factory, 408 // Remove suppression. This should be enough to allow init to happen.
266 profile_.get(), 409 ExpectDataTypeManagerCreation();
267 signin, 410 ExpectSyncBackendHostCreation();
268 oauth2_token_service, 411 service()->UnsuppressAndStart();
269 ProfileSyncService::AUTO_START, 412 EXPECT_TRUE(service()->sync_initialized());
270 true));
271 // Register the bookmark data type.
272 EXPECT_CALL(*factory, CreateDataTypeManager(_, _, _, _, _, _)).
273 WillRepeatedly(ReturnNewDataTypeManager());
274
275 IssueTestTokens();
276
277 service_->Initialize();
278 EXPECT_TRUE(service_->sync_initialized());
279 EXPECT_TRUE(service_->GetBackendForTest() != NULL);
280 EXPECT_FALSE( 413 EXPECT_FALSE(
281 profile_->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart)); 414 profile()->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart));
282 415 }
283 service_->StopAndSuppress(); 416
284 EXPECT_FALSE(service_->sync_initialized()); 417 // Test StopAndSuppress() after we've initialized the backend.
285 EXPECT_TRUE( 418 TEST_F(ProfileSyncServiceSimpleTest, DisableAndEnableSyncTemporarily) {
286 profile_->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart)); 419 CreateService(ProfileSyncService::AUTO_START);
287 420 IssueTestTokens();
288 service_->UnsuppressAndStart(); 421 ExpectDataTypeManagerCreation();
289 EXPECT_TRUE(service_->sync_initialized()); 422 ExpectSyncBackendHostCreation();
423 Initialize();
424
425 EXPECT_TRUE(service()->sync_initialized());
426 EXPECT_FALSE(profile()->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart));
427
428 testing::Mock::VerifyAndClearExpectations(components_factory());
429
430 service()->StopAndSuppress();
431 EXPECT_FALSE(service()->sync_initialized());
432 EXPECT_TRUE(profile()->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart));
433
434 ExpectDataTypeManagerCreation();
435 ExpectSyncBackendHostCreation();
436
437 service()->UnsuppressAndStart();
438 EXPECT_TRUE(service()->sync_initialized());
290 EXPECT_FALSE( 439 EXPECT_FALSE(
291 profile_->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart)); 440 profile()->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart));
292 } 441 }
293 442
294 // Certain ProfileSyncService tests don't apply to Chrome OS, for example 443 // Certain ProfileSyncService tests don't apply to Chrome OS, for example
295 // things that deal with concepts like "signing out" and policy. 444 // things that deal with concepts like "signing out" and policy.
296 #if !defined (OS_CHROMEOS) 445 #if !defined (OS_CHROMEOS)
297 446
298 TEST_F(ProfileSyncServiceTest, EnableSyncAndSignOut) { 447 TEST_F(ProfileSyncServiceSimpleTest, EnableSyncAndSignOut) {
299 SigninManager* signin = 448 CreateService(ProfileSyncService::AUTO_START);
300 SigninManagerFactory::GetForProfile(profile_.get()); 449 ExpectDataTypeManagerCreation();
301 signin->SetAuthenticatedUsername("test"); 450 ExpectSyncBackendHostCreation();
302 ProfileOAuth2TokenService* oauth2_token_service = 451 IssueTestTokens();
303 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()); 452 Initialize();
304 ProfileSyncComponentsFactoryMock* factory = 453
305 new ProfileSyncComponentsFactoryMock(); 454 EXPECT_TRUE(service()->sync_initialized());
306 service_.reset(new TestProfileSyncService( 455 EXPECT_FALSE(profile()->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart));
307 factory, 456
308 profile_.get(), 457 SigninManagerFactory::GetForProfile(profile())->SignOut();
309 signin, 458 EXPECT_FALSE(service()->sync_initialized());
310 oauth2_token_service,
311 ProfileSyncService::AUTO_START,
312 true));
313 // Register the bookmark data type.
314 EXPECT_CALL(*factory, CreateDataTypeManager(_, _, _, _, _, _)).
315 WillRepeatedly(ReturnNewDataTypeManager());
316
317 IssueTestTokens();
318
319 service_->Initialize();
320 EXPECT_TRUE(service_->sync_initialized());
321 EXPECT_TRUE(service_->GetBackendForTest() != NULL);
322 EXPECT_FALSE(
323 profile_->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart));
324
325 signin->SignOut();
326 EXPECT_FALSE(service_->sync_initialized());
327 } 459 }
328 460
329 #endif // !defined(OS_CHROMEOS) 461 #endif // !defined(OS_CHROMEOS)
330 462
331 TEST_F(ProfileSyncServiceTest, JsControllerHandlersBasic) { 463 TEST_F(ProfileSyncServiceTest, JsControllerHandlersBasic) {
332 StartSyncService(); 464 StartSyncService();
333 EXPECT_TRUE(service_->sync_initialized()); 465 EXPECT_TRUE(service_->sync_initialized());
334 EXPECT_TRUE(service_->GetBackendForTest() != NULL); 466 EXPECT_TRUE(service_->GetBackendForTest() != NULL);
335 467
336 base::WeakPtr<syncer::JsController> js_controller = 468 base::WeakPtr<syncer::JsController> js_controller =
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 EXPECT_TRUE(token_status.next_token_request_time.is_null()); 646 EXPECT_TRUE(token_status.next_token_request_time.is_null());
515 647
516 // Simulate successful connection. 648 // Simulate successful connection.
517 service_->OnConnectionStatusChange(syncer::CONNECTION_OK); 649 service_->OnConnectionStatusChange(syncer::CONNECTION_OK);
518 token_status = service_->GetSyncTokenStatus(); 650 token_status = service_->GetSyncTokenStatus();
519 EXPECT_EQ(syncer::CONNECTION_OK, token_status.connection_status); 651 EXPECT_EQ(syncer::CONNECTION_OK, token_status.connection_status);
520 } 652 }
521 653
522 } // namespace 654 } // namespace
523 } // namespace browser_sync 655 } // namespace browser_sync
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698