| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/profile_resetter/profile_resetter.h" | 5 #include "chrome/browser/profile_resetter/profile_resetter.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 | 682 |
| 683 ResetAndWait(ProfileResetter::EXTENSIONS); | 683 ResetAndWait(ProfileResetter::EXTENSIONS); |
| 684 | 684 |
| 685 EXPECT_EQ(1u, registry()->enabled_extensions().size()); | 685 EXPECT_EQ(1u, registry()->enabled_extensions().size()); |
| 686 EXPECT_FALSE(registry()->enabled_extensions().Contains(ext1->id())); | 686 EXPECT_FALSE(registry()->enabled_extensions().Contains(ext1->id())); |
| 687 EXPECT_FALSE(registry()->enabled_extensions().Contains(ext2->id())); | 687 EXPECT_FALSE(registry()->enabled_extensions().Contains(ext2->id())); |
| 688 EXPECT_TRUE(registry()->enabled_extensions().Contains(ext3->id())); | 688 EXPECT_TRUE(registry()->enabled_extensions().Contains(ext3->id())); |
| 689 EXPECT_TRUE(theme_service->UsingDefaultTheme()); | 689 EXPECT_TRUE(theme_service->UsingDefaultTheme()); |
| 690 } | 690 } |
| 691 | 691 |
| 692 TEST_F(ProfileResetterTest, ResetExtensionsByReenablingExternalComponents) { |
| 693 service_->Init(); |
| 694 |
| 695 base::ScopedTempDir temp_dir; |
| 696 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| 697 |
| 698 scoped_refptr<Extension> ext = |
| 699 CreateExtension(base::ASCIIToUTF16("example"), |
| 700 base::FilePath(FILE_PATH_LITERAL("//nonexistent")), |
| 701 Manifest::EXTERNAL_COMPONENT, |
| 702 extensions::Manifest::TYPE_EXTENSION, false); |
| 703 service_->AddExtension(ext.get()); |
| 704 |
| 705 service_->DisableExtension(ext->id(), |
| 706 extensions::Extension::DISABLE_USER_ACTION); |
| 707 EXPECT_FALSE(registry()->enabled_extensions().Contains(ext->id())); |
| 708 EXPECT_TRUE(registry()->disabled_extensions().Contains(ext->id())); |
| 709 |
| 710 ResetAndWait(ProfileResetter::EXTENSIONS); |
| 711 EXPECT_TRUE(registry()->enabled_extensions().Contains(ext->id())); |
| 712 EXPECT_FALSE(registry()->disabled_extensions().Contains(ext->id())); |
| 713 } |
| 714 |
| 692 TEST_F(ProfileResetterTest, ResetStartPageNonOrganic) { | 715 TEST_F(ProfileResetterTest, ResetStartPageNonOrganic) { |
| 693 PrefService* prefs = profile()->GetPrefs(); | 716 PrefService* prefs = profile()->GetPrefs(); |
| 694 DCHECK(prefs); | 717 DCHECK(prefs); |
| 695 | 718 |
| 696 SessionStartupPref startup_pref(SessionStartupPref::LAST); | 719 SessionStartupPref startup_pref(SessionStartupPref::LAST); |
| 697 SessionStartupPref::SetStartupPref(prefs, startup_pref); | 720 SessionStartupPref::SetStartupPref(prefs, startup_pref); |
| 698 | 721 |
| 699 ResetAndWait(ProfileResetter::STARTUP_PAGES, kDistributionConfig); | 722 ResetAndWait(ProfileResetter::STARTUP_PAGES, kDistributionConfig); |
| 700 | 723 |
| 701 startup_pref = SessionStartupPref::GetStartupPref(prefs); | 724 startup_pref = SessionStartupPref::GetStartupPref(prefs); |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 new ResettableSettingsSnapshot(profile())); | 1070 new ResettableSettingsSnapshot(profile())); |
| 1048 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail, | 1071 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail, |
| 1049 base::Unretained(&capture))); | 1072 base::Unretained(&capture))); |
| 1050 deleted_snapshot.reset(); | 1073 deleted_snapshot.reset(); |
| 1051 // Running remaining tasks shouldn't trigger the callback to be called as | 1074 // Running remaining tasks shouldn't trigger the callback to be called as |
| 1052 // |deleted_snapshot| was deleted before it could run. | 1075 // |deleted_snapshot| was deleted before it could run. |
| 1053 base::RunLoop().RunUntilIdle(); | 1076 base::RunLoop().RunUntilIdle(); |
| 1054 } | 1077 } |
| 1055 | 1078 |
| 1056 } // namespace | 1079 } // namespace |
| OLD | NEW |