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/values.h" | 5 #include "base/values.h" |
6 #include "chrome/browser/sync/test/integration/preferences_helper.h" | 6 #include "chrome/browser/sync/test/integration/preferences_helper.h" |
7 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" | 7 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" |
8 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" | 8 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" |
9 #include "chrome/browser/sync/test/integration/sync_test.h" | 9 #include "chrome/browser/sync/test/integration/sync_test.h" |
10 #include "chrome/browser/translate/chrome_translate_client.h" | 10 #include "chrome/browser/translate/chrome_translate_client.h" |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 409 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
410 ASSERT_TRUE(BooleanPrefMatches(prefs::kPromptForDownload)); | 410 ASSERT_TRUE(BooleanPrefMatches(prefs::kPromptForDownload)); |
411 } | 411 } |
412 | 412 |
413 // TCM ID - 3729263. | 413 // TCM ID - 3729263. |
414 IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, | 414 IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, |
415 kPrefTranslateLanguageBlacklist) { | 415 kPrefTranslateLanguageBlacklist) { |
416 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 416 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
417 ASSERT_TRUE(BooleanPrefMatches(prefs::kEnableTranslate)); | 417 ASSERT_TRUE(BooleanPrefMatches(prefs::kEnableTranslate)); |
418 | 418 |
419 scoped_ptr<TranslatePrefs> translate_client0_prefs( | 419 scoped_ptr<translate::TranslatePrefs> translate_client0_prefs( |
420 ChromeTranslateClient::CreateTranslatePrefs(GetPrefs(0))); | 420 ChromeTranslateClient::CreateTranslatePrefs(GetPrefs(0))); |
421 scoped_ptr<TranslatePrefs> translate_client1_prefs( | 421 scoped_ptr<translate::TranslatePrefs> translate_client1_prefs( |
422 ChromeTranslateClient::CreateTranslatePrefs(GetPrefs(1))); | 422 ChromeTranslateClient::CreateTranslatePrefs(GetPrefs(1))); |
423 ASSERT_FALSE(translate_client0_prefs->IsBlockedLanguage("fr")); | 423 ASSERT_FALSE(translate_client0_prefs->IsBlockedLanguage("fr")); |
424 translate_client0_prefs->BlockLanguage("fr"); | 424 translate_client0_prefs->BlockLanguage("fr"); |
425 ASSERT_TRUE(translate_client0_prefs->IsBlockedLanguage("fr")); | 425 ASSERT_TRUE(translate_client0_prefs->IsBlockedLanguage("fr")); |
426 | 426 |
427 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 427 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
428 ASSERT_TRUE(translate_client1_prefs->IsBlockedLanguage("fr")); | 428 ASSERT_TRUE(translate_client1_prefs->IsBlockedLanguage("fr")); |
429 | 429 |
430 translate_client0_prefs->UnblockLanguage("fr"); | 430 translate_client0_prefs->UnblockLanguage("fr"); |
431 ASSERT_FALSE(translate_client0_prefs->IsBlockedLanguage("fr")); | 431 ASSERT_FALSE(translate_client0_prefs->IsBlockedLanguage("fr")); |
432 | 432 |
433 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 433 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
434 ASSERT_FALSE(translate_client1_prefs->IsBlockedLanguage("fr")); | 434 ASSERT_FALSE(translate_client1_prefs->IsBlockedLanguage("fr")); |
435 } | 435 } |
436 | 436 |
437 // TCM ID - 7307195. | 437 // TCM ID - 7307195. |
438 IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, | 438 IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, |
439 kPrefTranslateWhitelists) { | 439 kPrefTranslateWhitelists) { |
440 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 440 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
441 ASSERT_TRUE(BooleanPrefMatches(prefs::kEnableTranslate)); | 441 ASSERT_TRUE(BooleanPrefMatches(prefs::kEnableTranslate)); |
442 | 442 |
443 scoped_ptr<TranslatePrefs> translate_client0_prefs( | 443 scoped_ptr<translate::TranslatePrefs> translate_client0_prefs( |
444 ChromeTranslateClient::CreateTranslatePrefs(GetPrefs(0))); | 444 ChromeTranslateClient::CreateTranslatePrefs(GetPrefs(0))); |
445 scoped_ptr<TranslatePrefs> translate_client1_prefs( | 445 scoped_ptr<translate::TranslatePrefs> translate_client1_prefs( |
446 ChromeTranslateClient::CreateTranslatePrefs(GetPrefs(1))); | 446 ChromeTranslateClient::CreateTranslatePrefs(GetPrefs(1))); |
447 ASSERT_FALSE(translate_client0_prefs->IsLanguagePairWhitelisted("en", "bg")); | 447 ASSERT_FALSE(translate_client0_prefs->IsLanguagePairWhitelisted("en", "bg")); |
448 translate_client0_prefs->WhitelistLanguagePair("en", "bg"); | 448 translate_client0_prefs->WhitelistLanguagePair("en", "bg"); |
449 ASSERT_TRUE(translate_client0_prefs->IsLanguagePairWhitelisted("en", "bg")); | 449 ASSERT_TRUE(translate_client0_prefs->IsLanguagePairWhitelisted("en", "bg")); |
450 | 450 |
451 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 451 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
452 ASSERT_TRUE(translate_client1_prefs->IsLanguagePairWhitelisted("en", "bg")); | 452 ASSERT_TRUE(translate_client1_prefs->IsLanguagePairWhitelisted("en", "bg")); |
453 | 453 |
454 translate_client0_prefs->RemoveLanguagePairFromWhitelist("en", "bg"); | 454 translate_client0_prefs->RemoveLanguagePairFromWhitelist("en", "bg"); |
455 ASSERT_FALSE(translate_client0_prefs->IsLanguagePairWhitelisted("en", "bg")); | 455 ASSERT_FALSE(translate_client0_prefs->IsLanguagePairWhitelisted("en", "bg")); |
456 | 456 |
457 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 457 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
458 ASSERT_FALSE(translate_client1_prefs->IsLanguagePairWhitelisted("en", "bg")); | 458 ASSERT_FALSE(translate_client1_prefs->IsLanguagePairWhitelisted("en", "bg")); |
459 } | 459 } |
460 | 460 |
461 // TCM ID - 3625298. | 461 // TCM ID - 3625298. |
462 IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, | 462 IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, |
463 kPrefTranslateSiteBlacklist) { | 463 kPrefTranslateSiteBlacklist) { |
464 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 464 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
465 ASSERT_TRUE(BooleanPrefMatches(prefs::kEnableTranslate)); | 465 ASSERT_TRUE(BooleanPrefMatches(prefs::kEnableTranslate)); |
466 | 466 |
467 GURL url("http://www.google.com"); | 467 GURL url("http://www.google.com"); |
468 std::string host(url.host()); | 468 std::string host(url.host()); |
469 scoped_ptr<TranslatePrefs> translate_client0_prefs( | 469 scoped_ptr<translate::TranslatePrefs> translate_client0_prefs( |
470 ChromeTranslateClient::CreateTranslatePrefs(GetPrefs(0))); | 470 ChromeTranslateClient::CreateTranslatePrefs(GetPrefs(0))); |
471 scoped_ptr<TranslatePrefs> translate_client1_prefs( | 471 scoped_ptr<translate::TranslatePrefs> translate_client1_prefs( |
472 ChromeTranslateClient::CreateTranslatePrefs(GetPrefs(1))); | 472 ChromeTranslateClient::CreateTranslatePrefs(GetPrefs(1))); |
473 ASSERT_FALSE(translate_client0_prefs->IsSiteBlacklisted(host)); | 473 ASSERT_FALSE(translate_client0_prefs->IsSiteBlacklisted(host)); |
474 translate_client0_prefs->BlacklistSite(host); | 474 translate_client0_prefs->BlacklistSite(host); |
475 ASSERT_TRUE(translate_client0_prefs->IsSiteBlacklisted(host)); | 475 ASSERT_TRUE(translate_client0_prefs->IsSiteBlacklisted(host)); |
476 | 476 |
477 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 477 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
478 ASSERT_TRUE(translate_client1_prefs->IsSiteBlacklisted(host)); | 478 ASSERT_TRUE(translate_client1_prefs->IsSiteBlacklisted(host)); |
479 | 479 |
480 translate_client0_prefs->RemoveSiteFromBlacklist(host); | 480 translate_client0_prefs->RemoveSiteFromBlacklist(host); |
481 ASSERT_FALSE(translate_client0_prefs->IsSiteBlacklisted(host)); | 481 ASSERT_FALSE(translate_client0_prefs->IsSiteBlacklisted(host)); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 610 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
611 ASSERT_TRUE(IsEncryptionComplete(0)); | 611 ASSERT_TRUE(IsEncryptionComplete(0)); |
612 ASSERT_TRUE(IsEncryptionComplete(1)); | 612 ASSERT_TRUE(IsEncryptionComplete(1)); |
613 ASSERT_TRUE(BooleanPrefMatches(prefs::kHomePageIsNewTabPage)); | 613 ASSERT_TRUE(BooleanPrefMatches(prefs::kHomePageIsNewTabPage)); |
614 | 614 |
615 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); | 615 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); |
616 ChangeBooleanPref(0, prefs::kShowHomeButton); | 616 ChangeBooleanPref(0, prefs::kShowHomeButton); |
617 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 617 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
618 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); | 618 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); |
619 } | 619 } |
OLD | NEW |