| 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 | |
| 715 TEST_F(ProfileResetterTest, ResetStartPageNonOrganic) { | 692 TEST_F(ProfileResetterTest, ResetStartPageNonOrganic) { |
| 716 PrefService* prefs = profile()->GetPrefs(); | 693 PrefService* prefs = profile()->GetPrefs(); |
| 717 DCHECK(prefs); | 694 DCHECK(prefs); |
| 718 | 695 |
| 719 SessionStartupPref startup_pref(SessionStartupPref::LAST); | 696 SessionStartupPref startup_pref(SessionStartupPref::LAST); |
| 720 SessionStartupPref::SetStartupPref(prefs, startup_pref); | 697 SessionStartupPref::SetStartupPref(prefs, startup_pref); |
| 721 | 698 |
| 722 ResetAndWait(ProfileResetter::STARTUP_PAGES, kDistributionConfig); | 699 ResetAndWait(ProfileResetter::STARTUP_PAGES, kDistributionConfig); |
| 723 | 700 |
| 724 startup_pref = SessionStartupPref::GetStartupPref(prefs); | 701 startup_pref = SessionStartupPref::GetStartupPref(prefs); |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 new ResettableSettingsSnapshot(profile())); | 1047 new ResettableSettingsSnapshot(profile())); |
| 1071 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail, | 1048 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail, |
| 1072 base::Unretained(&capture))); | 1049 base::Unretained(&capture))); |
| 1073 deleted_snapshot.reset(); | 1050 deleted_snapshot.reset(); |
| 1074 // Running remaining tasks shouldn't trigger the callback to be called as | 1051 // Running remaining tasks shouldn't trigger the callback to be called as |
| 1075 // |deleted_snapshot| was deleted before it could run. | 1052 // |deleted_snapshot| was deleted before it could run. |
| 1076 base::RunLoop().RunUntilIdle(); | 1053 base::RunLoop().RunUntilIdle(); |
| 1077 } | 1054 } |
| 1078 | 1055 |
| 1079 } // namespace | 1056 } // namespace |
| OLD | NEW |