| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1778 base::Version old_version(old_version_number); | 1778 base::Version old_version(old_version_number); |
| 1779 ASSERT_TRUE(old_version.IsValid()); | 1779 ASSERT_TRUE(old_version.IsValid()); |
| 1780 | 1780 |
| 1781 EXPECT_EQ(1, new_version->CompareTo(old_version)); | 1781 EXPECT_EQ(1, new_version->CompareTo(old_version)); |
| 1782 | 1782 |
| 1783 EXPECT_EQ(0u, interceptor.GetPendingSize()); | 1783 EXPECT_EQ(0u, interceptor.GetPendingSize()); |
| 1784 | 1784 |
| 1785 // Wait until any background pages belonging to force-installed extensions | 1785 // Wait until any background pages belonging to force-installed extensions |
| 1786 // have been loaded. | 1786 // have been loaded. |
| 1787 extensions::ProcessManager* manager = | 1787 extensions::ProcessManager* manager = |
| 1788 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); | 1788 extensions::ProcessManager::Get(browser()->profile()); |
| 1789 extensions::ProcessManager::ViewSet all_views = manager->GetAllViews(); | 1789 extensions::ProcessManager::ViewSet all_views = manager->GetAllViews(); |
| 1790 for (extensions::ProcessManager::ViewSet::const_iterator iter = | 1790 for (extensions::ProcessManager::ViewSet::const_iterator iter = |
| 1791 all_views.begin(); | 1791 all_views.begin(); |
| 1792 iter != all_views.end();) { | 1792 iter != all_views.end();) { |
| 1793 if (!(*iter)->IsLoading()) { | 1793 if (!(*iter)->IsLoading()) { |
| 1794 ++iter; | 1794 ++iter; |
| 1795 } else { | 1795 } else { |
| 1796 content::WebContents* web_contents = | 1796 content::WebContents* web_contents = |
| 1797 content::WebContents::FromRenderViewHost(*iter); | 1797 content::WebContents::FromRenderViewHost(*iter); |
| 1798 ASSERT_TRUE(web_contents); | 1798 ASSERT_TRUE(web_contents); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1809 // Test policy-installed extensions are reloaded when killed. | 1809 // Test policy-installed extensions are reloaded when killed. |
| 1810 BackgroundContentsService:: | 1810 BackgroundContentsService:: |
| 1811 SetRestartDelayForForceInstalledAppsAndExtensionsForTesting(0); | 1811 SetRestartDelayForForceInstalledAppsAndExtensionsForTesting(0); |
| 1812 content::WindowedNotificationObserver extension_crashed_observer( | 1812 content::WindowedNotificationObserver extension_crashed_observer( |
| 1813 extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, | 1813 extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, |
| 1814 content::NotificationService::AllSources()); | 1814 content::NotificationService::AllSources()); |
| 1815 content::WindowedNotificationObserver extension_loaded_observer( | 1815 content::WindowedNotificationObserver extension_loaded_observer( |
| 1816 extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, | 1816 extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 1817 content::NotificationService::AllSources()); | 1817 content::NotificationService::AllSources()); |
| 1818 extensions::ExtensionHost* extension_host = | 1818 extensions::ExtensionHost* extension_host = |
| 1819 extensions::ExtensionSystem::Get(browser()->profile())-> | 1819 extensions::ProcessManager::Get(browser()->profile()) |
| 1820 process_manager()->GetBackgroundHostForExtension(kGoodCrxId); | 1820 ->GetBackgroundHostForExtension(kGoodCrxId); |
| 1821 base::KillProcess(extension_host->render_process_host()->GetHandle(), | 1821 base::KillProcess(extension_host->render_process_host()->GetHandle(), |
| 1822 content::RESULT_CODE_KILLED, false); | 1822 content::RESULT_CODE_KILLED, false); |
| 1823 extension_crashed_observer.Wait(); | 1823 extension_crashed_observer.Wait(); |
| 1824 extension_loaded_observer.Wait(); | 1824 extension_loaded_observer.Wait(); |
| 1825 } | 1825 } |
| 1826 | 1826 |
| 1827 IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionRecommendedInstallationMode) { | 1827 IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionRecommendedInstallationMode) { |
| 1828 // Verifies that extensions that are recommended-installed by policies are | 1828 // Verifies that extensions that are recommended-installed by policies are |
| 1829 // installed, can be disabled but not uninstalled. | 1829 // installed, can be disabled but not uninstalled. |
| 1830 ExtensionService* service = extension_service(); | 1830 ExtensionService* service = extension_service(); |
| (...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3426 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 3426 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
| 3427 browser2->tab_strip_model()->GetActiveWebContents(), | 3427 browser2->tab_strip_model()->GetActiveWebContents(), |
| 3428 "domAutomationController.send(window.showModalDialog !== undefined);", | 3428 "domAutomationController.send(window.showModalDialog !== undefined);", |
| 3429 &result)); | 3429 &result)); |
| 3430 EXPECT_TRUE(result); | 3430 EXPECT_TRUE(result); |
| 3431 } | 3431 } |
| 3432 | 3432 |
| 3433 #endif // !defined(CHROME_OS) | 3433 #endif // !defined(CHROME_OS) |
| 3434 | 3434 |
| 3435 } // namespace policy | 3435 } // namespace policy |
| OLD | NEW |