| 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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 EXPECT_EQ(1U, host_settings.size()); | 552 EXPECT_EQ(1U, host_settings.size()); |
| 553 } | 553 } |
| 554 } | 554 } |
| 555 | 555 |
| 556 TEST_F(ProfileResetterTest, ResetExtensionsByDisabling) { | 556 TEST_F(ProfileResetterTest, ResetExtensionsByDisabling) { |
| 557 service_->Init(); | 557 service_->Init(); |
| 558 | 558 |
| 559 base::ScopedTempDir temp_dir; | 559 base::ScopedTempDir temp_dir; |
| 560 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 560 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| 561 | 561 |
| 562 scoped_refptr<Extension> theme = | 562 scoped_refptr<Extension> theme = CreateExtension( |
| 563 CreateExtension(base::ASCIIToUTF16("example1"), | 563 base::ASCIIToUTF16("example1"), temp_dir.GetPath(), |
| 564 temp_dir.path(), | 564 Manifest::INVALID_LOCATION, extensions::Manifest::TYPE_THEME, false); |
| 565 Manifest::INVALID_LOCATION, | |
| 566 extensions::Manifest::TYPE_THEME, | |
| 567 false); | |
| 568 service_->FinishInstallationForTest(theme.get()); | 565 service_->FinishInstallationForTest(theme.get()); |
| 569 // Let ThemeService finish creating the theme pack. | 566 // Let ThemeService finish creating the theme pack. |
| 570 base::RunLoop().RunUntilIdle(); | 567 base::RunLoop().RunUntilIdle(); |
| 571 | 568 |
| 572 ThemeService* theme_service = | 569 ThemeService* theme_service = |
| 573 ThemeServiceFactory::GetForProfile(profile()); | 570 ThemeServiceFactory::GetForProfile(profile()); |
| 574 EXPECT_FALSE(theme_service->UsingDefaultTheme()); | 571 EXPECT_FALSE(theme_service->UsingDefaultTheme()); |
| 575 | 572 |
| 576 scoped_refptr<Extension> ext2 = CreateExtension( | 573 scoped_refptr<Extension> ext2 = CreateExtension( |
| 577 base::ASCIIToUTF16("example2"), | 574 base::ASCIIToUTF16("example2"), |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 EXPECT_EQ(1u, registry()->enabled_extensions().size()); | 645 EXPECT_EQ(1u, registry()->enabled_extensions().size()); |
| 649 EXPECT_TRUE(registry()->enabled_extensions().Contains(ext3->id())); | 646 EXPECT_TRUE(registry()->enabled_extensions().Contains(ext3->id())); |
| 650 } | 647 } |
| 651 | 648 |
| 652 TEST_F(ProfileResetterTest, ResetExtensionsAndDefaultApps) { | 649 TEST_F(ProfileResetterTest, ResetExtensionsAndDefaultApps) { |
| 653 service_->Init(); | 650 service_->Init(); |
| 654 | 651 |
| 655 base::ScopedTempDir temp_dir; | 652 base::ScopedTempDir temp_dir; |
| 656 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 653 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| 657 | 654 |
| 658 scoped_refptr<Extension> ext1 = | 655 scoped_refptr<Extension> ext1 = CreateExtension( |
| 659 CreateExtension(base::ASCIIToUTF16("example1"), | 656 base::ASCIIToUTF16("example1"), temp_dir.GetPath(), |
| 660 temp_dir.path(), | 657 Manifest::INVALID_LOCATION, extensions::Manifest::TYPE_THEME, false); |
| 661 Manifest::INVALID_LOCATION, | |
| 662 extensions::Manifest::TYPE_THEME, | |
| 663 false); | |
| 664 service_->FinishInstallationForTest(ext1.get()); | 658 service_->FinishInstallationForTest(ext1.get()); |
| 665 // Let ThemeService finish creating the theme pack. | 659 // Let ThemeService finish creating the theme pack. |
| 666 base::RunLoop().RunUntilIdle(); | 660 base::RunLoop().RunUntilIdle(); |
| 667 | 661 |
| 668 ThemeService* theme_service = | 662 ThemeService* theme_service = |
| 669 ThemeServiceFactory::GetForProfile(profile()); | 663 ThemeServiceFactory::GetForProfile(profile()); |
| 670 EXPECT_FALSE(theme_service->UsingDefaultTheme()); | 664 EXPECT_FALSE(theme_service->UsingDefaultTheme()); |
| 671 | 665 |
| 672 scoped_refptr<Extension> ext2 = | 666 scoped_refptr<Extension> ext2 = |
| 673 CreateExtension(base::ASCIIToUTF16("example2"), | 667 CreateExtension(base::ASCIIToUTF16("example2"), |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 new ResettableSettingsSnapshot(profile())); | 1047 new ResettableSettingsSnapshot(profile())); |
| 1054 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail, | 1048 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail, |
| 1055 base::Unretained(&capture))); | 1049 base::Unretained(&capture))); |
| 1056 deleted_snapshot.reset(); | 1050 deleted_snapshot.reset(); |
| 1057 // 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 |
| 1058 // |deleted_snapshot| was deleted before it could run. | 1052 // |deleted_snapshot| was deleted before it could run. |
| 1059 base::RunLoop().RunUntilIdle(); | 1053 base::RunLoop().RunUntilIdle(); |
| 1060 } | 1054 } |
| 1061 | 1055 |
| 1062 } // namespace | 1056 } // namespace |
| OLD | NEW |