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

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

Issue 410843003: Disable all the tests that are flaking more than 5% on Windows builders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 months 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
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/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/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/prefs/pref_service_syncable.h" 9 #include "chrome/browser/prefs/pref_service_syncable.h"
10 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" 10 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 303
304 // Simulate successful signin. 304 // Simulate successful signin.
305 SimulateTestUserSignin(); 305 SimulateTestUserSignin();
306 306
307 sync_->SetSetupInProgress(false); 307 sync_->SetSetupInProgress(false);
308 308
309 // Verify we successfully finish startup and configuration. 309 // Verify we successfully finish startup and configuration.
310 EXPECT_TRUE(sync_->ShouldPushChanges()); 310 EXPECT_TRUE(sync_->ShouldPushChanges());
311 } 311 }
312 312
313 TEST_F(ProfileSyncServiceStartupCrosTest, StartCrosNoCredentials) { 313 #if defined(OS_WIN)
314 // http://crbug.com/396402
315 #define MAYBE_StartCrosNoCredentials DISABLED_StartCrosNoCredentials
316 #else
317 #define MAYBE_StartCrosNoCredentials StartCrosNoCredentials
318 #endif
319 TEST_F(ProfileSyncServiceStartupCrosTest, MAYBE_StartCrosNoCredentials) {
314 EXPECT_CALL(*components_factory_mock(), 320 EXPECT_CALL(*components_factory_mock(),
315 CreateDataTypeManager(_, _, _, _, _, _)).Times(0); 321 CreateDataTypeManager(_, _, _, _, _, _)).Times(0);
316 EXPECT_CALL(*components_factory_mock(), 322 EXPECT_CALL(*components_factory_mock(),
317 CreateSyncBackendHost(_, _, _, _, _)).Times(0); 323 CreateSyncBackendHost(_, _, _, _, _)).Times(0);
318 profile_->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted); 324 profile_->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted);
319 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); 325 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
320 326
321 sync_->Initialize(); 327 sync_->Initialize();
322 // Sync should not start because there are no tokens yet. 328 // Sync should not start because there are no tokens yet.
323 EXPECT_FALSE(sync_->ShouldPushChanges()); 329 EXPECT_FALSE(sync_->ShouldPushChanges());
(...skipping 11 matching lines...) Expand all
335 EXPECT_CALL(*data_type_manager, state()). 341 EXPECT_CALL(*data_type_manager, state()).
336 WillRepeatedly(Return(DataTypeManager::CONFIGURED)); 342 WillRepeatedly(Return(DataTypeManager::CONFIGURED));
337 EXPECT_CALL(*data_type_manager, Stop()).Times(1); 343 EXPECT_CALL(*data_type_manager, Stop()).Times(1);
338 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); 344 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
339 345
340 IssueTestTokens(); 346 IssueTestTokens();
341 sync_->Initialize(); 347 sync_->Initialize();
342 EXPECT_TRUE(sync_->ShouldPushChanges()); 348 EXPECT_TRUE(sync_->ShouldPushChanges());
343 } 349 }
344 350
345 TEST_F(ProfileSyncServiceStartupTest, StartNormal) { 351 #if defined(OS_WIN)
352 // http://crbug.com/396402
353 #define MAYBE_StartNormal DISABLED_StartNormal
354 #else
355 #define MAYBE_StartNormal StartNormal
356 #endif
357 TEST_F(ProfileSyncServiceStartupTest, MAYBE_StartNormal) {
346 // Pre load the tokens 358 // Pre load the tokens
347 profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername, 359 profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername,
348 "test_user@gmail.com"); 360 "test_user@gmail.com");
349 SigninManagerFactory::GetForProfile(profile_) 361 SigninManagerFactory::GetForProfile(profile_)
350 ->SetAuthenticatedUsername("test_user@gmail.com"); 362 ->SetAuthenticatedUsername("test_user@gmail.com");
351 CreateSyncService(); 363 CreateSyncService();
352 sync_->SetSyncSetupCompleted(); 364 sync_->SetSyncSetupCompleted();
353 SetUpSyncBackendHost(); 365 SetUpSyncBackendHost();
354 DataTypeManagerMock* data_type_manager = SetUpDataTypeManager(); 366 DataTypeManagerMock* data_type_manager = SetUpDataTypeManager();
355 EXPECT_CALL(*data_type_manager, Configure(_, _)); 367 EXPECT_CALL(*data_type_manager, Configure(_, _));
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 406
395 IssueTestTokens(); 407 IssueTestTokens();
396 sync_->Initialize(); 408 sync_->Initialize();
397 409
398 EXPECT_TRUE(profile_->GetPrefs()->GetBoolean( 410 EXPECT_TRUE(profile_->GetPrefs()->GetBoolean(
399 sync_driver::prefs::kSyncKeepEverythingSynced)); 411 sync_driver::prefs::kSyncKeepEverythingSynced));
400 } 412 }
401 413
402 // Verify that the recovery of datatype preferences doesn't overwrite a valid 414 // Verify that the recovery of datatype preferences doesn't overwrite a valid
403 // case where only bookmarks are enabled. 415 // case where only bookmarks are enabled.
404 TEST_F(ProfileSyncServiceStartupTest, StartDontRecoverDatatypePrefs) { 416 #if defined(OS_WIN)
417 // http://crbug.com/396402
418 #define MAYBE_StartDontRecoverDatatypePrefs DISABLED_StartDontRecoverDatatypePre fs
419 #else
420 #define MAYBE_StartDontRecoverDatatypePrefs StartDontRecoverDatatypePrefs
421 #endif
422 TEST_F(ProfileSyncServiceStartupTest, MAYBE_StartDontRecoverDatatypePrefs) {
405 // Explicitly set Keep Everything Synced to false and have only bookmarks 423 // Explicitly set Keep Everything Synced to false and have only bookmarks
406 // enabled. 424 // enabled.
407 profile_->GetPrefs()->SetBoolean( 425 profile_->GetPrefs()->SetBoolean(
408 sync_driver::prefs::kSyncKeepEverythingSynced, false); 426 sync_driver::prefs::kSyncKeepEverythingSynced, false);
409 427
410 // Pre load the tokens 428 // Pre load the tokens
411 profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername, 429 profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername,
412 "test_user@gmail.com"); 430 "test_user@gmail.com");
413 SigninManagerFactory::GetForProfile(profile_) 431 SigninManagerFactory::GetForProfile(profile_)
414 ->SetAuthenticatedUsername("test_user@gmail.com"); 432 ->SetAuthenticatedUsername("test_user@gmail.com");
415 CreateSyncService(); 433 CreateSyncService();
416 sync_->SetSyncSetupCompleted(); 434 sync_->SetSyncSetupCompleted();
417 SetUpSyncBackendHost(); 435 SetUpSyncBackendHost();
418 DataTypeManagerMock* data_type_manager = SetUpDataTypeManager(); 436 DataTypeManagerMock* data_type_manager = SetUpDataTypeManager();
419 EXPECT_CALL(*data_type_manager, Configure(_, _)); 437 EXPECT_CALL(*data_type_manager, Configure(_, _));
420 EXPECT_CALL(*data_type_manager, state()). 438 EXPECT_CALL(*data_type_manager, state()).
421 WillRepeatedly(Return(DataTypeManager::CONFIGURED)); 439 WillRepeatedly(Return(DataTypeManager::CONFIGURED));
422 EXPECT_CALL(*data_type_manager, Stop()).Times(1); 440 EXPECT_CALL(*data_type_manager, Stop()).Times(1);
423 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); 441 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
424 IssueTestTokens(); 442 IssueTestTokens();
425 sync_->Initialize(); 443 sync_->Initialize();
426 444
427 EXPECT_FALSE(profile_->GetPrefs()->GetBoolean( 445 EXPECT_FALSE(profile_->GetPrefs()->GetBoolean(
428 sync_driver::prefs::kSyncKeepEverythingSynced)); 446 sync_driver::prefs::kSyncKeepEverythingSynced));
429 } 447 }
430 448
431 TEST_F(ProfileSyncServiceStartupTest, ManagedStartup) { 449 #if defined(OS_WIN)
450 // http://crbug.com/396402
451 #define MAYBE_ManagedStartup DISABLED_ManagedStartup
452 #else
453 #define MAYBE_ManagedStartup ManagedStartup
454 #endif
455 TEST_F(ProfileSyncServiceStartupTest, MAYBE_ManagedStartup) {
432 // Service should not be started by Initialize() since it's managed. 456 // Service should not be started by Initialize() since it's managed.
433 profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername, 457 profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername,
434 "test_user@gmail.com"); 458 "test_user@gmail.com");
435 CreateSyncService(); 459 CreateSyncService();
436 460
437 // Disable sync through policy. 461 // Disable sync through policy.
438 profile_->GetPrefs()->SetBoolean(sync_driver::prefs::kSyncManaged, true); 462 profile_->GetPrefs()->SetBoolean(sync_driver::prefs::kSyncManaged, true);
439 EXPECT_CALL(*components_factory_mock(), 463 EXPECT_CALL(*components_factory_mock(),
440 CreateDataTypeManager(_, _, _, _, _, _)).Times(0); 464 CreateDataTypeManager(_, _, _, _, _, _)).Times(0);
441 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); 465 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 profile_->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted); 546 profile_->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted);
523 547
524 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); 548 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
525 sync_->Initialize(); 549 sync_->Initialize();
526 550
527 sync_->SetSetupInProgress(true); 551 sync_->SetSetupInProgress(true);
528 IssueTestTokens(); 552 IssueTestTokens();
529 sync_->SetSetupInProgress(false); 553 sync_->SetSetupInProgress(false);
530 EXPECT_FALSE(sync_->sync_initialized()); 554 EXPECT_FALSE(sync_->sync_initialized());
531 } 555 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698