| Index: chrome/browser/extensions/extension_startup_browsertest.cc
|
| diff --git a/chrome/browser/extensions/extension_startup_browsertest.cc b/chrome/browser/extensions/extension_startup_browsertest.cc
|
| index 83fb022b2d7b50512d9bf97c31fb218fef82abb8..c01ed32c7845477561c640680fd3ae3b96562176 100644
|
| --- a/chrome/browser/extensions/extension_startup_browsertest.cc
|
| +++ b/chrome/browser/extensions/extension_startup_browsertest.cc
|
| @@ -18,7 +18,9 @@
|
| #include "chrome/common/chrome_notification_types.h"
|
| #include "chrome/common/chrome_paths.h"
|
| #include "chrome/common/chrome_switches.h"
|
| +#include "chrome/common/extensions/api/requirements/requirements_handler.h"
|
| #include "chrome/common/extensions/feature_switch.h"
|
| +#include "chrome/common/extensions/manifest_handler.h"
|
| #include "chrome/test/base/in_process_browser_test.h"
|
| #include "chrome/test/base/testing_profile.h"
|
| #include "chrome/test/base/ui_test_utils.h"
|
| @@ -28,12 +30,12 @@
|
| #include "content/public/test/browser_test_utils.h"
|
| #include "net/base/net_util.h"
|
|
|
| -using extensions::FeatureSwitch;
|
| -
|
| // This file contains high-level startup tests for the extensions system. We've
|
| // had many silly bugs where command line flags did not get propagated correctly
|
| // into the services, so we didn't start correctly.
|
|
|
| +namespace extensions {
|
| +
|
| class ExtensionStartupTestBase : public InProcessBrowserTest {
|
| public:
|
| ExtensionStartupTestBase() :
|
| @@ -45,6 +47,8 @@ class ExtensionStartupTestBase : public InProcessBrowserTest {
|
| protected:
|
| // InProcessBrowserTest
|
| virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
|
| + InProcessBrowserTest::SetUpCommandLine(command_line);
|
| +
|
| if (!enable_extensions_)
|
| command_line->AppendSwitch(switches::kDisableExtensions);
|
|
|
| @@ -54,6 +58,13 @@ class ExtensionStartupTestBase : public InProcessBrowserTest {
|
| paths);
|
| command_line->AppendSwitch(switches::kDisableExtensionsFileAccessCheck);
|
| }
|
| +
|
| + (new RequirementsHandler)->Register();
|
| + }
|
| +
|
| + virtual void CleanUpOnMainThread() OVERRIDE {
|
| + ManifestHandler::ClearRegistryForTesting();
|
| + InProcessBrowserTest::CleanUpOnMainThread();
|
| }
|
|
|
| virtual bool SetUpUserDataDirectory() OVERRIDE {
|
| @@ -91,14 +102,14 @@ class ExtensionStartupTestBase : public InProcessBrowserTest {
|
|
|
| void WaitForServicesToStart(int num_expected_extensions,
|
| bool expect_extensions_enabled) {
|
| - ExtensionService* service = extensions::ExtensionSystem::Get(
|
| + ExtensionService* service = ExtensionSystem::Get(
|
| browser()->profile())->extension_service();
|
|
|
| // Count the number of non-component extensions.
|
| int found_extensions = 0;
|
| for (ExtensionSet::const_iterator it = service->extensions()->begin();
|
| it != service->extensions()->end(); ++it)
|
| - if ((*it)->location() != extensions::Manifest::COMPONENT)
|
| + if ((*it)->location() != Manifest::COMPONENT)
|
| found_extensions++;
|
|
|
| ASSERT_EQ(static_cast<uint32>(num_expected_extensions),
|
| @@ -108,8 +119,7 @@ class ExtensionStartupTestBase : public InProcessBrowserTest {
|
| content::WindowedNotificationObserver user_scripts_observer(
|
| chrome::NOTIFICATION_USER_SCRIPTS_UPDATED,
|
| content::NotificationService::AllSources());
|
| - extensions::UserScriptMaster* master =
|
| - extensions::ExtensionSystem::Get(browser()->profile())->
|
| + UserScriptMaster* master = ExtensionSystem::Get(browser()->profile())->
|
| user_script_master();
|
| if (!master->ScriptsReady())
|
| user_scripts_observer.Wait();
|
| @@ -185,13 +195,13 @@ IN_PROC_BROWSER_TEST_F(ExtensionsStartupTest, MAYBE_NoFileAccess) {
|
|
|
| // Keep a separate list of extensions for which to disable file access, since
|
| // doing so reloads them.
|
| - std::vector<const extensions::Extension*> extension_list;
|
| + std::vector<const Extension*> extension_list;
|
|
|
| - ExtensionService* service = extensions::ExtensionSystem::Get(
|
| + ExtensionService* service = ExtensionSystem::Get(
|
| browser()->profile())->extension_service();
|
| for (ExtensionSet::const_iterator it = service->extensions()->begin();
|
| it != service->extensions()->end(); ++it) {
|
| - if ((*it)->location() == extensions::Manifest::COMPONENT)
|
| + if ((*it)->location() == Manifest::COMPONENT)
|
| continue;
|
| if (service->AllowFileAccess(*it))
|
| extension_list.push_back(*it);
|
| @@ -280,3 +290,5 @@ IN_PROC_BROWSER_TEST_F(ExtensionsLoadMultipleTest, Test) {
|
| WaitForServicesToStart(4, true);
|
| TestInjection(true, true);
|
| }
|
| +
|
| +} // namespace extensions
|
|
|