| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <list> | 5 #include <list> |
| 6 #include <set> | 6 #include <set> |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 | 700 |
| 701 protected: | 701 protected: |
| 702 // The id of the extension we want to have force-installed. | 702 // The id of the extension we want to have force-installed. |
| 703 std::string id_ = "npnbmohejbjohgpjnmjagbafnjhkmgko"; | 703 std::string id_ = "npnbmohejbjohgpjnmjagbafnjhkmgko"; |
| 704 | 704 |
| 705 private: | 705 private: |
| 706 policy::MockConfigurationPolicyProvider policy_provider_; | 706 policy::MockConfigurationPolicyProvider policy_provider_; |
| 707 DownloaderTestDelegate downloader_; | 707 DownloaderTestDelegate downloader_; |
| 708 }; | 708 }; |
| 709 | 709 |
| 710 // Disabled due to flakiness (crbug.com/668067) |
| 710 // We want to test what happens at startup with a corroption-disabled policy | 711 // We want to test what happens at startup with a corroption-disabled policy |
| 711 // force installed extension. So we set that up in the PRE test here. | 712 // force installed extension. So we set that up in the PRE test here. |
| 712 IN_PROC_BROWSER_TEST_F(ContentVerifierPolicyTest, | 713 IN_PROC_BROWSER_TEST_F(ContentVerifierPolicyTest, |
| 713 PRE_PolicyCorruptedOnStartup) { | 714 DISABLED_PRE_PolicyCorruptedOnStartup) { |
| 714 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); | 715 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); |
| 715 RegistryObserver registry_observer(registry); | 716 RegistryObserver registry_observer(registry); |
| 716 | 717 |
| 717 // Wait for the extension to be installed by policy we set up in | 718 // Wait for the extension to be installed by policy we set up in |
| 718 // SetUpInProcessBrowserTestFixture. | 719 // SetUpInProcessBrowserTestFixture. |
| 719 if (!registry->GetInstalledExtension(id_)) { | 720 if (!registry->GetInstalledExtension(id_)) { |
| 720 EXPECT_TRUE(registry_observer.WaitForInstall(id_)); | 721 EXPECT_TRUE(registry_observer.WaitForInstall(id_)); |
| 721 } | 722 } |
| 722 | 723 |
| 723 // Simulate corruption of the extension so that we can test what happens | 724 // Simulate corruption of the extension so that we can test what happens |
| 724 // at startup in the non-PRE test. | 725 // at startup in the non-PRE test. |
| 725 ExtensionSystem* system = ExtensionSystem::Get(profile()); | 726 ExtensionSystem* system = ExtensionSystem::Get(profile()); |
| 726 ContentVerifier* verifier = system->content_verifier(); | 727 ContentVerifier* verifier = system->content_verifier(); |
| 727 verifier->VerifyFailed(id_, ContentVerifyJob::HASH_MISMATCH); | 728 verifier->VerifyFailed(id_, ContentVerifyJob::HASH_MISMATCH); |
| 728 EXPECT_TRUE(registry_observer.WaitForUnload(id_)); | 729 EXPECT_TRUE(registry_observer.WaitForUnload(id_)); |
| 729 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile()); | 730 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile()); |
| 730 int reasons = prefs->GetDisableReasons(id_); | 731 int reasons = prefs->GetDisableReasons(id_); |
| 731 EXPECT_TRUE(reasons & Extension::DISABLE_CORRUPTED); | 732 EXPECT_TRUE(reasons & Extension::DISABLE_CORRUPTED); |
| 732 } | 733 } |
| 733 | 734 |
| 735 // Disabled due to flakiness (crbug.com/668067) |
| 734 // Now actually test what happens on the next startup after the PRE test above. | 736 // Now actually test what happens on the next startup after the PRE test above. |
| 735 IN_PROC_BROWSER_TEST_F(ContentVerifierPolicyTest, PolicyCorruptedOnStartup) { | 737 IN_PROC_BROWSER_TEST_F(ContentVerifierPolicyTest, |
| 738 DISABLED_PolicyCorruptedOnStartup) { |
| 736 // Expect that the extension is still disabled for corruption. | 739 // Expect that the extension is still disabled for corruption. |
| 737 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile()); | 740 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile()); |
| 738 int reasons = prefs->GetDisableReasons(id_); | 741 int reasons = prefs->GetDisableReasons(id_); |
| 739 EXPECT_TRUE(reasons & Extension::DISABLE_CORRUPTED); | 742 EXPECT_TRUE(reasons & Extension::DISABLE_CORRUPTED); |
| 740 | 743 |
| 741 // Now expect that it gets reinstalled (because a job should have been kicked | 744 // Now expect that it gets reinstalled (because a job should have been kicked |
| 742 // off by the installed extension loading code). | 745 // off by the installed extension loading code). |
| 743 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); | 746 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); |
| 744 RegistryObserver registry_observer(registry); | 747 RegistryObserver registry_observer(registry); |
| 745 EXPECT_TRUE(registry_observer.WaitForInstall(id_)); | 748 EXPECT_TRUE(registry_observer.WaitForInstall(id_)); |
| 746 reasons = prefs->GetDisableReasons(id_); | 749 reasons = prefs->GetDisableReasons(id_); |
| 747 EXPECT_FALSE(reasons & Extension::DISABLE_CORRUPTED); | 750 EXPECT_FALSE(reasons & Extension::DISABLE_CORRUPTED); |
| 748 } | 751 } |
| 749 | 752 |
| 750 } // namespace extensions | 753 } // namespace extensions |
| OLD | NEW |