diff options
111 files changed, 268 insertions, 1164 deletions
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index 7b21e9c..698ea21 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -71,6 +71,7 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/extensions/chrome_manifest_handlers.h" #include "chrome/common/extensions/extension_l10n_util.h" #include "chrome/common/extensions/permissions/chrome_api_permissions.h" #include "chrome/common/extensions/permissions/permissions_info.h" @@ -198,6 +199,7 @@ BrowserProcessImpl::BrowserProcessImpl( extensions::PermissionsInfo::GetInstance()->InitializeWithDelegate( extensions::ChromeAPIPermissions()); + extensions::RegisterChromeManifestHandlers(); extension_event_router_forwarder_ = new extensions::EventRouterForwarder; ExtensionRendererState::GetInstance()->Init(); diff --git a/chrome/browser/chromeos/extensions/file_manager/file_manager_manifest_unittest.cc b/chrome/browser/chromeos/extensions/file_manager/file_manager_manifest_unittest.cc index 2a972ba..fe8d1b2 100644 --- a/chrome/browser/chromeos/extensions/file_manager/file_manager_manifest_unittest.cc +++ b/chrome/browser/chromeos/extensions/file_manager/file_manager_manifest_unittest.cc @@ -7,7 +7,6 @@ #include "chrome/common/extensions/extension_builder.h" #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" -#include "chrome/common/extensions/manifest_url_handler.h" #include "chrome/common/extensions/value_builder.h" #include "extensions/common/error_utils.h" #include "testing/gtest/include/gtest/gtest.h" @@ -22,10 +21,10 @@ using extensions::ListBuilder; namespace { class FileBrowserHandlerManifestTest : public ExtensionManifestTest { + protected: virtual void SetUp() OVERRIDE { ExtensionManifestTest::SetUp(); (new FileBrowserHandlerParser)->Register(); - (new extensions::URLOverridesHandler)->Register(); } }; diff --git a/chrome/browser/extensions/active_tab_unittest.cc b/chrome/browser/extensions/active_tab_unittest.cc index e3afb37..de7dfa7 100644 --- a/chrome/browser/extensions/active_tab_unittest.cc +++ b/chrome/browser/extensions/active_tab_unittest.cc @@ -16,8 +16,6 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_builder.h" #include "chrome/common/extensions/features/feature.h" -#include "chrome/common/extensions/permissions/chrome_api_permissions.h" -#include "chrome/common/extensions/permissions/scoped_testing_permissions_info.h" #include "chrome/common/extensions/value_builder.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "content/public/browser/browser_thread.h" @@ -57,8 +55,7 @@ scoped_refptr<const Extension> CreateTestExtension( class ActiveTabTest : public ChromeRenderViewHostTestHarness { public: ActiveTabTest() - : permissions_info_(ChromeAPIPermissions()), - extension(CreateTestExtension("deadbeef", true)), + : extension(CreateTestExtension("deadbeef", true)), another_extension(CreateTestExtension("feedbeef", true)), extension_without_active_tab(CreateTestExtension("badbeef", false)), ui_thread_(BrowserThread::UI, MessageLoop::current()) {} @@ -113,8 +110,6 @@ class ActiveTabTest : public ChromeRenderViewHostTestHarness { return extension->HasAPIPermissionForTab(tab_id, APIPermission::kTab); } - ScopedTestingPermissionsInfo permissions_info_; - // An extension with the activeTab permission. scoped_refptr<const Extension> extension; diff --git a/chrome/browser/extensions/api/commands/command_service.cc b/chrome/browser/extensions/api/commands/command_service.cc index 9546be7..17cd57e 100644 --- a/chrome/browser/extensions/api/commands/command_service.cc +++ b/chrome/browser/extensions/api/commands/command_service.cc @@ -49,8 +49,6 @@ void CommandService::RegisterUserPrefs( CommandService::CommandService(Profile* profile) : profile_(profile) { - (new CommandsHandler)->Register(); - ExtensionFunctionRegistry::GetInstance()-> RegisterFunction<GetAllCommandsFunction>(); diff --git a/chrome/browser/extensions/api/commands/command_service_new.cc b/chrome/browser/extensions/api/commands/command_service_new.cc index b94e0b1..c078157 100644 --- a/chrome/browser/extensions/api/commands/command_service_new.cc +++ b/chrome/browser/extensions/api/commands/command_service_new.cc @@ -15,7 +15,6 @@ #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_notification_types.h" -#include "chrome/common/extensions/api/commands/commands_handler.h" #include "chrome/common/pref_names.h" #include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_details.h" @@ -48,8 +47,6 @@ void CommandService::RegisterUserPrefs( CommandService::CommandService(Profile* profile) : profile_(profile) { - (new CommandsHandler)->Register(); - ExtensionFunctionRegistry::GetInstance()-> RegisterFunction<GetAllCommandsFunction>(); diff --git a/chrome/browser/extensions/api/extension_action/extension_action_api.cc b/chrome/browser/extensions/api/extension_action/extension_action_api.cc index eab2002..045b2d8 100644 --- a/chrome/browser/extensions/api/extension_action/extension_action_api.cc +++ b/chrome/browser/extensions/api/extension_action/extension_action_api.cc @@ -24,9 +24,6 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/api/extension_action/action_info.h" -#include "chrome/common/extensions/api/extension_action/browser_action_handler.h" -#include "chrome/common/extensions/api/extension_action/page_action_handler.h" -#include "chrome/common/extensions/api/extension_action/script_badge_handler.h" #include "chrome/common/render_messages.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_service.h" @@ -188,10 +185,6 @@ static base::LazyInstance<ProfileKeyedAPIFactory<ExtensionActionAPI> > g_factory = LAZY_INSTANCE_INITIALIZER; ExtensionActionAPI::ExtensionActionAPI(Profile* profile) { - (new BrowserActionHandler)->Register(); - (new PageActionHandler)->Register(); - (new ScriptBadgeHandler)->Register(); - ExtensionFunctionRegistry* registry = ExtensionFunctionRegistry::GetInstance(); diff --git a/chrome/browser/extensions/api/file_handlers/file_handlers_api.cc b/chrome/browser/extensions/api/file_handlers/file_handlers_api.cc deleted file mode 100644 index 85e7758..0000000 --- a/chrome/browser/extensions/api/file_handlers/file_handlers_api.cc +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/extensions/api/file_handlers/file_handlers_api.h" - -#include "base/lazy_instance.h" -#include "chrome/common/extensions/api/file_handlers/file_handlers_parser.h" - -namespace extensions { - -FileHandlersAPI::FileHandlersAPI(Profile* profile) { - (new FileHandlersParser)->Register(); -} - -FileHandlersAPI::~FileHandlersAPI() { -} - -static base::LazyInstance<ProfileKeyedAPIFactory<FileHandlersAPI> > -g_factory = LAZY_INSTANCE_INITIALIZER; - -ProfileKeyedAPIFactory<FileHandlersAPI>* FileHandlersAPI::GetFactoryInstance() { - return &g_factory.Get(); -} - -} // namespace extensions diff --git a/chrome/browser/extensions/api/file_handlers/file_handlers_api.h b/chrome/browser/extensions/api/file_handlers/file_handlers_api.h deleted file mode 100644 index e8d00f9c0..0000000 --- a/chrome/browser/extensions/api/file_handlers/file_handlers_api.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_FILE_HANDLERS_API_H_ -#define CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_FILE_HANDLERS_API_H_ - -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" - -class Profile; - -namespace extensions { - -class FileHandlersAPI : public ProfileKeyedAPI { - public: - explicit FileHandlersAPI(Profile* profile); - virtual ~FileHandlersAPI(); - - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<FileHandlersAPI>* GetFactoryInstance(); - - private: - friend class ProfileKeyedAPIFactory<FileHandlersAPI>; - - // ProfileKeyedAPI implementation. - static const char* service_name() { - return "FileHandlersAPI"; - } - static const bool kServiceIsNULLWhileTesting = true; -}; - -} // namespace extensions - -#endif // CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_FILE_HANDLERS_API_H_ diff --git a/chrome/browser/extensions/api/i18n/i18n_api.cc b/chrome/browser/extensions/api/i18n/i18n_api.cc index 2487dfe..dbf3b71 100644 --- a/chrome/browser/extensions/api/i18n/i18n_api.cc +++ b/chrome/browser/extensions/api/i18n/i18n_api.cc @@ -14,7 +14,6 @@ #include "base/strings/string_split.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/extensions/api/i18n.h" -#include "chrome/common/extensions/api/i18n/default_locale_handler.h" #include "chrome/common/pref_names.h" namespace GetAcceptLanguages = extensions::api::i18n::GetAcceptLanguages; @@ -60,19 +59,4 @@ bool I18nGetAcceptLanguagesFunction::RunImpl() { return true; } -I18nAPI::I18nAPI(Profile* profile) { - (new DefaultLocaleHandler)->Register(); -} - -I18nAPI::~I18nAPI() { -} - -static base::LazyInstance<ProfileKeyedAPIFactory<I18nAPI> > - g_factory = LAZY_INSTANCE_INITIALIZER; - -// static -ProfileKeyedAPIFactory<I18nAPI>* I18nAPI::GetFactoryInstance() { - return &g_factory.Get(); -} - } // namespace extensions diff --git a/chrome/browser/extensions/api/i18n/i18n_api.h b/chrome/browser/extensions/api/i18n/i18n_api.h index 9e291dc..5d8c12e 100644 --- a/chrome/browser/extensions/api/i18n/i18n_api.h +++ b/chrome/browser/extensions/api/i18n/i18n_api.h @@ -18,26 +18,6 @@ class I18nGetAcceptLanguagesFunction : public SyncExtensionFunction { DECLARE_EXTENSION_FUNCTION("i18n.getAcceptLanguages", I18N_GETACCEPTLANGUAGES) }; -class I18nAPI : public ProfileKeyedAPI { - public: - explicit I18nAPI(Profile* profile); - virtual ~I18nAPI(); - - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<I18nAPI>* GetFactoryInstance(); - - private: - friend class ProfileKeyedAPIFactory<I18nAPI>; - - // ProfileKeyedAPI implementation. - static const char* service_name() { - return "I18nAPI"; - } - static const bool kServiceIsNULLWhileTesting = true; - - DISALLOW_COPY_AND_ASSIGN(I18nAPI); -}; - } // namespace extensions #endif // CHROME_BROWSER_EXTENSIONS_API_I18N_I18N_API_H_ diff --git a/chrome/browser/extensions/api/identity/identity_api.cc b/chrome/browser/extensions/api/identity/identity_api.cc index f5e2d40..52005b0 100644 --- a/chrome/browser/extensions/api/identity/identity_api.cc +++ b/chrome/browser/extensions/api/identity/identity_api.cc @@ -26,7 +26,6 @@ #include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_manifest_constants.h" -#include "chrome/common/extensions/manifest_handler.h" #include "chrome/common/url_constants.h" #include "content/public/common/page_transition_types.h" #include "google_apis/gaia/gaia_constants.h" @@ -508,7 +507,6 @@ IdentityAPI::IdentityAPI(Profile* profile) : profile_(profile), signin_manager_(NULL), error_(GoogleServiceAuthError::NONE) { - (new OAuth2ManifestHandler)->Register(); } IdentityAPI::~IdentityAPI() { diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api.cc b/chrome/browser/extensions/api/input_ime/input_ime_api.cc index cc23a65..2440108 100644 --- a/chrome/browser/extensions/api/input_ime/input_ime_api.cc +++ b/chrome/browser/extensions/api/input_ime/input_ime_api.cc @@ -15,6 +15,7 @@ #include "chrome/browser/extensions/extension_input_module_constants.h" #include "chrome/browser/extensions/extension_system.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/extensions/api/input_ime/input_components_handler.h" namespace keys = extension_input_module_constants; @@ -901,8 +902,6 @@ bool KeyEventHandled::RunImpl() { InputImeAPI::InputImeAPI(Profile* profile) : profile_(profile) { - (new InputComponentsHandler)->Register(); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, content::Source<Profile>(profile)); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api.h b/chrome/browser/extensions/api/input_ime/input_ime_api.h index 7542fa9..8ffb3df 100644 --- a/chrome/browser/extensions/api/input_ime/input_ime_api.h +++ b/chrome/browser/extensions/api/input_ime/input_ime_api.h @@ -15,7 +15,6 @@ #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/extension_function.h" #include "chrome/browser/profiles/profile_keyed_service.h" -#include "chrome/common/extensions/api/input_ime/input_components_handler.h" #include "chrome/common/extensions/extension.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" @@ -28,6 +27,7 @@ class ImeObserver; } namespace extensions { +struct InputComponentInfo; class InputImeEventRouter { public: diff --git a/chrome/browser/extensions/api/managed_mode_private/managed_mode_private_api.cc b/chrome/browser/extensions/api/managed_mode_private/managed_mode_private_api.cc index 65816b3..4534f80 100644 --- a/chrome/browser/extensions/api/managed_mode_private/managed_mode_private_api.cc +++ b/chrome/browser/extensions/api/managed_mode_private/managed_mode_private_api.cc @@ -20,7 +20,6 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/api/managed_mode_private.h" -#include "chrome/common/extensions/api/managed_mode_private/managed_mode_handler.h" #include "chrome/common/pref_names.h" #include "content/public/browser/notification_details.h" @@ -137,7 +136,6 @@ ManagedModeAPI::ManagedModeAPI(Profile* profile) : profile_(profile) { ExtensionSystem::Get(profile_)->event_router()->RegisterObserver( this, kChangeEventName); - (new ManagedModeHandler)->Register(); } ManagedModeAPI::~ManagedModeAPI() { diff --git a/chrome/browser/extensions/api/omnibox/omnibox_api.cc b/chrome/browser/extensions/api/omnibox/omnibox_api.cc index f312f30..cff0c84 100644 --- a/chrome/browser/extensions/api/omnibox/omnibox_api.cc +++ b/chrome/browser/extensions/api/omnibox/omnibox_api.cc @@ -184,7 +184,6 @@ void ExtensionOmniboxEventRouter::OnInputCancelled( OmniboxAPI::OmniboxAPI(Profile* profile) : profile_(profile), url_service_(TemplateURLServiceFactory::GetForProfile(profile)) { - (new OmniboxHandler)->Register(); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, content::Source<Profile>(profile)); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, diff --git a/chrome/browser/extensions/api/page_launcher/page_launcher_api.cc b/chrome/browser/extensions/api/page_launcher/page_launcher_api.cc index 4fc8d82..c52a012 100644 --- a/chrome/browser/extensions/api/page_launcher/page_launcher_api.cc +++ b/chrome/browser/extensions/api/page_launcher/page_launcher_api.cc @@ -9,21 +9,10 @@ #include "chrome/browser/extensions/event_router.h" #include "chrome/browser/extensions/extension_system.h" #include "chrome/common/extensions/api/page_launcher.h" -#include "chrome/common/extensions/api/page_launcher/page_launcher_handler.h" #include "googleurl/src/gurl.h" namespace extensions { -static base::LazyInstance<ProfileKeyedAPIFactory<PageLauncherAPI> > - g_factory = LAZY_INSTANCE_INITIALIZER; - -PageLauncherAPI::PageLauncherAPI(Profile* profile) { - (new PageLauncherHandler)->Register(); -} - -PageLauncherAPI::~PageLauncherAPI() { -} - // static void PageLauncherAPI::DispatchOnClickedEvent( Profile* profile, @@ -47,10 +36,4 @@ void PageLauncherAPI::DispatchOnClickedEvent( event_router->DispatchEventToExtension(extension_id, event.Pass()); } - -// static -ProfileKeyedAPIFactory<PageLauncherAPI>* PageLauncherAPI::GetFactoryInstance() { - return &g_factory.Get(); -} - } // namespace extensions diff --git a/chrome/browser/extensions/api/page_launcher/page_launcher_api.h b/chrome/browser/extensions/api/page_launcher/page_launcher_api.h index 4cd4483..a5c7757 100644 --- a/chrome/browser/extensions/api/page_launcher/page_launcher_api.h +++ b/chrome/browser/extensions/api/page_launcher/page_launcher_api.h @@ -7,39 +7,19 @@ #include <string> -#include "base/basictypes.h" -#include "base/memory/scoped_ptr.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" - class GURL; class Profile; namespace extensions { -class PageLauncherAPI : public ProfileKeyedAPI { +class PageLauncherAPI { public: - explicit PageLauncherAPI(Profile* profile); - virtual ~PageLauncherAPI(); - static void DispatchOnClickedEvent(Profile* profile, const std::string& extension_id, const GURL& url, const std::string& mimetype, const std::string* page_title, const std::string* selected_text); - - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<PageLauncherAPI>* GetFactoryInstance(); - - private: - friend class ProfileKeyedAPIFactory<PageLauncherAPI>; - - // ProfileKeyedAPI implementation. - static const char* service_name() { - return "PageLauncherAPI"; - } - - DISALLOW_COPY_AND_ASSIGN(PageLauncherAPI); }; } // namespace extensions diff --git a/chrome/browser/extensions/api/permissions/permissions_api_helpers_unittest.cc b/chrome/browser/extensions/api/permissions/permissions_api_helpers_unittest.cc index 2cfc545..28c94ac 100644 --- a/chrome/browser/extensions/api/permissions/permissions_api_helpers_unittest.cc +++ b/chrome/browser/extensions/api/permissions/permissions_api_helpers_unittest.cc @@ -6,7 +6,6 @@ #include "base/values.h" #include "chrome/browser/extensions/api/permissions/permissions_api_helpers.h" #include "chrome/common/extensions/api/permissions.h" -#include "chrome/common/extensions/extension_unittest.h" #include "chrome/common/extensions/permissions/permission_set.h" #include "extensions/common/url_pattern_set.h" #include "googleurl/src/gurl.h" @@ -27,11 +26,8 @@ static void AddPattern(URLPatternSet* extent, const std::string& pattern) { } // namespace -class ExtensionPermissionsAPIHelpers : public ExtensionTest { -}; - // Tests that we can convert PermissionSets to and from values. -TEST_F(ExtensionPermissionsAPIHelpers, Pack) { +TEST(ExtensionPermissionsAPIHelpers, Pack) { APIPermissionSet apis; apis.insert(APIPermission::kTab); apis.insert(APIPermission::kWebRequest); @@ -80,7 +76,7 @@ TEST_F(ExtensionPermissionsAPIHelpers, Pack) { // Tests various error conditions and edge cases when unpacking values // into PermissionSets. -TEST_F(ExtensionPermissionsAPIHelpers, Unpack) { +TEST(ExtensionPermissionsAPIHelpers, Unpack) { scoped_ptr<ListValue> apis(new ListValue()); apis->Append(Value::CreateStringValue("tabs")); scoped_ptr<ListValue> origins(new ListValue()); diff --git a/chrome/browser/extensions/api/plugins/plugins_api.cc b/chrome/browser/extensions/api/plugins/plugins_api.cc deleted file mode 100644 index e87232a..0000000 --- a/chrome/browser/extensions/api/plugins/plugins_api.cc +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/extensions/api/plugins/plugins_api.h" - -#include "base/lazy_instance.h" -#include "chrome/common/extensions/api/plugins/plugins_handler.h" - -namespace extensions { - -static base::LazyInstance<ProfileKeyedAPIFactory<PluginsAPI> > - g_factory = LAZY_INSTANCE_INITIALIZER; - -// static -ProfileKeyedAPIFactory<PluginsAPI>* PluginsAPI::GetFactoryInstance() { - return &g_factory.Get(); -} - -PluginsAPI::PluginsAPI(Profile* profile) { - (new PluginsHandler)->Register(); -} - -PluginsAPI::~PluginsAPI() { -} - -} // namespace extensions diff --git a/chrome/browser/extensions/api/plugins/plugins_api.h b/chrome/browser/extensions/api/plugins/plugins_api.h deleted file mode 100644 index 8ebc6e0..0000000 --- a/chrome/browser/extensions/api/plugins/plugins_api.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_EXTENSIONS_API_PLUGINS_PLUGINS_API_H_ -#define CHROME_BROWSER_EXTENSIONS_API_PLUGINS_PLUGINS_API_H_ - -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" -#include "chrome/browser/profiles/profile_keyed_service.h" - -class Profile; - -namespace extensions { - -// The profile-keyed service that manages the plugins for extensions. -class PluginsAPI : public ProfileKeyedAPI { - public: - explicit PluginsAPI(Profile* profile); - virtual ~PluginsAPI(); - - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<PluginsAPI>* GetFactoryInstance(); - - private: - friend class ProfileKeyedAPIFactory<PluginsAPI>; - - // ProfileKeyedAPI implementation. - static const char* service_name() { return "PluginsAPI"; } - - DISALLOW_COPY_AND_ASSIGN(PluginsAPI); -}; - -} // namespace extensions - -#endif // CHROME_BROWSER_EXTENSIONS_API_PLUGINS_PLUGINS_API_H_ - diff --git a/chrome/browser/extensions/api/spellcheck/spellcheck_api.cc b/chrome/browser/extensions/api/spellcheck/spellcheck_api.cc index 80bc23f..9e79826 100644 --- a/chrome/browser/extensions/api/spellcheck/spellcheck_api.cc +++ b/chrome/browser/extensions/api/spellcheck/spellcheck_api.cc @@ -38,7 +38,6 @@ SpellcheckService::DictionaryFormat GetDictionaryFormat(std::string format) { SpellcheckAPI::SpellcheckAPI(Profile* profile) { - (new SpellcheckHandler)->Register(); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, content::Source<Profile>(profile)); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, diff --git a/chrome/browser/extensions/api/storage/settings_frontend_unittest.cc b/chrome/browser/extensions/api/storage/settings_frontend_unittest.cc index 64ba305..d53b2ea 100644 --- a/chrome/browser/extensions/api/storage/settings_frontend_unittest.cc +++ b/chrome/browser/extensions/api/storage/settings_frontend_unittest.cc @@ -14,7 +14,6 @@ #include "chrome/browser/extensions/api/storage/settings_test_util.h" #include "chrome/browser/value_store/value_store.h" #include "chrome/common/chrome_notification_types.h" -#include "chrome/common/extensions/extension_unittest.h" #include "content/public/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" @@ -50,7 +49,7 @@ scoped_ptr<Value> CreateMegabyte() { } -class ExtensionSettingsFrontendTest : public ExtensionTest { +class ExtensionSettingsFrontendTest : public testing::Test { public: ExtensionSettingsFrontendTest() : storage_factory_(new util::ScopedSettingsStorageFactory()), @@ -58,7 +57,6 @@ class ExtensionSettingsFrontendTest : public ExtensionTest { file_thread_(BrowserThread::FILE, MessageLoop::current()) {} virtual void SetUp() OVERRIDE { - ExtensionTest::SetUp(); ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); profile_.reset(new util::MockProfile(temp_dir_.path())); ResetFrontend(); @@ -69,7 +67,6 @@ class ExtensionSettingsFrontendTest : public ExtensionTest { profile_.reset(); // Execute any pending deletion tasks. message_loop_.RunUntilIdle(); - ExtensionTest::TearDown(); } protected: diff --git a/chrome/browser/extensions/api/streams_private/streams_private_api.cc b/chrome/browser/extensions/api/streams_private/streams_private_api.cc index 7e296b9..41393f0 100644 --- a/chrome/browser/extensions/api/streams_private/streams_private_api.cc +++ b/chrome/browser/extensions/api/streams_private/streams_private_api.cc @@ -15,7 +15,6 @@ #include "chrome/browser/extensions/extension_system.h" #include "chrome/browser/extensions/extension_tab_util.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/common/extensions/mime_types_handler.h" #include "content/public/browser/stream_handle.h" namespace keys = extension_input_module_constants; @@ -37,8 +36,6 @@ StreamsPrivateAPI* StreamsPrivateAPI::Get(Profile* profile) { StreamsPrivateAPI::StreamsPrivateAPI(Profile* profile) : profile_(profile), weak_ptr_factory_(this) { - (new MimeTypesHandlerParser)->Register(); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, content::Source<Profile>(profile)); } diff --git a/chrome/browser/extensions/api/streams_private/streams_private_manifest_unittest.cc b/chrome/browser/extensions/api/streams_private/streams_private_manifest_unittest.cc index ba27e0b..6f8aae5 100644 --- a/chrome/browser/extensions/api/streams_private/streams_private_manifest_unittest.cc +++ b/chrome/browser/extensions/api/streams_private/streams_private_manifest_unittest.cc @@ -5,7 +5,6 @@ #include "base/strings/string_number_conversions.h" #include "chrome/common/extensions/extension_builder.h" #include "chrome/common/extensions/extension_manifest_constants.h" -#include "chrome/common/extensions/manifest_handler.h" #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "chrome/common/extensions/manifest_url_handler.h" #include "chrome/common/extensions/mime_types_handler.h" @@ -23,10 +22,6 @@ using extensions::ListBuilder; namespace { class StreamsPrivateManifestTest : public ExtensionManifestTest { - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new MimeTypesHandlerParser)->Register(); - } }; TEST_F(StreamsPrivateManifestTest, ValidMimeTypesHandlerMIMETypes) { diff --git a/chrome/browser/extensions/api/system_indicator/system_indicator_api.cc b/chrome/browser/extensions/api/system_indicator/system_indicator_api.cc deleted file mode 100644 index 212a296..0000000 --- a/chrome/browser/extensions/api/system_indicator/system_indicator_api.cc +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/extensions/api/system_indicator/system_indicator_api.h" - -#include "base/lazy_instance.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/common/extensions/api/system_indicator/system_indicator_handler.h" - -namespace extensions { - -SystemIndicatorAPI::SystemIndicatorAPI(Profile* profile) { - (new SystemIndicatorHandler)->Register(); -} - -SystemIndicatorAPI::~SystemIndicatorAPI() { -} - -static base::LazyInstance<ProfileKeyedAPIFactory<SystemIndicatorAPI> > - g_factory = LAZY_INSTANCE_INITIALIZER; - -// static -ProfileKeyedAPIFactory<SystemIndicatorAPI>* -SystemIndicatorAPI::GetFactoryInstance() { - return &g_factory.Get(); -} - -} // namespace extensions diff --git a/chrome/browser/extensions/api/system_indicator/system_indicator_api.h b/chrome/browser/extensions/api/system_indicator/system_indicator_api.h index a890793..dbe1dbb 100644 --- a/chrome/browser/extensions/api/system_indicator/system_indicator_api.h +++ b/chrome/browser/extensions/api/system_indicator/system_indicator_api.h @@ -6,33 +6,12 @@ #define CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INDICATOR_SYSTEM_INDICATOR_API_H_ #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" #include "chrome/browser/extensions/extension_function.h" class Profile; namespace extensions { -class SystemIndicatorAPI : public ProfileKeyedAPI { - public: - explicit SystemIndicatorAPI(Profile* profile); - virtual ~SystemIndicatorAPI(); - - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<SystemIndicatorAPI>* GetFactoryInstance(); - - private: - friend class ProfileKeyedAPIFactory<SystemIndicatorAPI>; - - // ProfileKeyedAPI implementation. - static const char* service_name() { - return "SystemIndicatorAPI"; - } - static const bool kServiceIsNULLWhileTesting = true; - - DISALLOW_COPY_AND_ASSIGN(SystemIndicatorAPI); -}; - class SystemIndicatorSetIconFunction : public ExtensionActionSetIconFunction { public: DECLARE_EXTENSION_FUNCTION("systemIndicator.setIcon", SYSTEMINDICATOR_SETICON) diff --git a/chrome/browser/extensions/component_loader_unittest.cc b/chrome/browser/extensions/component_loader_unittest.cc index e1a9f6d..ef61a0b 100644 --- a/chrome/browser/extensions/component_loader_unittest.cc +++ b/chrome/browser/extensions/component_loader_unittest.cc @@ -14,7 +14,6 @@ #include "chrome/common/extensions/background_info.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_set.h" -#include "chrome/common/extensions/extension_unittest.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_pref_service_syncable.h" #include "components/user_prefs/pref_registry_syncable.h" @@ -73,7 +72,7 @@ class MockExtensionService : public TestExtensionService { } // namespace -class ComponentLoaderTest : public ExtensionTest { +class ComponentLoaderTest : public testing::Test { public: ComponentLoaderTest() // Note: we pass the same pref service here, to stand in for both @@ -82,7 +81,6 @@ class ComponentLoaderTest : public ExtensionTest { } virtual void SetUp() OVERRIDE { - ExtensionTest::SetUp(); extension_path_ = GetBasePath().AppendASCII("good") .AppendASCII("Extensions") diff --git a/chrome/browser/extensions/content_scripts_parser.cc b/chrome/browser/extensions/content_scripts_parser.cc deleted file mode 100644 index 4229195..0000000 --- a/chrome/browser/extensions/content_scripts_parser.cc +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/extensions/content_scripts_parser.h" - -#include "base/lazy_instance.h" -#include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" - -namespace extensions { - -static base::LazyInstance<ProfileKeyedAPIFactory<ContentScriptsParser> > - g_factory = LAZY_INSTANCE_INITIALIZER; - -// static -ProfileKeyedAPIFactory<ContentScriptsParser>* -ContentScriptsParser::GetFactoryInstance() { - return &g_factory.Get(); -} - -ContentScriptsParser::ContentScriptsParser(Profile* profile) { - (new ContentScriptsHandler)->Register(); -} - -ContentScriptsParser::~ContentScriptsParser() { -} - -} // namespace extensions diff --git a/chrome/browser/extensions/content_scripts_parser.h b/chrome/browser/extensions/content_scripts_parser.h deleted file mode 100644 index e6f20d4..0000000 --- a/chrome/browser/extensions/content_scripts_parser.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_EXTENSIONS_CONTENT_SCRIPTS_PARSER_H_ -#define CHROME_BROWSER_EXTENSIONS_CONTENT_SCRIPTS_PARSER_H_ - -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" -#include "chrome/browser/profiles/profile_keyed_service.h" - -class Profile; - -namespace extensions { - -// The profile-keyed service that manages the content scripts API. -class ContentScriptsParser : public ProfileKeyedAPI { - public: - explicit ContentScriptsParser(Profile* profile); - virtual ~ContentScriptsParser(); - - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<ContentScriptsParser>* GetFactoryInstance(); - - private: - friend class ProfileKeyedAPIFactory<ContentScriptsParser>; - - // ProfileKeyedAPI implementation. - static const char* service_name() { - return "ContentScriptsParser"; - } - - DISALLOW_COPY_AND_ASSIGN(ContentScriptsParser); -}; - -} // namespace extensions - -#endif // CHROME_BROWSER_EXTENSIONS_CONTENT_SCRIPTS_PARSER_H_ diff --git a/chrome/browser/extensions/convert_user_script_unittest.cc b/chrome/browser/extensions/convert_user_script_unittest.cc index bce2d17..303040c 100644 --- a/chrome/browser/extensions/convert_user_script_unittest.cc +++ b/chrome/browser/extensions/convert_user_script_unittest.cc @@ -14,7 +14,6 @@ #include "chrome/browser/extensions/convert_user_script.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension.h" -#include "chrome/common/extensions/manifest_handler.h" #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" #include "extensions/common/constants.h" #include "testing/gtest/include/gtest/gtest.h" @@ -31,16 +30,6 @@ static void AddPattern(URLPatternSet* extent, const std::string& pattern) { } class ExtensionFromUserScript : public testing::Test { - public: - virtual void SetUp() OVERRIDE { - testing::Test::SetUp(); - (new ContentScriptsHandler)->Register(); - } - - virtual void TearDown() OVERRIDE { - testing::Test::TearDown(); - ManifestHandler::ClearRegistryForTesting(); - } }; TEST_F(ExtensionFromUserScript, Basic) { diff --git a/chrome/browser/extensions/convert_web_app_unittest.cc b/chrome/browser/extensions/convert_web_app_unittest.cc index 900c9ed..07aa715 100644 --- a/chrome/browser/extensions/convert_web_app_unittest.cc +++ b/chrome/browser/extensions/convert_web_app_unittest.cc @@ -18,7 +18,6 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_icon_set.h" -#include "chrome/common/extensions/extension_unittest.h" #include "chrome/common/extensions/manifest_handlers/icons_handler.h" #include "chrome/common/extensions/permissions/permission_set.h" #include "chrome/common/web_apps.h" @@ -81,15 +80,7 @@ base::Time GetTestTime(int year, int month, int day, int hour, int minute, } // namespace -class ExtensionFromWebApp : public ExtensionTest { - protected: - virtual void SetUp() OVERRIDE { - ExtensionTest::SetUp(); - (new IconsHandler)->Register(); - } -}; - -TEST_F(ExtensionFromWebApp, GenerateVersion) { +TEST(ExtensionFromWebApp, GenerateVersion) { EXPECT_EQ("2010.1.1.0", ConvertTimeToExtensionVersion( GetTestTime(2010, 1, 1, 0, 0, 0, 0))); @@ -101,7 +92,7 @@ TEST_F(ExtensionFromWebApp, GenerateVersion) { GetTestTime(2010, 10, 1, 23, 59, 59, 999))); } -TEST_F(ExtensionFromWebApp, Basic) { +TEST(ExtensionFromWebApp, Basic) { base::ScopedTempDir extensions_dir; ASSERT_TRUE(extensions_dir.CreateUniqueTempDir()); @@ -159,7 +150,7 @@ TEST_F(ExtensionFromWebApp, Basic) { } } -TEST_F(ExtensionFromWebApp, Minimal) { +TEST(ExtensionFromWebApp, Minimal) { base::ScopedTempDir extensions_dir; ASSERT_TRUE(extensions_dir.CreateUniqueTempDir()); diff --git a/chrome/browser/extensions/csp_parser.cc b/chrome/browser/extensions/csp_parser.cc deleted file mode 100644 index b95d3d5..0000000 --- a/chrome/browser/extensions/csp_parser.cc +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/extensions/csp_parser.h" - -#include "base/lazy_instance.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/common/extensions/csp_handler.h" -#include "chrome/common/extensions/manifest_handlers/sandboxed_page_info.h" - -namespace extensions { - -CSPParser::CSPParser(Profile* profile) { - (new CSPHandler(false))->Register(); // not platform app. - (new CSPHandler(true))->Register(); // platform app. - (new SandboxedPageHandler)->Register(); -} - -CSPParser::~CSPParser() { -} - -static base::LazyInstance<ProfileKeyedAPIFactory<CSPParser> > - g_factory = LAZY_INSTANCE_INITIALIZER; - -// static -ProfileKeyedAPIFactory<CSPParser>* CSPParser::GetFactoryInstance() { - return &g_factory.Get(); -} - -} // namespace extensions diff --git a/chrome/browser/extensions/csp_parser.h b/chrome/browser/extensions/csp_parser.h deleted file mode 100644 index 370ec70..0000000 --- a/chrome/browser/extensions/csp_parser.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_EXTENSIONS_CSP_PARSER_H_ -#define CHROME_BROWSER_EXTENSIONS_CSP_PARSER_H_ - -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" - -class Profile; - -namespace extensions { - -class CSPParser : public ProfileKeyedAPI { - public: - explicit CSPParser(Profile* profile); - virtual ~CSPParser(); - - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<CSPParser>* GetFactoryInstance(); - - private: - friend class ProfileKeyedAPIFactory<CSPParser>; - - // ProfileKeyedAPI implementation. - static const char* service_name() { - return "CSPParser"; - } - static const bool kServiceIsNULLWhileTesting = true; - - DISALLOW_COPY_AND_ASSIGN(CSPParser); -}; - -} // namespace extensions - -#endif // CHROME_BROWSER_EXTENSIONS_CSP_PARSER_H_ diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc index a6da517..49a9dc9 100644 --- a/chrome/browser/extensions/extension_browsertest.cc +++ b/chrome/browser/extensions/extension_browsertest.cc @@ -35,7 +35,6 @@ #include "chrome/common/chrome_version_info.h" #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/extension_set.h" -#include "chrome/common/extensions/manifest_handler.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" diff --git a/chrome/browser/extensions/extension_icon_manager_unittest.cc b/chrome/browser/extensions/extension_icon_manager_unittest.cc index fdf1850..98b5b13 100644 --- a/chrome/browser/extensions/extension_icon_manager_unittest.cc +++ b/chrome/browser/extensions/extension_icon_manager_unittest.cc @@ -9,7 +9,6 @@ #include "chrome/browser/extensions/extension_icon_manager.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension.h" -#include "chrome/common/extensions/extension_unittest.h" #include "chrome/test/base/testing_profile.h" #include "content/public/test/test_browser_thread.h" #include "extensions/common/id_util.h" @@ -22,7 +21,7 @@ using extensions::Manifest; // Our test class that takes care of managing the necessary threads for loading // extension icons, and waiting for those loads to happen. -class ExtensionIconManagerTest : public extensions::ExtensionTest { +class ExtensionIconManagerTest : public testing::Test { public: ExtensionIconManagerTest() : unwaited_image_loads_(0), @@ -52,7 +51,6 @@ class ExtensionIconManagerTest : public extensions::ExtensionTest { private: virtual void SetUp() { - extensions::ExtensionTest::SetUp(); file_thread_.Start(); io_thread_.Start(); } diff --git a/chrome/browser/extensions/extension_info_map_unittest.cc b/chrome/browser/extensions/extension_info_map_unittest.cc index 9580bff..561803a 100644 --- a/chrome/browser/extensions/extension_info_map_unittest.cc +++ b/chrome/browser/extensions/extension_info_map_unittest.cc @@ -9,7 +9,6 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_manifest_constants.h" -#include "chrome/common/extensions/extension_unittest.h" #include "content/public/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" @@ -26,7 +25,7 @@ namespace keys = extension_manifest_keys; namespace { -class ExtensionInfoMapTest : public extensions::ExtensionTest { +class ExtensionInfoMapTest : public testing::Test { public: ExtensionInfoMapTest() : ui_thread_(BrowserThread::UI, &message_loop_), diff --git a/chrome/browser/extensions/extension_prefs_unittest.cc b/chrome/browser/extensions/extension_prefs_unittest.cc index d6c9add..3214ca3 100644 --- a/chrome/browser/extensions/extension_prefs_unittest.cc +++ b/chrome/browser/extensions/extension_prefs_unittest.cc @@ -20,6 +20,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/permissions/permission_set.h" +#include "chrome/common/extensions/permissions/permissions_info.h" #include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" @@ -64,7 +65,6 @@ void ExtensionPrefsTest::RegisterPreferences( user_prefs::PrefRegistrySyncable* registry) {} void ExtensionPrefsTest::SetUp() { - ExtensionTest::SetUp(); RegisterPreferences(prefs_.pref_registry()); Initialize(); } @@ -79,7 +79,6 @@ void ExtensionPrefsTest::TearDown() { Verify(); prefs_.pref_service()->CommitPendingWrite(); message_loop_.RunUntilIdle(); - ExtensionTest::TearDown(); } // Tests the LastPingDay/SetLastPingDay functions. diff --git a/chrome/browser/extensions/extension_prefs_unittest.h b/chrome/browser/extensions/extension_prefs_unittest.h index 2bc227b..c28673d1 100644 --- a/chrome/browser/extensions/extension_prefs_unittest.h +++ b/chrome/browser/extensions/extension_prefs_unittest.h @@ -7,7 +7,6 @@ #include "base/message_loop.h" #include "chrome/browser/extensions/test_extension_prefs.h" -#include "chrome/common/extensions/extension_unittest.h" #include "content/public/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" @@ -23,7 +22,7 @@ namespace extensions { class Extension; // Base class for extension preference-related unit tests. -class ExtensionPrefsTest : public ExtensionTest { +class ExtensionPrefsTest : public testing::Test { public: ExtensionPrefsTest(); virtual ~ExtensionPrefsTest(); diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc index c1a2573..8ec9d89 100644 --- a/chrome/browser/extensions/extension_process_manager.cc +++ b/chrome/browser/extensions/extension_process_manager.cc @@ -27,7 +27,6 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_messages.h" #include "chrome/common/extensions/incognito_handler.h" -#include "chrome/common/extensions/manifest_handler.h" #include "chrome/common/extensions/manifest_url_handler.h" #include "chrome/common/url_constants.h" #include "content/public/browser/browser_thread.h" @@ -178,9 +177,6 @@ ExtensionProcessManager::ExtensionProcessManager(Profile* profile) suspending_time_sec); } - (new BackgroundManifestHandler())->Register(); - (new extensions::IncognitoHandler())->Register(); - content::DevToolsManager::GetInstance()->AddAgentStateCallback( devtools_callback_); } diff --git a/chrome/browser/extensions/extension_protocols_unittest.cc b/chrome/browser/extensions/extension_protocols_unittest.cc index b04ff38..6b34e771 100644 --- a/chrome/browser/extensions/extension_protocols_unittest.cc +++ b/chrome/browser/extensions/extension_protocols_unittest.cc @@ -12,9 +12,6 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_manifest_constants.h" -#include "chrome/common/extensions/incognito_handler.h" -#include "chrome/common/extensions/manifest_handler.h" -#include "chrome/common/extensions/manifest_handlers/icons_handler.h" #include "chrome/common/url_constants.h" #include "content/public/browser/resource_request_info.h" #include "content/public/test/mock_resource_context.h" @@ -79,15 +76,12 @@ class ExtensionProtocolTest : public testing::Test { net::URLRequestContext* request_context = resource_context_.GetRequestContext(); old_factory_ = request_context->job_factory(); - (new IncognitoHandler)->Register(); - (new IconsHandler)->Register(); } virtual void TearDown() { net::URLRequestContext* request_context = resource_context_.GetRequestContext(); request_context->set_job_factory(old_factory_); - ManifestHandler::ClearRegistryForTesting(); } void SetProtocolHandler(bool incognito) { diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 3b3a2d6..7a79998 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -62,14 +62,12 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/extensions/api/i18n/default_locale_handler.h" #include "chrome/common/extensions/api/plugins/plugins_handler.h" #include "chrome/common/extensions/background_info.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_l10n_util.h" #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" -#include "chrome/common/extensions/manifest_handlers/requirements_handler.h" #include "chrome/common/extensions/manifest_url_handler.h" #include "chrome/common/extensions/permissions/permission_set.h" #include "chrome/common/pref_names.h" @@ -570,13 +568,7 @@ void ExtensionServiceTestBase::SetUpTestCase() { } void ExtensionServiceTestBase::SetUp() { - ExtensionTest::SetUp(); ExtensionErrorReporter::GetInstance()->ClearErrors(); - (new extensions::BackgroundManifestHandler)->Register(); - (new extensions::ContentScriptsHandler)->Register(); - (new extensions::DefaultLocaleHandler)->Register(); - (new extensions::PluginsHandler)->Register(); - (new extensions::RequirementsHandler)->Register(); } class ExtensionServiceTest diff --git a/chrome/browser/extensions/extension_service_unittest.h b/chrome/browser/extensions/extension_service_unittest.h index e047902..80d50c8 100644 --- a/chrome/browser/extensions/extension_service_unittest.h +++ b/chrome/browser/extensions/extension_service_unittest.h @@ -12,7 +12,6 @@ #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "chrome/browser/extensions/extension_service.h" -#include "chrome/common/extensions/extension_unittest.h" #include "chrome/common/extensions/feature_switch.h" #include "content/public/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" @@ -29,7 +28,7 @@ namespace extensions { class ManagementPolicy; } -class ExtensionServiceTestBase : public extensions::ExtensionTest { +class ExtensionServiceTestBase : public testing::Test { public: struct ExtensionServiceInitParams { base::FilePath profile_path; diff --git a/chrome/browser/extensions/extension_special_storage_policy_unittest.cc b/chrome/browser/extensions/extension_special_storage_policy_unittest.cc index 2b592a3..33e1394 100644 --- a/chrome/browser/extensions/extension_special_storage_policy_unittest.cc +++ b/chrome/browser/extensions/extension_special_storage_policy_unittest.cc @@ -10,9 +10,7 @@ #include "chrome/common/content_settings_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_manifest_constants.h" -#include "chrome/common/extensions/extension_unittest.h" #include "chrome/common/extensions/manifest.h" -#include "chrome/common/extensions/manifest_handler.h" #include "chrome/test/base/testing_profile.h" #include "content/public/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" @@ -26,7 +24,7 @@ typedef SpecialStoragePolicy::StoragePolicy StoragePolicy; namespace keys = extension_manifest_keys; -class ExtensionSpecialStoragePolicyTest : public extensions::ExtensionTest { +class ExtensionSpecialStoragePolicyTest : public testing::Test { protected: class PolicyChangeObserver : public SpecialStoragePolicy::Observer { public: @@ -93,7 +91,6 @@ class ExtensionSpecialStoragePolicyTest : public extensions::ExtensionTest { }; virtual void SetUp() OVERRIDE { - extensions::ExtensionTest::SetUp(); policy_ = new ExtensionSpecialStoragePolicy(NULL); } diff --git a/chrome/browser/extensions/extension_ui_unittest.cc b/chrome/browser/extensions/extension_ui_unittest.cc index a896508..10b3ecc 100644 --- a/chrome/browser/extensions/extension_ui_unittest.cc +++ b/chrome/browser/extensions/extension_ui_unittest.cc @@ -13,8 +13,6 @@ #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension.h" -#include "chrome/common/extensions/extension_unittest.h" -#include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" #include "chrome/test/base/testing_profile.h" #include "content/public/test/test_browser_thread.h" #include "extensions/common/constants.h" @@ -29,7 +27,7 @@ using extensions::Extension; using extensions::Manifest; -class ExtensionUITest : public extensions::ExtensionTest { +class ExtensionUITest : public testing::Test { public: ExtensionUITest() : ui_thread_(content::BrowserThread::UI, &message_loop_), @@ -37,8 +35,6 @@ class ExtensionUITest : public extensions::ExtensionTest { protected: virtual void SetUp() OVERRIDE { - ExtensionTest::SetUp(); - // Create an ExtensionService and ManagementPolicy to inject into the // ExtensionSettingsHandler. profile_.reset(new TestingProfile()); @@ -51,8 +47,6 @@ class ExtensionUITest : public extensions::ExtensionTest { handler_.reset(new ExtensionSettingsHandler(extension_service_, management_policy_)); - - (new extensions::ContentScriptsHandler)->Register(); } virtual void TearDown() OVERRIDE { @@ -60,7 +54,6 @@ class ExtensionUITest : public extensions::ExtensionTest { profile_.reset(); // Execute any pending deletion tasks. message_loop_.RunUntilIdle(); - ExtensionTest::TearDown(); } static DictionaryValue* DeserializeJSONTestData(const base::FilePath& path, diff --git a/chrome/browser/extensions/chrome_manifest_parser.cc b/chrome/browser/extensions/extension_web_ui_override_registrar.cc index 9f89bbf..fcf5276 100644 --- a/chrome/browser/extensions/chrome_manifest_parser.cc +++ b/chrome/browser/extensions/extension_web_ui_override_registrar.cc @@ -2,48 +2,29 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/chrome_manifest_parser.h" +#include "chrome/browser/extensions/extension_web_ui_override_registrar.h" #include "base/lazy_instance.h" #include "chrome/browser/extensions/extension_web_ui.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_notification_types.h" -#include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" -#include "chrome/common/extensions/manifest_handlers/icons_handler.h" -#include "chrome/common/extensions/manifest_handlers/kiosk_enabled_info.h" -#include "chrome/common/extensions/manifest_handlers/offline_enabled_info.h" -#include "chrome/common/extensions/manifest_handlers/requirements_handler.h" -#include "chrome/common/extensions/manifest_handlers/shared_module_info.h" -#include "chrome/common/extensions/manifest_url_handler.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" namespace extensions { -ChromeManifestParser::ChromeManifestParser(Profile* profile) - : profile_(profile) { - (new AppIsolationHandler)->Register(); - (new DevToolsPageHandler)->Register(); - (new KioskEnabledHandler)->Register(); - (new HomepageURLHandler)->Register(); - (new IconsHandler)->Register(); - (new OfflineEnabledHandler)->Register(); - (new OptionsPageHandler)->Register(); - (new RequirementsHandler)->Register(); - (new SharedModuleHandler)->Register(); - (new UpdateURLHandler)->Register(); - (new URLOverridesHandler)->Register(); - +ExtensionWebUIOverrideRegistrar::ExtensionWebUIOverrideRegistrar( + Profile* profile) : profile_(profile) { registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, content::Source<Profile>(profile)); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, content::Source<Profile>(profile)); } -ChromeManifestParser::~ChromeManifestParser() { +ExtensionWebUIOverrideRegistrar::~ExtensionWebUIOverrideRegistrar() { } -void ChromeManifestParser::Observe( +void ExtensionWebUIOverrideRegistrar::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { @@ -61,12 +42,13 @@ void ChromeManifestParser::Observe( } } -static base::LazyInstance<ProfileKeyedAPIFactory<ChromeManifestParser> > +static base::LazyInstance< + ProfileKeyedAPIFactory<ExtensionWebUIOverrideRegistrar> > g_factory = LAZY_INSTANCE_INITIALIZER; // static -ProfileKeyedAPIFactory<ChromeManifestParser>* -ChromeManifestParser::GetFactoryInstance() { +ProfileKeyedAPIFactory<ExtensionWebUIOverrideRegistrar>* +ExtensionWebUIOverrideRegistrar::GetFactoryInstance() { return &g_factory.Get(); } diff --git a/chrome/browser/extensions/chrome_manifest_parser.h b/chrome/browser/extensions/extension_web_ui_override_registrar.h index eaa2633..782cc51 100644 --- a/chrome/browser/extensions/chrome_manifest_parser.h +++ b/chrome/browser/extensions/extension_web_ui_override_registrar.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_CHROME_MANIFEST_PARSER_H_ -#define CHROME_BROWSER_EXTENSIONS_CHROME_MANIFEST_PARSER_H_ +#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_UI_OVERRIDE_REGISTRAR_H_ +#define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_UI_OVERRIDE_REGISTRAR_H_ #include "base/basictypes.h" #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" @@ -14,14 +14,15 @@ class Profile; namespace extensions { -class ChromeManifestParser : public ProfileKeyedAPI, +class ExtensionWebUIOverrideRegistrar : public ProfileKeyedAPI, public content::NotificationObserver { public: - explicit ChromeManifestParser(Profile* profile); - virtual ~ChromeManifestParser(); + explicit ExtensionWebUIOverrideRegistrar(Profile* profile); + virtual ~ExtensionWebUIOverrideRegistrar(); // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<ChromeManifestParser>* GetFactoryInstance(); + static ProfileKeyedAPIFactory<ExtensionWebUIOverrideRegistrar>* + GetFactoryInstance(); // content::NotificationObserver implementation. virtual void Observe(int type, @@ -29,17 +30,19 @@ class ChromeManifestParser : public ProfileKeyedAPI, const content::NotificationDetails& details) OVERRIDE; private: - friend class ProfileKeyedAPIFactory<ChromeManifestParser>; + friend class ProfileKeyedAPIFactory<ExtensionWebUIOverrideRegistrar>; // ProfileKeyedAPI implementation. - static const char* service_name() { return "ChromeManifestParser"; } + static const char* service_name() { + return "ExtensionWebUIOverrideRegistrar"; + } Profile* const profile_; content::NotificationRegistrar registrar_; - DISALLOW_COPY_AND_ASSIGN(ChromeManifestParser); + DISALLOW_COPY_AND_ASSIGN(ExtensionWebUIOverrideRegistrar); }; } // namespace extensions -#endif // CHROME_BROWSER_EXTENSIONS_CHROME_MANIFEST_PARSER_H_ +#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_UI_OVERRIDE_REGISTRAR_H_ diff --git a/chrome/browser/extensions/image_loader_unittest.cc b/chrome/browser/extensions/image_loader_unittest.cc index 453ec05..c34f128 100644 --- a/chrome/browser/extensions/image_loader_unittest.cc +++ b/chrome/browser/extensions/image_loader_unittest.cc @@ -13,7 +13,6 @@ #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_icon_set.h" #include "chrome/common/extensions/manifest.h" -#include "chrome/common/extensions/manifest_handler.h" #include "chrome/common/extensions/manifest_handlers/icons_handler.h" #include "content/public/browser/notification_service.h" #include "content/public/test/test_browser_thread.h" @@ -100,16 +99,10 @@ class ImageLoaderTest : public testing::Test { private: virtual void SetUp() OVERRIDE { testing::Test::SetUp(); - (new extensions::IconsHandler)->Register(); - file_thread_.Start(); io_thread_.Start(); } - virtual void TearDown() OVERRIDE { - extensions::ManifestHandler::ClearRegistryForTesting(); - } - int image_loaded_count_; bool quit_in_image_loaded_; MessageLoop ui_loop_; diff --git a/chrome/browser/extensions/sandboxed_unpacker_unittest.cc b/chrome/browser/extensions/sandboxed_unpacker_unittest.cc index 0f87990..ddb56c01 100644 --- a/chrome/browser/extensions/sandboxed_unpacker_unittest.cc +++ b/chrome/browser/extensions/sandboxed_unpacker_unittest.cc @@ -11,9 +11,7 @@ #include "base/values.h" #include "chrome/browser/extensions/sandboxed_unpacker.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/extensions/api/i18n/default_locale_handler.h" #include "chrome/common/extensions/extension.h" -#include "chrome/common/extensions/manifest_handler.h" #include "chrome/common/extensions/unpacker.h" #include "content/public/test/test_browser_thread.h" #include "extensions/common/constants.h" @@ -68,7 +66,6 @@ class SandboxedUnpackerTest : public testing::Test { // It will delete itself. client_ = new MockSandboxedUnpackerClient; client_->DelegateToFake(); - (new extensions::DefaultLocaleHandler)->Register(); } virtual void TearDown() { @@ -76,7 +73,6 @@ class SandboxedUnpackerTest : public testing::Test { // it posts a task to it. sandboxed_unpacker_ = NULL; loop_.RunUntilIdle(); - ManifestHandler::ClearRegistryForTesting(); } void SetupUnpacker(const std::string& crx_name) { diff --git a/chrome/browser/extensions/script_bubble_controller_unittest.cc b/chrome/browser/extensions/script_bubble_controller_unittest.cc index a75845d..b339d0f 100644 --- a/chrome/browser/extensions/script_bubble_controller_unittest.cc +++ b/chrome/browser/extensions/script_bubble_controller_unittest.cc @@ -18,8 +18,6 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_builder.h" #include "chrome/common/extensions/feature_switch.h" -#include "chrome/common/extensions/permissions/chrome_api_permissions.h" -#include "chrome/common/extensions/permissions/scoped_testing_permissions_info.h" #include "chrome/common/extensions/value_builder.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/testing_profile.h" @@ -43,8 +41,7 @@ class ScriptBubbleControllerTest : public ChromeRenderViewHostTestHarness { ScriptBubbleControllerTest() : ui_thread_(BrowserThread::UI, MessageLoop::current()), file_thread_(BrowserThread::FILE, MessageLoop::current()), - enable_script_bubble_(FeatureSwitch::script_bubble(), true), - permissions_info_(ChromeAPIPermissions()) { + enable_script_bubble_(FeatureSwitch::script_bubble(), true) { } virtual void SetUp() OVERRIDE { @@ -75,7 +72,6 @@ class ScriptBubbleControllerTest : public ChromeRenderViewHostTestHarness { content::TestBrowserThread ui_thread_; content::TestBrowserThread file_thread_; FeatureSwitch::ScopedOverride enable_script_bubble_; - ScopedTestingPermissionsInfo permissions_info_; #if defined OS_CHROMEOS chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; diff --git a/chrome/browser/extensions/startup_helper.cc b/chrome/browser/extensions/startup_helper.cc index 5f3a90c..77dc2d2 100644 --- a/chrome/browser/extensions/startup_helper.cc +++ b/chrome/browser/extensions/startup_helper.cc @@ -18,10 +18,8 @@ #include "chrome/browser/extensions/webstore_startup_installer.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/extensions/api/i18n/default_locale_handler.h" -#include "chrome/common/extensions/background_info.h" +#include "chrome/common/extensions/chrome_manifest_handlers.h" #include "chrome/common/extensions/extension.h" -#include "chrome/common/extensions/incognito_handler.h" #include "chrome/common/extensions/permissions/chrome_api_permissions.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/web_contents.h" @@ -42,9 +40,7 @@ namespace extensions { StartupHelper::StartupHelper() : pack_job_succeeded_(false) { PermissionsInfo::GetInstance()->InitializeWithDelegate( ChromeAPIPermissions()); - (new DefaultLocaleHandler)->Register(); - (new BackgroundManifestHandler)->Register(); - (new IncognitoHandler)->Register(); + RegisterChromeManifestHandlers(); } void StartupHelper::OnPackSuccess( diff --git a/chrome/browser/extensions/updater/extension_updater_unittest.cc b/chrome/browser/extensions/updater/extension_updater_unittest.cc index 30359d1..049027e 100644 --- a/chrome/browser/extensions/updater/extension_updater_unittest.cc +++ b/chrome/browser/extensions/updater/extension_updater_unittest.cc @@ -43,8 +43,6 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_manifest_constants.h" -#include "chrome/common/extensions/manifest_handler.h" -#include "chrome/common/extensions/manifest_url_handler.h" #include "chrome/common/omaha_query_params/omaha_query_params.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" @@ -482,7 +480,6 @@ class ExtensionUpdaterTest : public testing::Test { virtual void SetUp() OVERRIDE { prefs_.reset(new TestExtensionPrefs(loop_.message_loop_proxy())); - (new extensions::UpdateURLHandler)->Register(); } virtual void TearDown() OVERRIDE { @@ -491,7 +488,6 @@ class ExtensionUpdaterTest : public testing::Test { // those objects are released. RunUntilIdle(); prefs_.reset(); - ManifestHandler::ClearRegistryForTesting(); } void RunUntilIdle() { diff --git a/chrome/browser/extensions/web_accessible_resources_parser.cc b/chrome/browser/extensions/web_accessible_resources_parser.cc deleted file mode 100644 index 63f00a4..0000000 --- a/chrome/browser/extensions/web_accessible_resources_parser.cc +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/extensions/web_accessible_resources_parser.h" - -#include "base/lazy_instance.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/common/extensions/web_accessible_resources_handler.h" - -namespace extensions { - -WebAccessibleResourcesParser::WebAccessibleResourcesParser(Profile* profile) { - (new WebAccessibleResourcesHandler)->Register(); -} - -WebAccessibleResourcesParser::~WebAccessibleResourcesParser() { -} - -static base::LazyInstance<ProfileKeyedAPIFactory<WebAccessibleResourcesParser> > -g_factory = LAZY_INSTANCE_INITIALIZER; - -// static -ProfileKeyedAPIFactory<WebAccessibleResourcesParser>* - WebAccessibleResourcesParser::GetFactoryInstance() { - return &g_factory.Get(); -} - -} // namespace extensions diff --git a/chrome/browser/extensions/web_accessible_resources_parser.h b/chrome/browser/extensions/web_accessible_resources_parser.h deleted file mode 100644 index 20341fe..0000000 --- a/chrome/browser/extensions/web_accessible_resources_parser.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_EXTENSIONS_WEB_ACCESSIBLE_RESOURCES_PARSER_H_ -#define CHROME_BROWSER_EXTENSIONS_WEB_ACCESSIBLE_RESOURCES_PARSER_H_ - -#include "base/basictypes.h" -#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" - -class Profile; - -namespace extensions { - -class WebAccessibleResourcesParser : public ProfileKeyedAPI { - public: - explicit WebAccessibleResourcesParser(Profile* profile); - virtual ~WebAccessibleResourcesParser(); - - // ProfileKeyedAPI implementation. - static ProfileKeyedAPIFactory<WebAccessibleResourcesParser>* - GetFactoryInstance(); - - private: - friend class ProfileKeyedAPIFactory<WebAccessibleResourcesParser>; - - // ProfileKeyedAPI implementation. - static const char* service_name() { - return "WebAccessibleResourcesParser"; - } - static const bool kServiceIsNULLWhileTesting = true; - - DISALLOW_COPY_AND_ASSIGN(WebAccessibleResourcesParser); -}; - -} // namespace extensions - -#endif // CHROME_BROWSER_EXTENSIONS_WEB_ACCESSIBLE_RESOURCES_PARSER_H_ diff --git a/chrome/browser/managed_mode/managed_user_service_unittest.cc b/chrome/browser/managed_mode/managed_user_service_unittest.cc index f40983d..d6ec739 100644 --- a/chrome/browser/managed_mode/managed_user_service_unittest.cc +++ b/chrome/browser/managed_mode/managed_user_service_unittest.cc @@ -11,9 +11,6 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/extensions/api/managed_mode_private/managed_mode_handler.h" -#include "chrome/common/extensions/manifest_handler.h" -#include "chrome/common/extensions/manifest_handlers/requirements_handler.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" #include "content/public/test/test_utils.h" @@ -154,12 +151,9 @@ class ManagedUserServiceExtensionTest : public ExtensionServiceTestBase { virtual void SetUp() OVERRIDE { ExtensionServiceTestBase::SetUp(); InitializeEmptyExtensionService(); - (new extensions::RequirementsHandler)->Register(); - (new extensions::ManagedModeHandler)->Register(); } virtual void TearDown() OVERRIDE { - extensions::ManifestHandler::ClearRegistryForTesting(); ExtensionServiceTestBase::TearDown(); } diff --git a/chrome/browser/media_galleries/media_file_system_registry_unittest.cc b/chrome/browser/media_galleries/media_file_system_registry_unittest.cc index 0435598..45e7fc2 100644 --- a/chrome/browser/media_galleries/media_file_system_registry_unittest.cc +++ b/chrome/browser/media_galleries/media_file_system_registry_unittest.cc @@ -31,12 +31,7 @@ #include "chrome/browser/storage_monitor/removable_device_constants.h" #include "chrome/browser/storage_monitor/storage_monitor.h" #include "chrome/browser/storage_monitor/test_storage_monitor.h" -#include "chrome/common/extensions/background_info.h" #include "chrome/common/extensions/extension.h" -#include "chrome/common/extensions/incognito_handler.h" -#include "chrome/common/extensions/manifest_handler.h" -#include "chrome/common/extensions/permissions/chrome_api_permissions.h" -#include "chrome/common/extensions/permissions/scoped_testing_permissions_info.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile.h" @@ -380,7 +375,6 @@ class MediaFileSystemRegistryTest : public ChromeRenderViewHostTestHarness { // Needed for extension service & friends to work. content::TestBrowserThread ui_thread_; content::TestBrowserThread file_thread_; - extensions::ScopedTestingPermissionsInfo permissions_info_; #if defined OS_CHROMEOS chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; @@ -589,8 +583,7 @@ int ProfileState::GetAndClearComparisonCount() { MediaFileSystemRegistryTest::MediaFileSystemRegistryTest() : ui_thread_(content::BrowserThread::UI, MessageLoop::current()), - file_thread_(content::BrowserThread::FILE, MessageLoop::current()), - permissions_info_(extensions::ChromeAPIPermissions()) { + file_thread_(content::BrowserThread::FILE, MessageLoop::current()) { } void MediaFileSystemRegistryTest::CreateProfileState(size_t profile_count) { @@ -755,8 +748,6 @@ void MediaFileSystemRegistryTest::SetUp() { test_file_system_context_ = new TestMediaFileSystemContext( g_browser_process->media_file_system_registry()); - (new extensions::BackgroundManifestHandler)->Register(); - (new extensions::IncognitoHandler)->Register(); ASSERT_TRUE(galleries_dir_.CreateUniqueTempDir()); empty_dir_ = galleries_dir_.path().AppendASCII("empty"); @@ -774,7 +765,6 @@ void MediaFileSystemRegistryTest::TearDown() { EXPECT_EQ(0U, registry->GetExtensionGalleriesHostCountForTests()); BrowserThread::GetBlockingPool()->FlushForTesting(); MessageLoop::current()->RunUntilIdle(); - extensions::ManifestHandler::ClearRegistryForTesting(); } /////////// diff --git a/chrome/browser/media_galleries/media_galleries_preferences_unittest.cc b/chrome/browser/media_galleries/media_galleries_preferences_unittest.cc index 22adca1..8d4a9df 100644 --- a/chrome/browser/media_galleries/media_galleries_preferences_unittest.cc +++ b/chrome/browser/media_galleries/media_galleries_preferences_unittest.cc @@ -22,7 +22,6 @@ #include "chrome/browser/storage_monitor/test_storage_monitor.h" #include "chrome/common/extensions/background_info.h" #include "chrome/common/extensions/extension.h" -#include "chrome/common/extensions/extension_unittest.h" #include "chrome/test/base/testing_profile.h" #include "content/public/test/test_browser_thread.h" #include "sync/api/string_ordinal.h" @@ -64,7 +63,7 @@ class MockGalleryChangeObserver } // namespace -class MediaGalleriesPreferencesTest : public extensions::ExtensionTest { +class MediaGalleriesPreferencesTest : public testing::Test { public: typedef std::map<std::string /*device id*/, MediaGalleryPrefIdSet> DeviceIdPrefIdsMap; @@ -84,8 +83,6 @@ class MediaGalleriesPreferencesTest : public extensions::ExtensionTest { } virtual void SetUp() OVERRIDE { - extensions::ExtensionTest::SetUp(); - extensions::TestExtensionSystem* extension_system( static_cast<extensions::TestExtensionSystem*>( extensions::ExtensionSystem::Get(profile_.get()))); @@ -124,7 +121,6 @@ class MediaGalleriesPreferencesTest : public extensions::ExtensionTest { virtual void TearDown() OVERRIDE { Verify(); - extensions::ExtensionTest::TearDown(); } void Verify() { diff --git a/chrome/browser/profiles/profile_dependency_manager.cc b/chrome/browser/profiles/profile_dependency_manager.cc index 1538621..93e7610 100644 --- a/chrome/browser/profiles/profile_dependency_manager.cc +++ b/chrome/browser/profiles/profile_dependency_manager.cc @@ -27,10 +27,8 @@ #include "chrome/browser/extensions/api/dial/dial_api_factory.h" #include "chrome/browser/extensions/api/discovery/suggested_links_registry_factory.h" #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" -#include "chrome/browser/extensions/api/file_handlers/file_handlers_api.h" #include "chrome/browser/extensions/api/font_settings/font_settings_api.h" #include "chrome/browser/extensions/api/history/history_api.h" -#include "chrome/browser/extensions/api/i18n/i18n_api.h" #include "chrome/browser/extensions/api/identity/identity_api.h" #include "chrome/browser/extensions/api/idle/idle_manager_factory.h" #include "chrome/browser/extensions/api/input/input.h" @@ -38,26 +36,20 @@ #include "chrome/browser/extensions/api/management/management_api.h" #include "chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.h" #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" -#include "chrome/browser/extensions/api/page_launcher/page_launcher_api.h" -#include "chrome/browser/extensions/api/plugins/plugins_api.h" #include "chrome/browser/extensions/api/preference/preference_api.h" #include "chrome/browser/extensions/api/processes/processes_api.h" #include "chrome/browser/extensions/api/push_messaging/push_messaging_api.h" #include "chrome/browser/extensions/api/session_restore/session_restore_api.h" #include "chrome/browser/extensions/api/spellcheck/spellcheck_api.h" #include "chrome/browser/extensions/api/streams_private/streams_private_api.h" -#include "chrome/browser/extensions/api/system_indicator/system_indicator_api.h" #include "chrome/browser/extensions/api/system_info/system_info_api.h" #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry_factory.h" #include "chrome/browser/extensions/api/tabs/tabs_windows_api.h" #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" -#include "chrome/browser/extensions/chrome_manifest_parser.h" -#include "chrome/browser/extensions/content_scripts_parser.h" -#include "chrome/browser/extensions/csp_parser.h" #include "chrome/browser/extensions/extension_system_factory.h" +#include "chrome/browser/extensions/extension_web_ui_override_registrar.h" #include "chrome/browser/extensions/install_tracker_factory.h" #include "chrome/browser/extensions/token_cache/token_cache_service_factory.h" -#include "chrome/browser/extensions/web_accessible_resources_parser.h" #include "chrome/browser/favicon/favicon_service_factory.h" #include "chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h" #include "chrome/browser/google/google_url_tracker_factory.h" @@ -281,18 +273,14 @@ void ProfileDependencyManager::AssertFactoriesBuilt() { extensions::AudioAPI::GetFactoryInstance(); extensions::BookmarksAPI::GetFactoryInstance(); extensions::BluetoothAPIFactory::GetInstance(); - extensions::ChromeManifestParser::GetFactoryInstance(); extensions::CommandService::GetFactoryInstance(); - extensions::ContentScriptsParser::GetFactoryInstance(); extensions::CookiesAPI::GetFactoryInstance(); - extensions::CSPParser::GetFactoryInstance(); extensions::DialAPIFactory::GetInstance(); extensions::ExtensionActionAPI::GetFactoryInstance(); extensions::ExtensionSystemFactory::GetInstance(); - extensions::FileHandlersAPI::GetFactoryInstance(); + extensions::ExtensionWebUIOverrideRegistrar::GetFactoryInstance(); extensions::FontSettingsAPI::GetFactoryInstance(); extensions::HistoryAPI::GetFactoryInstance(); - extensions::I18nAPI::GetFactoryInstance(); extensions::IdentityAPI::GetFactoryInstance(); extensions::IdleManagerFactory::GetInstance(); extensions::InstallTrackerFactory::GetInstance(); @@ -310,21 +298,17 @@ void ProfileDependencyManager::AssertFactoriesBuilt() { extensions::MediaPlayerAPI::GetFactoryInstance(); #endif extensions::OmniboxAPI::GetFactoryInstance(); - extensions::PageLauncherAPI::GetFactoryInstance(); - extensions::PluginsAPI::GetFactoryInstance(); extensions::PreferenceAPI::GetFactoryInstance(); extensions::ProcessesAPI::GetFactoryInstance(); extensions::PushMessagingAPI::GetFactoryInstance(); extensions::SessionRestoreAPI::GetFactoryInstance(); extensions::SpellcheckAPI::GetFactoryInstance(); extensions::StreamsPrivateAPI::GetFactoryInstance(); - extensions::SystemIndicatorAPI::GetFactoryInstance(); extensions::SystemInfoAPI::GetFactoryInstance(); extensions::SuggestedLinksRegistryFactory::GetInstance(); extensions::TabCaptureRegistryFactory::GetInstance(); extensions::TabsWindowsAPI::GetFactoryInstance(); extensions::TtsAPI::GetFactoryInstance(); - extensions::WebAccessibleResourcesParser::GetFactoryInstance(); extensions::WebNavigationAPI::GetFactoryInstance(); #endif // defined(ENABLE_EXTENSIONS) FaviconServiceFactory::GetInstance(); diff --git a/chrome/browser/speech/extension_api/tts_extension_api.cc b/chrome/browser/speech/extension_api/tts_extension_api.cc index d36c6bd..177bad6 100644 --- a/chrome/browser/speech/extension_api/tts_extension_api.cc +++ b/chrome/browser/speech/extension_api/tts_extension_api.cc @@ -14,7 +14,6 @@ #include "chrome/browser/speech/extension_api/tts_engine_extension_api.h" #include "chrome/browser/speech/extension_api/tts_extension_api_constants.h" #include "chrome/browser/speech/tts_controller.h" -#include "chrome/common/extensions/api/speech/tts_engine_manifest_handler.h" #include "ui/base/l10n/l10n_util.h" namespace constants = tts_extension_api_constants; @@ -293,7 +292,6 @@ TtsAPI* TtsAPI::Get(Profile* profile) { } TtsAPI::TtsAPI(Profile* profile) { - (new TtsEngineManifestHandler)->Register(); ExtensionFunctionRegistry* registry = ExtensionFunctionRegistry::GetInstance(); registry->RegisterFunction<ExtensionTtsEngineSendTtsEventFunction>(); diff --git a/chrome/browser/themes/browser_theme_pack_unittest.cc b/chrome/browser/themes/browser_theme_pack_unittest.cc index 3863be3..ae7fcbf 100644 --- a/chrome/browser/themes/browser_theme_pack_unittest.cc +++ b/chrome/browser/themes/browser_theme_pack_unittest.cc @@ -13,8 +13,6 @@ #include "base/values.h" #include "chrome/browser/themes/theme_properties.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/extensions/manifest_handler.h" -#include "chrome/common/extensions/manifest_handlers/theme_handler.h" #include "content/public/test/test_browser_thread.h" #include "grit/theme_resources.h" #include "testing/gtest/include/gtest/gtest.h" @@ -32,15 +30,6 @@ class BrowserThemePackTest : public ::testing::Test { theme_pack_(new BrowserThemePack) { } - virtual void SetUp() OVERRIDE { - testing::Test::SetUp(); - (new extensions::ThemeHandler)->Register(); - } - - virtual void TearDown() OVERRIDE { - extensions::ManifestHandler::ClearRegistryForTesting(); - } - // Transformation for link underline colors. SkColor BuildThirdOpacity(SkColor color_link) { return SkColorSetA(color_link, SkColorGetA(color_link) / 3); diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc index f5c916b..5b8fa92 100644 --- a/chrome/browser/themes/theme_service.cc +++ b/chrome/browser/themes/theme_service.cc @@ -19,8 +19,6 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension_manifest_constants.h" -#include "chrome/common/extensions/manifest_handler.h" -#include "chrome/common/extensions/manifest_handlers/theme_handler.h" #include "chrome/common/pref_names.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/user_metrics.h" @@ -92,8 +90,6 @@ void ThemeService::Init(Profile* profile) { DCHECK(CalledOnValidThread()); profile_ = profile; - (new extensions::ThemeHandler)->Register(); - LoadThemePrefs(); if (!ready_) { diff --git a/chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller_unittest.mm index 733def1..fe0af80 100644 --- a/chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller_unittest.mm @@ -12,13 +12,8 @@ #include "chrome/browser/extensions/test_extension_system.h" #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" #include "chrome/browser/ui/toolbar/action_box_menu_model.h" -#include "chrome/common/extensions/background_info.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_builder.h" -#include "chrome/common/extensions/incognito_handler.h" -#include "chrome/common/extensions/manifest_handler.h" -#include "chrome/common/extensions/permissions/chrome_api_permissions.h" -#include "chrome/common/extensions/permissions/scoped_testing_permissions_info.h" #include "testing/gtest/include/gtest/gtest.h" namespace { @@ -50,8 +45,7 @@ class MenuDelegate : public ui::SimpleMenuModel::Delegate { class ActionBoxMenuBubbleControllerTest : public CocoaProfileTest { public: - ActionBoxMenuBubbleControllerTest() - : permissions_info_(extensions::ChromeAPIPermissions()) { + ActionBoxMenuBubbleControllerTest() { } virtual void SetUp() OVERRIDE { @@ -67,14 +61,11 @@ class ActionBoxMenuBubbleControllerTest : public CocoaProfileTest { &command_line, base::FilePath(), false); EXPECT_TRUE(service_->extensions_enabled()); service_->Init(); - (new extensions::BackgroundManifestHandler)->Register(); - (new extensions::IncognitoHandler)->Register(); } virtual void TearDown() OVERRIDE { // Close our windows. [controller_ close]; - extensions::ManifestHandler::ClearRegistryForTesting(); CocoaProfileTest::TearDown(); } @@ -131,7 +122,6 @@ class ActionBoxMenuBubbleControllerTest : public CocoaProfileTest { protected: ActionBoxMenuBubbleController* controller_; MenuDelegate menu_delegate_; - extensions::ScopedTestingPermissionsInfo permissions_info_; ExtensionService* service_; }; diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi index bc065ff..eab9fe1 100644 --- a/chrome/chrome_browser_extensions.gypi +++ b/chrome/chrome_browser_extensions.gypi @@ -218,8 +218,6 @@ 'browser/extensions/api/extension_action/extension_page_actions_api_constants.h', 'browser/extensions/api/file_handlers/app_file_handler_util.cc', 'browser/extensions/api/file_handlers/app_file_handler_util.h', - 'browser/extensions/api/file_handlers/file_handlers_api.cc', - 'browser/extensions/api/file_handlers/file_handlers_api.h', 'browser/extensions/api/file_system/file_system_api.cc', 'browser/extensions/api/file_system/file_system_api.h', 'browser/extensions/api/font_settings/font_settings_api.cc', @@ -300,8 +298,6 @@ 'browser/extensions/api/permissions/permissions_api.h', 'browser/extensions/api/permissions/permissions_api_helpers.cc', 'browser/extensions/api/permissions/permissions_api_helpers.h', - 'browser/extensions/api/plugins/plugins_api.cc', - 'browser/extensions/api/plugins/plugins_api.h', 'browser/extensions/api/power/power_api.cc', 'browser/extensions/api/power/power_api.h', 'browser/extensions/api/power/power_api_manager.cc', @@ -399,7 +395,6 @@ 'browser/extensions/api/sync_file_system/sync_file_system_api.h', 'browser/extensions/api/sync_file_system/sync_file_system_api_helpers.cc', 'browser/extensions/api/sync_file_system/sync_file_system_api_helpers.h', - 'browser/extensions/api/system_indicator/system_indicator_api.cc', 'browser/extensions/api/system_indicator/system_indicator_api.h', 'browser/extensions/api/system_indicator/system_indicator_manager.cc', 'browser/extensions/api/system_indicator/system_indicator_manager.h', @@ -515,10 +510,6 @@ 'browser/extensions/crx_installer.cc', 'browser/extensions/crx_installer.h', 'browser/extensions/crx_installer_error.h', - 'browser/extensions/content_scripts_parser.cc', - 'browser/extensions/content_scripts_parser.h', - 'browser/extensions/csp_parser.cc', - 'browser/extensions/csp_parser.h', 'browser/extensions/data_deleter.cc', 'browser/extensions/data_deleter.h', 'browser/extensions/default_apps.cc', @@ -627,6 +618,8 @@ 'browser/extensions/extension_warning_set.h', 'browser/extensions/extension_web_ui.cc', 'browser/extensions/extension_web_ui.h', + 'browser/extensions/extension_web_ui_override_registrar.cc', + 'browser/extensions/extension_web_ui_override_registrar.h', 'browser/extensions/extension_webkit_preferences.cc', 'browser/extensions/extension_webkit_preferences.h', 'browser/extensions/extensions_quota_service.cc', @@ -660,8 +653,6 @@ 'browser/extensions/location_bar_controller.h', 'browser/extensions/management_policy.cc', 'browser/extensions/management_policy.h', - 'browser/extensions/chrome_manifest_parser.cc', - 'browser/extensions/chrome_manifest_parser.h', 'browser/extensions/media_galleries_handler.h', 'browser/extensions/media_galleries_handler.cc', 'browser/extensions/menu_manager.cc', @@ -734,8 +725,6 @@ 'browser/extensions/user_script_listener.h', 'browser/extensions/user_script_master.cc', 'browser/extensions/user_script_master.h', - 'browser/extensions/web_accessible_resources_parser.cc', - 'browser/extensions/web_accessible_resources_parser.h', 'browser/extensions/webstore_data_fetcher.cc', 'browser/extensions/webstore_data_fetcher.h', 'browser/extensions/webstore_data_fetcher_delegate.h', diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index f7aa509..03ee500 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -198,6 +198,8 @@ 'common/extensions/api/system_indicator/system_indicator_handler.h', 'common/extensions/background_info.cc', 'common/extensions/background_info.h', + 'common/extensions/chrome_manifest_handlers.cc', + 'common/extensions/chrome_manifest_handlers.h', 'common/extensions/command.cc', 'common/extensions/command.h', 'common/extensions/csp_handler.cc', diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index ce7d17a..c606bb8 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -1573,7 +1573,6 @@ 'common/extensions/extension_set_unittest.cc', 'common/extensions/extension_sync_type_unittest.cc', 'common/extensions/extension_unittest.cc', - 'common/extensions/extension_unittest.h', 'common/extensions/feature_switch_unittest.cc', 'common/extensions/features/base_feature_provider_unittest.cc', 'common/extensions/features/complex_feature_unittest.cc', @@ -1888,12 +1887,19 @@ ['exclude', '^browser/extensions/api/'], ['exclude', '^browser/sync/glue/chrome_extensions_activity_monitor_unittest.cc'], ['exclude', '^common/extensions/api/'], + ['exclude', '^common/extensions/manifest_handlers/'], + ['exclude', '^common/extensions/manifest_tests/'], ], 'sources!': [ 'browser/extensions/extension_context_menu_model_unittest.cc', + 'browser/extensions/extension_protocols_unittest.cc', 'browser/extensions/extension_ui_unittest.cc', 'browser/extensions/pack_extension_unittest.cc', 'browser/extensions/permissions_updater_unittest.cc', + 'browser/extensions/sandboxed_unpacker_unittest.cc', + 'common/extensions/extension_sync_type_unittest.cc', + 'common/extensions/permissions/permission_set_unittest.cc', + 'common/extensions/unpacker_unittest.cc', ], }], ['use_ash==1', { diff --git a/chrome/common/extensions/api/commands/commands_manifest_unittest.cc b/chrome/common/extensions/api/commands/commands_manifest_unittest.cc index c642ebc..02d3489 100644 --- a/chrome/common/extensions/api/commands/commands_manifest_unittest.cc +++ b/chrome/common/extensions/api/commands/commands_manifest_unittest.cc @@ -8,7 +8,6 @@ #include "base/string_util.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/api/commands/commands_handler.h" -#include "chrome/common/extensions/api/extension_action/browser_action_handler.h" #include "testing/gtest/include/gtest/gtest.h" namespace errors = extension_manifest_errors; @@ -16,10 +15,6 @@ namespace errors = extension_manifest_errors; namespace extensions { class CommandsManifestTest : public ExtensionManifestTest { - protected: - virtual void SetUp() OVERRIDE { - (new CommandsHandler)->Register(); - } }; TEST_F(CommandsManifestTest, CommandManifestSimple) { @@ -86,7 +81,6 @@ TEST_F(CommandsManifestTest, CommandManifestRejectJustShift) { } TEST_F(CommandsManifestTest, BrowserActionSynthesizesCommand) { - (new BrowserActionHandler)->Register(); scoped_refptr<Extension> extension = LoadAndExpectSuccess("browser_action_synthesizes_command.json"); // An extension with a browser action but no extension command specified diff --git a/chrome/common/extensions/api/extension_action/browser_action_manifest_unittest.cc b/chrome/common/extensions/api/extension_action/browser_action_manifest_unittest.cc index ac5040c..789c7ba 100644 --- a/chrome/common/extensions/api/extension_action/browser_action_manifest_unittest.cc +++ b/chrome/common/extensions/api/extension_action/browser_action_manifest_unittest.cc @@ -3,7 +3,6 @@ // found in the LICENSE file. #include "chrome/common/extensions/api/extension_action/action_info.h" -#include "chrome/common/extensions/api/extension_action/browser_action_handler.h" #include "chrome/common/extensions/extension_builder.h" #include "chrome/common/extensions/extension_icon_set.h" #include "chrome/common/extensions/extension_manifest_constants.h" @@ -18,11 +17,6 @@ namespace extensions { namespace { class BrowserActionManifestTest : public ExtensionManifestTest { - protected: - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new BrowserActionHandler)->Register(); - } }; TEST_F(BrowserActionManifestTest, diff --git a/chrome/common/extensions/api/extension_action/page_action_manifest_unittest.cc b/chrome/common/extensions/api/extension_action/page_action_manifest_unittest.cc index 2591ebe..77374ac 100644 --- a/chrome/common/extensions/api/extension_action/page_action_manifest_unittest.cc +++ b/chrome/common/extensions/api/extension_action/page_action_manifest_unittest.cc @@ -3,7 +3,6 @@ // found in the LICENSE file. #include "chrome/common/extensions/api/extension_action/action_info.h" -#include "chrome/common/extensions/api/extension_action/page_action_handler.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" @@ -17,11 +16,6 @@ namespace extensions { class PageActionManifestTest : public ExtensionManifestTest { protected: - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new PageActionHandler)->Register(); - } - virtual const char* test_data_dir() OVERRIDE { return "page_action"; } diff --git a/chrome/common/extensions/api/extension_action/script_badge_manifest_unittest.cc b/chrome/common/extensions/api/extension_action/script_badge_manifest_unittest.cc index 2fb1c95..c77b597 100644 --- a/chrome/common/extensions/api/extension_action/script_badge_manifest_unittest.cc +++ b/chrome/common/extensions/api/extension_action/script_badge_manifest_unittest.cc @@ -3,13 +3,11 @@ // found in the LICENSE file. #include "chrome/common/extensions/api/extension_action/action_info.h" -#include "chrome/common/extensions/api/extension_action/script_badge_handler.h" #include "chrome/common/extensions/extension_builder.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_icon_set.h" #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/feature_switch.h" -#include "chrome/common/extensions/manifest_handlers/icons_handler.h" #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "extensions/common/install_warning.h" #include "testing/gmock/include/gmock/gmock.h" @@ -32,11 +30,6 @@ std::vector<InstallWarning> StripMissingFlagWarning( } class ScriptBadgeManifestTest : public ExtensionManifestTest { - protected: - virtual void SetUp() OVERRIDE { - (new IconsHandler)->Register(); - (new ScriptBadgeHandler)->Register(); - } }; } // namespace diff --git a/chrome/common/extensions/api/extension_api_unittest.cc b/chrome/common/extensions/api/extension_api_unittest.cc index f32d451..d8652a2 100644 --- a/chrome/common/extensions/api/extension_api_unittest.cc +++ b/chrome/common/extensions/api/extension_api_unittest.cc @@ -18,7 +18,6 @@ #include "base/values.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension.h" -#include "chrome/common/extensions/extension_unittest.h" #include "chrome/common/extensions/features/api_feature.h" #include "chrome/common/extensions/features/base_feature_provider.h" #include "chrome/common/extensions/features/simple_feature.h" @@ -32,10 +31,7 @@ SimpleFeature* CreateAPIFeature() { return new APIFeature(); } -class ExtensionAPITest : public ExtensionTest { -}; - -TEST_F(ExtensionAPITest, Creation) { +TEST(ExtensionAPITest, Creation) { ExtensionAPI* shared_instance = ExtensionAPI::GetSharedInstance(); EXPECT_EQ(shared_instance, ExtensionAPI::GetSharedInstance()); @@ -62,7 +58,7 @@ TEST_F(ExtensionAPITest, Creation) { } } -TEST_F(ExtensionAPITest, SplitDependencyName) { +TEST(ExtensionAPITest, SplitDependencyName) { struct { std::string input; std::string expected_feature_type; @@ -86,7 +82,7 @@ TEST_F(ExtensionAPITest, SplitDependencyName) { } } -TEST_F(ExtensionAPITest, IsPrivileged) { +TEST(ExtensionAPITest, IsPrivileged) { scoped_ptr<ExtensionAPI> extension_api( ExtensionAPI::CreateWithDefaultConfiguration()); @@ -115,7 +111,7 @@ TEST_F(ExtensionAPITest, IsPrivileged) { EXPECT_FALSE(extension_api->IsPrivileged("storage.set")); } -TEST_F(ExtensionAPITest, IsPrivilegedFeatures) { +TEST(ExtensionAPITest, IsPrivilegedFeatures) { struct { std::string api_full_name; bool expect_is_privilged; @@ -225,7 +221,7 @@ TEST(ExtensionAPI, APIFeatures) { } } -TEST_F(ExtensionAPITest, LazyGetSchema) { +TEST(ExtensionAPITest, LazyGetSchema) { scoped_ptr<ExtensionAPI> apis(ExtensionAPI::CreateWithDefaultConfiguration()); EXPECT_EQ(NULL, apis->GetSchema(std::string())); @@ -279,7 +275,7 @@ scoped_refptr<Extension> CreateExtensionWithPermission( return CreateExtensionWithPermissions(permissions); } -TEST_F(ExtensionAPITest, ExtensionWithUnprivilegedAPIs) { +TEST(ExtensionAPITest, ExtensionWithUnprivilegedAPIs) { scoped_refptr<Extension> extension; { std::set<std::string> permissions; @@ -334,7 +330,7 @@ TEST_F(ExtensionAPITest, ExtensionWithUnprivilegedAPIs) { GURL()).is_available()); } -TEST_F(ExtensionAPITest, ExtensionWithDependencies) { +TEST(ExtensionAPITest, ExtensionWithDependencies) { // Extension with the "ttsEngine" permission but not the "tts" permission; it // should not automatically get "tts" permission. { @@ -376,7 +372,7 @@ bool MatchesURL( api_name, NULL, Feature::WEB_PAGE_CONTEXT, GURL(url)).is_available(); } -TEST_F(ExtensionAPITest, URLMatching) { +TEST(ExtensionAPITest, URLMatching) { scoped_ptr<ExtensionAPI> api(ExtensionAPI::CreateWithDefaultConfiguration()); // "app" API is available to all URLs that content scripts can be injected. @@ -403,7 +399,7 @@ TEST_F(ExtensionAPITest, URLMatching) { "chrome-extension://fakeextension")); } -TEST_F(ExtensionAPITest, GetAPINameFromFullName) { +TEST(ExtensionAPITest, GetAPINameFromFullName) { struct { std::string input; std::string api_name; @@ -431,7 +427,7 @@ TEST_F(ExtensionAPITest, GetAPINameFromFullName) { } } -TEST_F(ExtensionAPITest, DefaultConfigurationFeatures) { +TEST(ExtensionAPITest, DefaultConfigurationFeatures) { scoped_ptr<ExtensionAPI> api(ExtensionAPI::CreateWithDefaultConfiguration()); SimpleFeature* bookmarks = static_cast<SimpleFeature*>( @@ -465,7 +461,7 @@ TEST_F(ExtensionAPITest, DefaultConfigurationFeatures) { } } -TEST_F(ExtensionAPITest, FeaturesRequireContexts) { +TEST(ExtensionAPITest, FeaturesRequireContexts) { // TODO(cduvall): Make this check API featues. scoped_ptr<base::DictionaryValue> api_features1(new base::DictionaryValue()); scoped_ptr<base::DictionaryValue> api_features2(new base::DictionaryValue()); @@ -503,7 +499,7 @@ static void GetDictionaryFromList(const base::DictionaryValue* schema, EXPECT_TRUE(list->GetDictionary(list_index, out)); } -TEST_F(ExtensionAPITest, TypesHaveNamespace) { +TEST(ExtensionAPITest, TypesHaveNamespace) { base::FilePath manifest_path; PathService::Get(chrome::DIR_TEST_DATA, &manifest_path); manifest_path = manifest_path.AppendASCII("extensions") diff --git a/chrome/common/extensions/api/i18n/default_locale_manifest_unittest.cc b/chrome/common/extensions/api/i18n/default_locale_manifest_unittest.cc index 94587b3..9da5532 100644 --- a/chrome/common/extensions/api/i18n/default_locale_manifest_unittest.cc +++ b/chrome/common/extensions/api/i18n/default_locale_manifest_unittest.cc @@ -10,10 +10,6 @@ namespace extensions { class DefaultLocaleManifestTest : public ExtensionManifestTest { - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new DefaultLocaleHandler)->Register(); - } }; TEST_F(DefaultLocaleManifestTest, DefaultLocale) { diff --git a/chrome/common/extensions/api/identity/extension_manifests_auth_unittest.cc b/chrome/common/extensions/api/identity/extension_manifests_auth_unittest.cc index 8a7af96..33b0481 100644 --- a/chrome/common/extensions/api/identity/extension_manifests_auth_unittest.cc +++ b/chrome/common/extensions/api/identity/extension_manifests_auth_unittest.cc @@ -13,11 +13,6 @@ namespace keys = extension_manifest_keys; namespace extensions { class OAuth2ManifestTest : public ExtensionManifestTest { - protected: - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new OAuth2ManifestHandler)->Register(); - } }; TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) { diff --git a/chrome/common/extensions/api/page_launcher/page_launcher_manifest_unittest.cc b/chrome/common/extensions/api/page_launcher/page_launcher_manifest_unittest.cc index 125e033..d432c4d 100644 --- a/chrome/common/extensions/api/page_launcher/page_launcher_manifest_unittest.cc +++ b/chrome/common/extensions/api/page_launcher/page_launcher_manifest_unittest.cc @@ -6,7 +6,6 @@ #include "base/compiler_specific.h" #include "chrome/common/extensions/api/extension_action/action_info.h" -#include "chrome/common/extensions/api/page_launcher/page_launcher_handler.h" #include "chrome/common/extensions/background_info.h" #include "chrome/common/extensions/extension_icon_set.h" #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" @@ -14,13 +13,7 @@ namespace extensions { class PageLauncherManifestTest : public ExtensionManifestTest { - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new PageLauncherHandler)->Register(); - // Required to be recognized as a platform app. - (new BackgroundManifestHandler)->Register(); - } - + protected: virtual char const* test_data_dir() OVERRIDE { return "page_launcher"; } diff --git a/chrome/common/extensions/chrome_manifest_handlers.cc b/chrome/common/extensions/chrome_manifest_handlers.cc new file mode 100644 index 0000000..aa5892e --- /dev/null +++ b/chrome/common/extensions/chrome_manifest_handlers.cc @@ -0,0 +1,86 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/common/extensions/chrome_manifest_handlers.h" + +#include "chrome/common/extensions/api/commands/commands_handler.h" +#include "chrome/common/extensions/api/extension_action/browser_action_handler.h" +#include "chrome/common/extensions/api/extension_action/page_action_handler.h" +#include "chrome/common/extensions/api/extension_action/script_badge_handler.h" +#include "chrome/common/extensions/api/file_handlers/file_handlers_parser.h" +#include "chrome/common/extensions/api/i18n/default_locale_handler.h" +#include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h" +#if defined(OS_CHROMEOS) +#include "chrome/common/extensions/api/input_ime/input_components_handler.h" +#endif +#include "chrome/common/extensions/api/managed_mode_private/managed_mode_handler.h" +#include "chrome/common/extensions/api/omnibox/omnibox_handler.h" +#include "chrome/common/extensions/api/page_launcher/page_launcher_handler.h" +#include "chrome/common/extensions/api/plugins/plugins_handler.h" +#include "chrome/common/extensions/api/speech/tts_engine_manifest_handler.h" +#include "chrome/common/extensions/api/spellcheck/spellcheck_handler.h" +#include "chrome/common/extensions/api/system_indicator/system_indicator_handler.h" +#include "chrome/common/extensions/background_info.h" +#include "chrome/common/extensions/csp_handler.h" +#include "chrome/common/extensions/incognito_handler.h" +#include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" +#include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" +#include "chrome/common/extensions/manifest_handlers/externally_connectable.h" +#include "chrome/common/extensions/manifest_handlers/icons_handler.h" +#include "chrome/common/extensions/manifest_handlers/kiosk_enabled_info.h" +#include "chrome/common/extensions/manifest_handlers/offline_enabled_info.h" +#include "chrome/common/extensions/manifest_handlers/requirements_handler.h" +#include "chrome/common/extensions/manifest_handlers/sandboxed_page_info.h" +#include "chrome/common/extensions/manifest_handlers/shared_module_info.h" +#include "chrome/common/extensions/manifest_handlers/theme_handler.h" +#include "chrome/common/extensions/manifest_url_handler.h" +#include "chrome/common/extensions/mime_types_handler.h" +#include "chrome/common/extensions/web_accessible_resources_handler.h" + +namespace extensions { + +void RegisterChromeManifestHandlers() { +#if defined(ENABLE_EXTENSIONS) + (new AppIsolationHandler)->Register(); + (new BackgroundManifestHandler)->Register(); + (new BrowserActionHandler)->Register(); + (new CommandsHandler)->Register(); + (new ContentScriptsHandler)->Register(); + (new CSPHandler(false))->Register(); + (new CSPHandler(true))->Register(); + (new DefaultLocaleHandler)->Register(); + (new DevToolsPageHandler)->Register(); + (new ExternallyConnectableHandler)->Register(); + (new FileHandlersParser)->Register(); + (new HomepageURLHandler)->Register(); + (new IconsHandler)->Register(); + (new IncognitoHandler)->Register(); +#if defined(OS_CHROMEOS) + (new InputComponentsHandler)->Register(); +#endif + (new KioskEnabledHandler)->Register(); + (new ManagedModeHandler)->Register(); + (new MimeTypesHandlerParser)->Register(); + (new OAuth2ManifestHandler)->Register(); + (new OfflineEnabledHandler)->Register(); + (new OmniboxHandler)->Register(); + (new OptionsPageHandler)->Register(); + (new PageActionHandler)->Register(); + (new PageLauncherHandler)->Register(); + (new PluginsHandler)->Register(); + (new RequirementsHandler)->Register(); + (new SandboxedPageHandler)->Register(); + (new ScriptBadgeHandler)->Register(); + (new SharedModuleHandler)->Register(); + (new SpellcheckHandler)->Register(); + (new SystemIndicatorHandler)->Register(); + (new ThemeHandler)->Register(); + (new TtsEngineManifestHandler)->Register(); + (new UpdateURLHandler)->Register(); + (new URLOverridesHandler)->Register(); + (new WebAccessibleResourcesHandler)->Register(); +#endif +} + +} // namespace extensions diff --git a/chrome/common/extensions/chrome_manifest_handlers.h b/chrome/common/extensions/chrome_manifest_handlers.h new file mode 100644 index 0000000..61303ee --- /dev/null +++ b/chrome/common/extensions/chrome_manifest_handlers.h @@ -0,0 +1,16 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_COMMON_EXTENSIONS_CHROME_MANIFEST_HANDLERS_H_ +#define CHROME_COMMON_EXTENSIONS_CHROME_MANIFEST_HANDLERS_H_ + +namespace extensions { + +// Registers all manifest handlers used in Chrome. Should be called +// once in each process. +void RegisterChromeManifestHandlers(); + +} // namespace extensions + +#endif // CHROME_COMMON_EXTENSIONS_CHROME_MANIFEST_HANDLERS_H_ diff --git a/chrome/common/extensions/extension_file_util_unittest.cc b/chrome/common/extensions/extension_file_util_unittest.cc index 67ac095..ce08f10 100644 --- a/chrome/common/extensions/extension_file_util_unittest.cc +++ b/chrome/common/extensions/extension_file_util_unittest.cc @@ -11,16 +11,9 @@ #include "base/stringprintf.h" #include "base/utf_string_conversions.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/extensions/api/extension_action/browser_action_handler.h" -#include "chrome/common/extensions/api/extension_action/page_action_handler.h" -#include "chrome/common/extensions/api/i18n/default_locale_handler.h" -#include "chrome/common/extensions/background_info.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/manifest.h" -#include "chrome/common/extensions/manifest_handler.h" -#include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" -#include "chrome/common/extensions/manifest_handlers/icons_handler.h" #include "extensions/common/constants.h" #include "grit/generated_resources.h" #include "testing/gmock/include/gmock/gmock.h" @@ -33,20 +26,6 @@ using extensions::Manifest; namespace keys = extension_manifest_keys; class ExtensionFileUtilTest : public testing::Test { - protected: - virtual void SetUp() OVERRIDE { - testing::Test::SetUp(); - (new extensions::BackgroundManifestHandler)->Register(); - (new extensions::BrowserActionHandler)->Register(); - (new extensions::DefaultLocaleHandler)->Register(); - (new extensions::IconsHandler)->Register(); - (new extensions::PageActionHandler)->Register(); - (new extensions::ContentScriptsHandler)->Register(); - } - - virtual void TearDown() OVERRIDE { - extensions::ManifestHandler::ClearRegistryForTesting(); - } }; TEST_F(ExtensionFileUtilTest, InstallUninstallGarbageCollect) { diff --git a/chrome/common/extensions/extension_sync_type_unittest.cc b/chrome/common/extensions/extension_sync_type_unittest.cc index b25e197..88cef0f 100644 --- a/chrome/common/extensions/extension_sync_type_unittest.cc +++ b/chrome/common/extensions/extension_sync_type_unittest.cc @@ -3,26 +3,19 @@ // found in the LICENSE file. #include "base/files/file_path.h" -#include "chrome/common/extensions/api/plugins/plugins_handler.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_manifest_constants.h" -#include "chrome/common/extensions/extension_unittest.h" #include "chrome/common/extensions/manifest.h" -#include "chrome/common/extensions/manifest_url_handler.h" #include "googleurl/src/gurl.h" +#include "testing/gtest/include/gtest/gtest.h" namespace keys = extension_manifest_keys; namespace errors = extension_manifest_errors; namespace extensions { -class ExtensionSyncTypeTest : public ExtensionTest { +class ExtensionSyncTypeTest : public testing::Test { protected: - virtual void SetUp() OVERRIDE { - ExtensionTest::SetUp(); - (new UpdateURLHandler)->Register(); - (new PluginsHandler)->Register(); - } - enum SyncTestExtensionType { EXTENSION, APP, diff --git a/chrome/common/extensions/extension_unittest.cc b/chrome/common/extensions/extension_unittest.cc index 62ef7eb..1173625 100644 --- a/chrome/common/extensions/extension_unittest.cc +++ b/chrome/common/extensions/extension_unittest.cc @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/extension_unittest.h" - #include "base/command_line.h" #include "base/file_util.h" #include "base/format_macros.h" @@ -13,22 +11,16 @@ #include "base/utf_string_conversions.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/extensions/api/plugins/plugins_handler.h" -#include "chrome/common/extensions/background_info.h" #include "chrome/common/extensions/command.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_file_util.h" #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/extension_test_util.h" #include "chrome/common/extensions/features/feature.h" -#include "chrome/common/extensions/incognito_handler.h" #include "chrome/common/extensions/manifest.h" -#include "chrome/common/extensions/manifest_handler.h" #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" #include "chrome/common/extensions/permissions/api_permission.h" -#include "chrome/common/extensions/permissions/chrome_api_permissions.h" #include "chrome/common/extensions/permissions/permission_set.h" -#include "chrome/common/extensions/permissions/scoped_testing_permissions_info.h" #include "chrome/common/extensions/permissions/socket_permission.h" #include "chrome/common/extensions/permissions/usb_device_permission.h" #include "chrome/common/url_constants.h" @@ -54,25 +46,9 @@ namespace errors = extension_manifest_errors; namespace extensions { -ExtensionTest::ExtensionTest() : permissions_info_(ChromeAPIPermissions()) {} - -void ExtensionTest::SetUp() { - testing::Test::SetUp(); - (new BackgroundManifestHandler)->Register(); - // We need the IncognitoHandler registered for all tests, since - // Extension uses it in Extension::CheckPlatformAppFeatures() as part of the - // creation process. - (new IncognitoHandler)->Register(); -} - -void ExtensionTest::TearDown() { - ManifestHandler::ClearRegistryForTesting(); - testing::Test::TearDown(); -} - // We persist location values in the preferences, so this is a sanity test that // someone doesn't accidentally change them. -TEST_F(ExtensionTest, LocationValuesTest) { +TEST(ExtensionTest, LocationValuesTest) { ASSERT_EQ(0, Manifest::INVALID_LOCATION); ASSERT_EQ(1, Manifest::INTERNAL); ASSERT_EQ(2, Manifest::EXTERNAL_PREF); @@ -84,7 +60,7 @@ TEST_F(ExtensionTest, LocationValuesTest) { ASSERT_EQ(8, Manifest::COMMAND_LINE); } -TEST_F(ExtensionTest, LocationPriorityTest) { +TEST(ExtensionTest, LocationPriorityTest) { for (int i = 0; i < Manifest::NUM_LOCATIONS; i++) { Manifest::Location loc = static_cast<Manifest::Location>(i); @@ -121,7 +97,7 @@ TEST_F(ExtensionTest, LocationPriorityTest) { Manifest::EXTERNAL_PREF)); } -TEST_F(ExtensionTest, GetResourceURLAndPath) { +TEST(ExtensionTest, GetResourceURLAndPath) { scoped_refptr<Extension> extension = LoadManifestStrict("empty_manifest", "empty.json"); EXPECT_TRUE(extension.get()); @@ -139,7 +115,7 @@ TEST_F(ExtensionTest, GetResourceURLAndPath) { extension->GetResourceURL("/test.html").spec()); } -TEST_F(ExtensionTest, GetAbsolutePathNoError) { +TEST(ExtensionTest, GetAbsolutePathNoError) { scoped_refptr<Extension> extension = LoadManifestStrict("absolute_path", "absolute.json"); EXPECT_TRUE(extension.get()); @@ -156,7 +132,7 @@ TEST_F(ExtensionTest, GetAbsolutePathNoError) { } -TEST_F(ExtensionTest, IdIsValid) { +TEST(ExtensionTest, IdIsValid) { EXPECT_TRUE(Extension::IdIsValid("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")); EXPECT_TRUE(Extension::IdIsValid("pppppppppppppppppppppppppppppppp")); EXPECT_TRUE(Extension::IdIsValid("abcdefghijklmnopabcdefghijklmnop")); @@ -171,7 +147,7 @@ TEST_F(ExtensionTest, IdIsValid) { // This test ensures that the mimetype sniffing code stays in sync with the // actual crx files that we test other parts of the system with. -TEST_F(ExtensionTest, MimeTypeSniffing) { +TEST(ExtensionTest, MimeTypeSniffing) { base::FilePath path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &path)); path = path.AppendASCII("extensions").AppendASCII("good.crx"); @@ -199,8 +175,7 @@ TEST_F(ExtensionTest, MimeTypeSniffing) { EXPECT_EQ("application/octet-stream", result); } -TEST_F(ExtensionTest, EffectiveHostPermissions) { - (new ContentScriptsHandler)->Register(); +TEST(ExtensionTest, EffectiveHostPermissions) { scoped_refptr<Extension> extension; URLPatternSet hosts; @@ -277,7 +252,7 @@ static bool CheckSocketPermission(scoped_refptr<Extension> extension, APIPermission::kSocket, ¶m); } -TEST_F(ExtensionTest, SocketPermissions) { +TEST(ExtensionTest, SocketPermissions) { // Set feature current channel to appropriate value. Feature::ScopedCurrentChannel scoped_channel( chrome::VersionInfo::CHANNEL_DEV); @@ -314,7 +289,7 @@ TEST_F(ExtensionTest, SocketPermissions) { // This tests the API permissions with an empty manifest (one that just // specifies a name and a version and nothing else). -TEST_F(ExtensionTest, ApiPermissions) { +TEST(ExtensionTest, ApiPermissions) { const struct { const char* permission_name; bool expect_success; @@ -359,7 +334,7 @@ TEST_F(ExtensionTest, ApiPermissions) { } } -TEST_F(ExtensionTest, GetPermissionMessages_ManyApiPermissions) { +TEST(ExtensionTest, GetPermissionMessages_ManyApiPermissions) { scoped_refptr<Extension> extension; extension = LoadManifest("permissions", "many-apis.json"); std::vector<string16> warnings = extension->GetPermissionMessageStrings(); @@ -374,7 +349,7 @@ TEST_F(ExtensionTest, GetPermissionMessages_ManyApiPermissions) { UTF16ToUTF8(warnings[5])); } -TEST_F(ExtensionTest, GetPermissionMessages_LocationApiPermission) { +TEST(ExtensionTest, GetPermissionMessages_LocationApiPermission) { scoped_refptr<Extension> extension; extension = LoadManifest("permissions", "location-api.json", @@ -385,8 +360,7 @@ TEST_F(ExtensionTest, GetPermissionMessages_LocationApiPermission) { EXPECT_EQ("Detect your physical location", UTF16ToUTF8(warnings[0])); } -TEST_F(ExtensionTest, GetPermissionMessages_ManyHosts) { - (new ContentScriptsHandler)->Register(); +TEST(ExtensionTest, GetPermissionMessages_ManyHosts) { scoped_refptr<Extension> extension; extension = LoadManifest("permissions", "many-hosts.json"); std::vector<string16> warnings = extension->GetPermissionMessageStrings(); @@ -395,8 +369,7 @@ TEST_F(ExtensionTest, GetPermissionMessages_ManyHosts) { UTF16ToUTF8(warnings[0])); } -TEST_F(ExtensionTest, GetPermissionMessages_Plugins) { - (new PluginsHandler)->Register(); +TEST(ExtensionTest, GetPermissionMessages_Plugins) { scoped_refptr<Extension> extension; extension = LoadManifest("permissions", "plugins.json"); std::vector<string16> warnings = extension->GetPermissionMessageStrings(); @@ -411,8 +384,7 @@ TEST_F(ExtensionTest, GetPermissionMessages_Plugins) { #endif } -TEST_F(ExtensionTest, WantsFileAccess) { - (new ContentScriptsHandler)->Register(); +TEST(ExtensionTest, WantsFileAccess) { scoped_refptr<Extension> extension; GURL file_url("file:///etc/passwd"); @@ -507,7 +479,7 @@ TEST_F(ExtensionTest, WantsFileAccess) { NULL)); } -TEST_F(ExtensionTest, ExtraFlags) { +TEST(ExtensionTest, ExtraFlags) { scoped_refptr<Extension> extension; extension = LoadManifest("app", "manifest.json", Extension::FROM_WEBSTORE); EXPECT_TRUE(extension->from_webstore()); @@ -886,7 +858,7 @@ TEST_F(ExtensionScriptAndCaptureVisibleTest, TabSpecific) { EXPECT_TRUE(AllowedExclusivelyOnTab(extension, no_urls, 2)); } -TEST_F(ExtensionTest, OptionalOnlyPermission) { +TEST(ExtensionTest, OptionalOnlyPermission) { // Set feature current channel to dev because the only permission that must // be optional (usbDevices) is only available on dev channel. Feature::ScopedCurrentChannel scoped_channel( diff --git a/chrome/common/extensions/extension_unittest.h b/chrome/common/extensions/extension_unittest.h deleted file mode 100644 index 99a7509..0000000 --- a/chrome/common/extensions/extension_unittest.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_UNITTEST_H_ -#define CHROME_COMMON_EXTENSIONS_EXTENSION_UNITTEST_H_ - -#include "base/compiler_specific.h" -#include "chrome/common/extensions/permissions/scoped_testing_permissions_info.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace extensions { - -// A base class for extension unit tests that sets up permissions and -// universally useful manifest handlers. -class ExtensionTest : public testing::Test { - public: - ExtensionTest(); - - protected: - virtual void SetUp() OVERRIDE; - - virtual void TearDown() OVERRIDE; - - ScopedTestingPermissionsInfo permissions_info_; -}; - -} // namespace extensions - -#endif // CHROME_COMMON_EXTENSIONS_EXTENSION_UNITTEST_H_ diff --git a/chrome/common/extensions/features/base_feature_provider_unittest.cc b/chrome/common/extensions/features/base_feature_provider_unittest.cc index a1de8b5..4b94fb1 100644 --- a/chrome/common/extensions/features/base_feature_provider_unittest.cc +++ b/chrome/common/extensions/features/base_feature_provider_unittest.cc @@ -4,7 +4,6 @@ #include "chrome/common/extensions/features/base_feature_provider.h" -#include "chrome/common/extensions/extension_unittest.h" #include "chrome/common/extensions/features/permission_feature.h" #include "chrome/common/extensions/value_builder.h" #include "testing/gtest/include/gtest/gtest.h" @@ -13,10 +12,7 @@ using chrome::VersionInfo; namespace extensions { -class BaseFeatureProviderTest : public ExtensionTest { -}; - -TEST_F(BaseFeatureProviderTest, ManifestFeatures) { +TEST(BaseFeatureProviderTest, ManifestFeatures) { FeatureProvider* provider = BaseFeatureProvider::GetByName("manifest"); SimpleFeature* feature = static_cast<SimpleFeature*>(provider->GetFeature("description")); @@ -59,7 +55,7 @@ TEST_F(BaseFeatureProviderTest, ManifestFeatures) { extension.get(), Feature::UNSPECIFIED_CONTEXT).result()); } -TEST_F(BaseFeatureProviderTest, PermissionFeatures) { +TEST(BaseFeatureProviderTest, PermissionFeatures) { FeatureProvider* provider = BaseFeatureProvider::GetByName("permission"); SimpleFeature* feature = static_cast<SimpleFeature*>(provider->GetFeature("contextMenus")); @@ -104,7 +100,7 @@ SimpleFeature* CreatePermissionFeature() { return new PermissionFeature(); } -TEST_F(BaseFeatureProviderTest, Validation) { +TEST(BaseFeatureProviderTest, Validation) { scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); base::DictionaryValue* feature1 = new base::DictionaryValue(); @@ -139,7 +135,7 @@ TEST_F(BaseFeatureProviderTest, Validation) { EXPECT_TRUE(provider->GetFeature("feature2")); } -TEST_F(BaseFeatureProviderTest, ComplexFeatures) { +TEST(BaseFeatureProviderTest, ComplexFeatures) { scoped_ptr<base::DictionaryValue> rule( DictionaryBuilder() .Set("feature1", diff --git a/chrome/common/extensions/manifest_handler.cc b/chrome/common/extensions/manifest_handler.cc index a97a7cd..2072aa9 100644 --- a/chrome/common/extensions/manifest_handler.cc +++ b/chrome/common/extensions/manifest_handler.cc @@ -6,6 +6,7 @@ #include <map> +#include "base/logging.h" #include "base/stl_util.h" #include "chrome/common/extensions/extension.h" @@ -57,11 +58,6 @@ void ManifestHandler::Register() { } // static -void ManifestHandler::ClearRegistryForTesting() { - GetRegistry()->ClearForTesting(); -} - -// static bool ManifestHandler::ParseExtension(Extension* extension, string16* error) { return GetRegistry()->ParseExtension(extension, error); } @@ -133,12 +129,6 @@ bool ManifestHandlerRegistry::ValidateExtension( return true; } -void ManifestHandlerRegistry::ClearForTesting() { - priority_map_.clear(); - handlers_.clear(); - is_sorted_ = false; -} - // static ManifestHandlerRegistry* ManifestHandlerRegistry::SetForTesting( ManifestHandlerRegistry* new_registry) { diff --git a/chrome/common/extensions/manifest_handler.h b/chrome/common/extensions/manifest_handler.h index b4a3c4f..030aa0a 100644 --- a/chrome/common/extensions/manifest_handler.h +++ b/chrome/common/extensions/manifest_handler.h @@ -75,10 +75,6 @@ class ManifestHandler { std::string* error, std::vector<InstallWarning>* warnings); - // Reset the manifest handler registry to an empty state. Useful for - // unit tests. - static void ClearRegistryForTesting(); - protected: // A convenience method for handlers that only register for 1 key, // so that they can define keys() { return SingleKey(kKey); } @@ -106,7 +102,6 @@ class ManifestHandlerRegistry { std::string* error, std::vector<InstallWarning>* warnings); - void ClearForTesting(); // Overrides the current global ManifestHandlerRegistry with // |registry|, returning the current one. static ManifestHandlerRegistry* SetForTesting( diff --git a/chrome/common/extensions/manifest_handlers/content_scripts_manifest_unittest.cc b/chrome/common/extensions/manifest_handlers/content_scripts_manifest_unittest.cc index c08c154..f2c3a91 100644 --- a/chrome/common/extensions/manifest_handlers/content_scripts_manifest_unittest.cc +++ b/chrome/common/extensions/manifest_handlers/content_scripts_manifest_unittest.cc @@ -17,11 +17,6 @@ namespace errors = extension_manifest_errors; namespace extensions { class ContentScriptsManifestTest : public ExtensionManifestTest { - protected: - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new ContentScriptsHandler)->Register(); - } }; TEST_F(ContentScriptsManifestTest, MatchPattern) { diff --git a/chrome/common/extensions/manifest_handlers/exclude_matches_manifest_unittest.cc b/chrome/common/extensions/manifest_handlers/exclude_matches_manifest_unittest.cc index 37a4ae5..b17040e 100644 --- a/chrome/common/extensions/manifest_handlers/exclude_matches_manifest_unittest.cc +++ b/chrome/common/extensions/manifest_handlers/exclude_matches_manifest_unittest.cc @@ -4,18 +4,12 @@ #include "chrome/common/extensions/extension.h" -#include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "testing/gtest/include/gtest/gtest.h" namespace extensions { class ExcludeMatchesManifestTest : public ExtensionManifestTest { - protected: - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new ContentScriptsHandler)->Register(); - } }; TEST_F(ExcludeMatchesManifestTest, ExcludeMatchPatterns) { diff --git a/chrome/common/extensions/manifest_handlers/externally_connectable_unittest.cc b/chrome/common/extensions/manifest_handlers/externally_connectable_unittest.cc index a611c10..db35640 100644 --- a/chrome/common/extensions/manifest_handlers/externally_connectable_unittest.cc +++ b/chrome/common/extensions/manifest_handlers/externally_connectable_unittest.cc @@ -22,12 +22,6 @@ class ExternallyConnectableTest : public ExtensionManifestTest { public: ExternallyConnectableTest() : channel_(chrome::VersionInfo::CHANNEL_DEV) {} - protected: - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new ExternallyConnectableHandler)->Register(); - } - private: Feature::ScopedCurrentChannel channel_; }; diff --git a/chrome/common/extensions/manifest_handlers/shared_module_manifest_unittest.cc b/chrome/common/extensions/manifest_handlers/shared_module_manifest_unittest.cc index b4eb0bd..d5ddea8 100644 --- a/chrome/common/extensions/manifest_handlers/shared_module_manifest_unittest.cc +++ b/chrome/common/extensions/manifest_handlers/shared_module_manifest_unittest.cc @@ -4,7 +4,6 @@ #include "base/version.h" #include "chrome/common/extensions/extension.h" -#include "chrome/common/extensions/extension_unittest.h" #include "chrome/common/extensions/manifest_handlers/shared_module_info.h" #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "testing/gtest/include/gtest/gtest.h" @@ -25,11 +24,6 @@ const char* kNoImport = "cccccccccccccccccccccccccccccccc"; namespace extensions { class SharedModuleManifestTest : public ExtensionManifestTest { - protected: - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new SharedModuleHandler)->Register(); - } }; TEST_F(SharedModuleManifestTest, ExportsAll) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifest_test.h b/chrome/common/extensions/manifest_tests/extension_manifest_test.h index 7db27cf..7b05fc1 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifest_test.h +++ b/chrome/common/extensions/manifest_tests/extension_manifest_test.h @@ -10,12 +10,11 @@ #include "base/values.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_manifest_constants.h" -#include "chrome/common/extensions/extension_unittest.h" #include "chrome/common/extensions/features/feature.h" #include "chrome/common/extensions/manifest.h" #include "testing/gtest/include/gtest/gtest.h" -class ExtensionManifestTest : public extensions::ExtensionTest { +class ExtensionManifestTest : public testing::Test { public: ExtensionManifestTest(); diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_background_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_background_unittest.cc index 3c9c032..26e9513 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_background_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_background_unittest.cc @@ -13,7 +13,6 @@ #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/features/base_feature_provider.h" #include "chrome/common/extensions/features/feature.h" -#include "chrome/common/extensions/manifest_handler.h" #include "extensions/common/error_utils.h" #include "testing/gtest/include/gtest/gtest.h" @@ -23,10 +22,6 @@ namespace keys = extension_manifest_keys; namespace extensions { class ExtensionManifestBackgroundTest : public ExtensionManifestTest { - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new BackgroundManifestHandler)->Register(); - } }; TEST_F(ExtensionManifestBackgroundTest, BackgroundPermission) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_contentsecuritypolicy_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_contentsecuritypolicy_unittest.cc index b6de930..4e54f4c 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_contentsecuritypolicy_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_contentsecuritypolicy_unittest.cc @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/csp_handler.h" -#include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "testing/gtest/include/gtest/gtest.h" @@ -11,10 +9,6 @@ namespace errors = extension_manifest_errors; class ContentSecurityPolicyManifestTest : public ExtensionManifestTest { - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new extensions::CSPHandler(false))->Register(); // not platform app. - } }; TEST_F(ContentSecurityPolicyManifestTest, InsecureContentSecurityPolicy) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_devtools_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_devtools_unittest.cc index d06413f..a9a67be 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_devtools_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_devtools_unittest.cc @@ -9,10 +9,6 @@ #include "testing/gtest/include/gtest/gtest.h" class DevToolsPageManifestTest : public ExtensionManifestTest { - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new extensions::DevToolsPageHandler)->Register(); - } }; TEST_F(DevToolsPageManifestTest, DevToolsExtensions) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc index 6308e2f..0b2c184 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc @@ -12,11 +12,6 @@ namespace errors = extension_manifest_errors; class HomepageURLManifestTest : public ExtensionManifestTest { - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new extensions::HomepageURLHandler)->Register(); - (new extensions::UpdateURLHandler)->Register(); - } }; TEST_F(HomepageURLManifestTest, ParseHomepageURLs) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_icons_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_icons_unittest.cc index 37a83c3..aac8860 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_icons_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_icons_unittest.cc @@ -13,11 +13,6 @@ namespace extensions { class IconsManifestTest : public ExtensionManifestTest { - protected: - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new IconsHandler)->Register(); - } }; TEST_F(IconsManifestTest, NormalizeIconPaths) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc index 22b8b2a..0b4af1f 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc @@ -6,13 +6,8 @@ #include "base/path_service.h" #include "base/utf_string_conversions.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/extensions/api/extension_action/page_action_handler.h" -#include "chrome/common/extensions/api/i18n/default_locale_handler.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_manifest_constants.h" -#include "chrome/common/extensions/manifest_handler.h" -#include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" -#include "chrome/common/extensions/manifest_handlers/icons_handler.h" #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "chrome/common/extensions/manifest_url_handler.h" #include "testing/gtest/include/gtest/gtest.h" @@ -28,15 +23,6 @@ namespace keys = extension_manifest_keys; namespace extensions { class InitValueManifestTest : public ExtensionManifestTest { - protected: - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new extensions::DefaultLocaleHandler)->Register(); - (new extensions::IconsHandler)->Register(); - (new extensions::OptionsPageHandler)->Register(); - (new extensions::PageActionHandler)->Register(); - (new extensions::ContentScriptsHandler)->Register(); - } }; TEST_F(InitValueManifestTest, InitFromValueInvalid) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_isolatedapp_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_isolatedapp_unittest.cc index 80bd8bb..d291558 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_isolatedapp_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_isolatedapp_unittest.cc @@ -16,11 +16,6 @@ namespace errors = extension_manifest_errors; namespace extensions { class IsolatedAppsManifestTest : public ExtensionManifestTest { - protected: - virtual void SetUp() OVERRIDE { - testing::Test::SetUp(); - (new AppIsolationHandler)->Register(); - } }; TEST_F(IsolatedAppsManifestTest, IsolatedApps) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_kiosk_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_kiosk_unittest.cc index 866c082..a9bbc40 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_kiosk_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_kiosk_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/background_info.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/manifest_handlers/kiosk_enabled_info.h" @@ -12,11 +11,6 @@ namespace extensions { class ExtensionManifestKioskEnabledTest : public ExtensionManifestTest { - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new BackgroundManifestHandler)->Register(); - (new KioskEnabledHandler)->Register(); - } }; TEST_F(ExtensionManifestKioskEnabledTest, InvalidKioskEnabled) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_offline_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_offline_unittest.cc index 8fc46bf..4fc698c 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_offline_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_offline_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/background_info.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/manifest_handlers/offline_enabled_info.h" @@ -14,11 +13,6 @@ namespace errors = extension_manifest_errors; namespace extensions { class ExtensionManifestOfflineEnabledTest : public ExtensionManifestTest { - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new OfflineEnabledHandler)->Register(); - (new BackgroundManifestHandler)->Register(); - } }; TEST_F(ExtensionManifestOfflineEnabledTest, OfflineEnabled) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_options_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_options_unittest.cc index 47fc916..9da54df 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_options_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_options_unittest.cc @@ -10,10 +10,6 @@ namespace errors = extension_manifest_errors; class OptionsPageManifestTest : public ExtensionManifestTest { - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new extensions::OptionsPageHandler)->Register(); - } }; TEST_F(OptionsPageManifestTest, OptionsPageInApps) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_override_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_override_unittest.cc index 78f077a..13fa6d8 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_override_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_override_unittest.cc @@ -10,10 +10,6 @@ namespace errors = extension_manifest_errors; class URLOverridesManifestTest : public ExtensionManifestTest { - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new extensions::URLOverridesHandler)->Register(); - } }; TEST_F(URLOverridesManifestTest, Override) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc index bb93903..62c1023 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc @@ -6,7 +6,6 @@ #include "base/json/json_file_value_serializer.h" #include "base/memory/linked_ptr.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/extensions/background_info.h" #include "chrome/common/extensions/csp_handler.h" #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/incognito_handler.h" @@ -19,14 +18,6 @@ namespace errors = extension_manifest_errors; namespace extensions { class PlatformAppsManifestTest : public ExtensionManifestTest { - protected: - virtual void SetUp() OVERRIDE { - testing::Test::SetUp(); - (new BackgroundManifestHandler)->Register(); - (new CSPHandler(true))->Register(); // platform app. - (new IncognitoHandler)->Register(); - (new AppIsolationHandler)->Register(); - } }; TEST_F(PlatformAppsManifestTest, PlatformApps) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_requirements_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_requirements_unittest.cc index defd8ee..b182059 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_requirements_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_requirements_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/api/plugins/plugins_handler.h" #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/manifest_handlers/requirements_handler.h" #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" @@ -14,12 +13,6 @@ namespace errors = extension_manifest_errors; namespace extensions { class RequirementsManifestTest : public ExtensionManifestTest { - protected: - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new PluginsHandler)->Register(); - (new RequirementsHandler)->Register(); - } }; TEST_F(RequirementsManifestTest, RequirementsInvalid) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_sandboxed_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_sandboxed_unittest.cc index 8c89c86..e6e2986 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_sandboxed_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_sandboxed_unittest.cc @@ -4,8 +4,6 @@ #include "chrome/common/extensions/csp_handler.h" #include "chrome/common/extensions/extension_manifest_constants.h" -#include "chrome/common/extensions/manifest_handler.h" -#include "chrome/common/extensions/manifest_handlers/sandboxed_page_info.h" #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "testing/gtest/include/gtest/gtest.h" @@ -14,12 +12,6 @@ namespace errors = extension_manifest_errors; namespace extensions { class SandboxedPagesManifestTest : public ExtensionManifestTest { - protected: - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new SandboxedPageHandler)->Register(); - (new CSPHandler(false))->Register(); // Not platform app. - } }; TEST_F(SandboxedPagesManifestTest, SandboxedPages) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_ui_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_ui_unittest.cc index 48381fc..785c81d9 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_ui_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_ui_unittest.cc @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/api/extension_action/browser_action_handler.h" -#include "chrome/common/extensions/api/extension_action/page_action_handler.h" #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "testing/gtest/include/gtest/gtest.h" @@ -11,11 +9,6 @@ namespace extensions { class UIManifestTest : public ExtensionManifestTest { - protected: - virtual void SetUp() OVERRIDE { - (new BrowserActionHandler)->Register(); - (new extensions::PageActionHandler)->Register(); - } }; TEST_F(UIManifestTest, DisallowMultipleUISurfaces) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_update_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_update_unittest.cc index 2eb3ffd..9c90292 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_update_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_update_unittest.cc @@ -12,10 +12,6 @@ using extensions::Extension; namespace errors = extension_manifest_errors; class UpdateURLManifestTest : public ExtensionManifestTest { - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new extensions::UpdateURLHandler)->Register(); - } }; TEST_F(UpdateURLManifestTest, UpdateUrls) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_web_accessible_resources_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_web_accessible_resources_unittest.cc index 692fc7f..98ee6aa 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_web_accessible_resources_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_web_accessible_resources_unittest.cc @@ -11,10 +11,6 @@ using extensions::Extension; using extensions::WebAccessibleResourcesInfo; class WebAccessibleResourcesManifestTest : public ExtensionManifestTest { - virtual void SetUp() OVERRIDE { - ExtensionManifestTest::SetUp(); - (new extensions::WebAccessibleResourcesHandler)->Register(); - } }; TEST_F(WebAccessibleResourcesManifestTest, WebAccessibleResources) { diff --git a/chrome/common/extensions/permissions/api_permission_set_unittest.cc b/chrome/common/extensions/permissions/api_permission_set_unittest.cc index 1b8f6c7..6ff579ac 100644 --- a/chrome/common/extensions/permissions/api_permission_set_unittest.cc +++ b/chrome/common/extensions/permissions/api_permission_set_unittest.cc @@ -5,17 +5,14 @@ #include "base/pickle.h" #include "base/values.h" #include "chrome/common/extensions/extension_messages.h" -#include "chrome/common/extensions/extension_unittest.h" #include "chrome/common/extensions/permissions/api_permission_set.h" +#include "chrome/common/extensions/permissions/permissions_info.h" #include "ipc/ipc_message.h" #include "testing/gtest/include/gtest/gtest.h" namespace extensions { -class APIPermissionSetTest : public ExtensionTest { -}; - -TEST_F(APIPermissionSetTest, General) { +TEST(APIPermissionSetTest, General) { APIPermissionSet apis; apis.insert(APIPermission::kTab); apis.insert(APIPermission::kBackground); @@ -35,7 +32,7 @@ TEST_F(APIPermissionSetTest, General) { EXPECT_EQ(apis.size(), 4u); } -TEST_F(APIPermissionSetTest, CreateUnion) { +TEST(APIPermissionSetTest, CreateUnion) { APIPermission* permission = NULL; APIPermissionSet apis1; @@ -123,7 +120,7 @@ TEST_F(APIPermissionSetTest, CreateUnion) { EXPECT_EQ(expected_apis, result); } -TEST_F(APIPermissionSetTest, CreateIntersection) { +TEST(APIPermissionSetTest, CreateIntersection) { APIPermission* permission = NULL; APIPermissionSet apis1; @@ -201,7 +198,7 @@ TEST_F(APIPermissionSetTest, CreateIntersection) { EXPECT_EQ(expected_apis, result); } -TEST_F(APIPermissionSetTest, CreateDifference) { +TEST(APIPermissionSetTest, CreateDifference) { APIPermission* permission = NULL; APIPermissionSet apis1; @@ -272,7 +269,7 @@ TEST_F(APIPermissionSetTest, CreateDifference) { EXPECT_TRUE(result2.empty()); } -TEST_F(APIPermissionSetTest, IPC) { +TEST(APIPermissionSetTest, IPC) { APIPermission* permission = NULL; APIPermissionSet apis; diff --git a/chrome/common/extensions/permissions/media_galleries_permission_unittest.cc b/chrome/common/extensions/permissions/media_galleries_permission_unittest.cc index 27ba20c..f743050 100644 --- a/chrome/common/extensions/permissions/media_galleries_permission_unittest.cc +++ b/chrome/common/extensions/permissions/media_galleries_permission_unittest.cc @@ -5,9 +5,10 @@ // These tests make sure MediaGalleriesPermission values are parsed correctly. #include "base/values.h" -#include "chrome/common/extensions/extension_unittest.h" +#include "chrome/common/extensions/permissions/api_permission.h" #include "chrome/common/extensions/permissions/media_galleries_permission.h" #include "chrome/common/extensions/permissions/media_galleries_permission_data.h" +#include "chrome/common/extensions/permissions/permissions_info.h" #include "testing/gtest/include/gtest/gtest.h" using content::SocketPermissionRequest; @@ -17,10 +18,7 @@ namespace extensions { namespace { -class MediaGalleriesPermissionTest : public ExtensionTest { -}; - -TEST_F(MediaGalleriesPermissionTest, GoodValues) { +TEST(MediaGalleriesPermissionTest, GoodValues) { const APIPermissionInfo* permission_info = PermissionsInfo::GetInstance()->GetByID(APIPermission::kMediaGalleries); @@ -50,7 +48,7 @@ TEST_F(MediaGalleriesPermissionTest, GoodValues) { EXPECT_TRUE(permission->FromValue(value.get())); } -TEST_F(MediaGalleriesPermissionTest, BadValues) { +TEST(MediaGalleriesPermissionTest, BadValues) { const APIPermissionInfo* permission_info = PermissionsInfo::GetInstance()->GetByID(APIPermission::kMediaGalleries); @@ -62,7 +60,7 @@ TEST_F(MediaGalleriesPermissionTest, BadValues) { EXPECT_FALSE(permission->FromValue(value.get())); } -TEST_F(MediaGalleriesPermissionTest, Equal) { +TEST(MediaGalleriesPermissionTest, Equal) { const APIPermissionInfo* permission_info = PermissionsInfo::GetInstance()->GetByID(APIPermission::kMediaGalleries); @@ -90,7 +88,7 @@ TEST_F(MediaGalleriesPermissionTest, Equal) { EXPECT_TRUE(permission1->Equal(permission2.get())); } -TEST_F(MediaGalleriesPermissionTest, ToFromValue) { +TEST(MediaGalleriesPermissionTest, ToFromValue) { const APIPermissionInfo* permission_info = PermissionsInfo::GetInstance()->GetByID(APIPermission::kMediaGalleries); diff --git a/chrome/common/extensions/permissions/permission_set_unittest.cc b/chrome/common/extensions/permissions/permission_set_unittest.cc index 6753020..15b887c 100644 --- a/chrome/common/extensions/permissions/permission_set_unittest.cc +++ b/chrome/common/extensions/permissions/permission_set_unittest.cc @@ -9,12 +9,9 @@ #include "base/utf_string_conversions.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/extensions/api/plugins/plugins_handler.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_test_util.h" -#include "chrome/common/extensions/extension_unittest.h" #include "chrome/common/extensions/features/feature.h" -#include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" #include "chrome/common/extensions/permissions/permission_set.h" #include "chrome/common/extensions/permissions/permissions_info.h" #include "chrome/common/extensions/permissions/socket_permission.h" @@ -49,21 +46,8 @@ bool Contains(const std::vector<string16>& warnings, } // namespace -class PermissionsTest : public ExtensionTest { - protected: - virtual void SetUp() OVERRIDE { - ExtensionTest::SetUp(); - (new ContentScriptsHandler)->Register(); - (new PluginsHandler)->Register(); - } - - virtual void TearDown() OVERRIDE { - ExtensionTest::TearDown(); - } -}; - // Tests GetByID. -TEST_F(PermissionsTest, GetByID) { +TEST(PermissionsTest, GetByID) { PermissionsInfo* info = PermissionsInfo::GetInstance(); APIPermissionSet apis = info->GetAll(); for (APIPermissionSet::const_iterator i = apis.begin(); @@ -73,7 +57,7 @@ TEST_F(PermissionsTest, GetByID) { } // Tests that GetByName works with normal permission names and aliases. -TEST_F(PermissionsTest, GetByName) { +TEST(PermissionsTest, GetByName) { PermissionsInfo* info = PermissionsInfo::GetInstance(); EXPECT_EQ(APIPermission::kTab, info->GetByName("tabs")->id()); EXPECT_EQ(APIPermission::kManagement, @@ -81,7 +65,7 @@ TEST_F(PermissionsTest, GetByName) { EXPECT_FALSE(info->GetByName("alsdkfjasldkfj")); } -TEST_F(PermissionsTest, GetAll) { +TEST(PermissionsTest, GetAll) { size_t count = 0; PermissionsInfo* info = PermissionsInfo::GetInstance(); APIPermissionSet apis = info->GetAll(); @@ -95,7 +79,7 @@ TEST_F(PermissionsTest, GetAll) { EXPECT_EQ(count, info->get_permission_count()); } -TEST_F(PermissionsTest, GetAllByName) { +TEST(PermissionsTest, GetAllByName) { std::set<std::string> names; names.insert("background"); names.insert("management"); @@ -116,7 +100,7 @@ TEST_F(PermissionsTest, GetAllByName) { } // Tests that the aliases are properly mapped. -TEST_F(PermissionsTest, Aliases) { +TEST(PermissionsTest, Aliases) { PermissionsInfo* info = PermissionsInfo::GetInstance(); // tabs: tabs, windows std::string tabs_name = "tabs"; @@ -134,7 +118,7 @@ TEST_F(PermissionsTest, Aliases) { info->GetByName("unlimited_storage")->id()); } -TEST_F(PermissionsTest, EffectiveHostPermissions) { +TEST(PermissionsTest, EffectiveHostPermissions) { scoped_refptr<Extension> extension; scoped_refptr<const PermissionSet> permissions; @@ -210,7 +194,7 @@ TEST_F(PermissionsTest, EffectiveHostPermissions) { EXPECT_TRUE(permissions->HasEffectiveAccessToAllHosts()); } -TEST_F(PermissionsTest, ExplicitAccessToOrigin) { +TEST(PermissionsTest, ExplicitAccessToOrigin) { APIPermissionSet apis; URLPatternSet explicit_hosts; URLPatternSet scriptable_hosts; @@ -233,7 +217,7 @@ TEST_F(PermissionsTest, ExplicitAccessToOrigin) { GURL("http://test.example.com"))); } -TEST_F(PermissionsTest, CreateUnion) { +TEST(PermissionsTest, CreateUnion) { APIPermission* permission = NULL; APIPermissionSet apis1; @@ -357,7 +341,7 @@ TEST_F(PermissionsTest, CreateUnion) { EXPECT_EQ(effective_hosts, union_set->effective_hosts()); } -TEST_F(PermissionsTest, CreateIntersection) { +TEST(PermissionsTest, CreateIntersection) { APIPermission* permission = NULL; APIPermissionSet apis1; @@ -471,7 +455,7 @@ TEST_F(PermissionsTest, CreateIntersection) { EXPECT_EQ(effective_hosts, new_set->effective_hosts()); } -TEST_F(PermissionsTest, CreateDifference) { +TEST(PermissionsTest, CreateDifference) { APIPermission* permission = NULL; APIPermissionSet apis1; @@ -572,7 +556,7 @@ TEST_F(PermissionsTest, CreateDifference) { EXPECT_TRUE(set1->IsEmpty()); } -TEST_F(PermissionsTest, HasLessPrivilegesThan) { +TEST(PermissionsTest, HasLessPrivilegesThan) { const struct { const char* base_name; bool expect_increase; @@ -623,7 +607,7 @@ TEST_F(PermissionsTest, HasLessPrivilegesThan) { } } -TEST_F(PermissionsTest, PermissionMessages) { +TEST(PermissionsTest, PermissionMessages) { // Ensure that all permissions that needs to show install UI actually have // strings associated with them. APIPermissionSet skip; @@ -748,7 +732,7 @@ TEST_F(PermissionsTest, PermissionMessages) { } // Tests the default permissions (empty API permission set). -TEST_F(PermissionsTest, DefaultFunctionAccess) { +TEST(PermissionsTest, DefaultFunctionAccess) { const struct { const char* permission_name; bool expect_success; @@ -787,7 +771,7 @@ TEST_F(PermissionsTest, DefaultFunctionAccess) { } // Tests the default permissions (empty API permission set). -TEST_F(PermissionsTest, DefaultAnyAPIAccess) { +TEST(PermissionsTest, DefaultAnyAPIAccess) { const struct { const char* api_name; bool expect_success; @@ -818,7 +802,7 @@ TEST_F(PermissionsTest, DefaultAnyAPIAccess) { } } -TEST_F(PermissionsTest, GetWarningMessages_ManyHosts) { +TEST(PermissionsTest, GetWarningMessages_ManyHosts) { scoped_refptr<Extension> extension; extension = LoadManifest("permissions", "many-hosts.json"); @@ -828,7 +812,7 @@ TEST_F(PermissionsTest, GetWarningMessages_ManyHosts) { UTF16ToUTF8(warnings[0])); } -TEST_F(PermissionsTest, GetWarningMessages_Plugins) { +TEST(PermissionsTest, GetWarningMessages_Plugins) { scoped_refptr<Extension> extension; scoped_refptr<PermissionSet> permissions; @@ -845,7 +829,7 @@ TEST_F(PermissionsTest, GetWarningMessages_Plugins) { #endif } -TEST_F(PermissionsTest, GetWarningMessages_AudioVideo) { +TEST(PermissionsTest, GetWarningMessages_AudioVideo) { // Both audio and video present. scoped_refptr<Extension> extension = LoadManifest("permissions", "audio-video.json"); @@ -878,7 +862,7 @@ TEST_F(PermissionsTest, GetWarningMessages_AudioVideo) { EXPECT_TRUE(Contains(warnings, "Use your camera")); } -TEST_F(PermissionsTest, GetWarningMessages_Serial) { +TEST(PermissionsTest, GetWarningMessages_Serial) { scoped_refptr<Extension> extension = LoadManifest("permissions", "serial.json"); @@ -890,7 +874,7 @@ TEST_F(PermissionsTest, GetWarningMessages_Serial) { ASSERT_EQ(1u, warnings.size()); } -TEST_F(PermissionsTest, GetWarningMessages_Socket_AnyHost) { +TEST(PermissionsTest, GetWarningMessages_Socket_AnyHost) { Feature::ScopedCurrentChannel channel(chrome::VersionInfo::CHANNEL_DEV); scoped_refptr<Extension> extension = @@ -903,7 +887,7 @@ TEST_F(PermissionsTest, GetWarningMessages_Socket_AnyHost) { "on the local network or internet")); } -TEST_F(PermissionsTest, GetWarningMessages_Socket_OneDomainTwoHostnames) { +TEST(PermissionsTest, GetWarningMessages_Socket_OneDomainTwoHostnames) { Feature::ScopedCurrentChannel channel(chrome::VersionInfo::CHANNEL_DEV); scoped_refptr<Extension> extension = @@ -928,7 +912,7 @@ TEST_F(PermissionsTest, GetWarningMessages_Socket_OneDomainTwoHostnames) { // "\xC3\xA5" = UTF-8 for lowercase A with ring above } -TEST_F(PermissionsTest, GetWarningMessages_Socket_TwoDomainsOneHostname) { +TEST(PermissionsTest, GetWarningMessages_Socket_TwoDomainsOneHostname) { Feature::ScopedCurrentChannel channel(chrome::VersionInfo::CHANNEL_DEV); scoped_refptr<Extension> extension = @@ -951,7 +935,7 @@ TEST_F(PermissionsTest, GetWarningMessages_Socket_TwoDomainsOneHostname) { "bar.example.org")); } -TEST_F(PermissionsTest, GetWarningMessages_PlatformApppHosts) { +TEST(PermissionsTest, GetWarningMessages_PlatformApppHosts) { scoped_refptr<Extension> extension; extension = LoadManifest("permissions", "platform_app_hosts.json"); @@ -965,7 +949,7 @@ TEST_F(PermissionsTest, GetWarningMessages_PlatformApppHosts) { ASSERT_EQ(0u, warnings.size()); } -TEST_F(PermissionsTest, GetDistinctHostsForDisplay) { +TEST(PermissionsTest, GetDistinctHostsForDisplay) { scoped_refptr<PermissionSet> perm_set; APIPermissionSet empty_perms; std::set<std::string> expected; @@ -1121,7 +1105,7 @@ TEST_F(PermissionsTest, GetDistinctHostsForDisplay) { } } -TEST_F(PermissionsTest, GetDistinctHostsForDisplay_ComIsBestRcd) { +TEST(PermissionsTest, GetDistinctHostsForDisplay_ComIsBestRcd) { scoped_refptr<PermissionSet> perm_set; APIPermissionSet empty_perms; URLPatternSet explicit_hosts; @@ -1146,7 +1130,7 @@ TEST_F(PermissionsTest, GetDistinctHostsForDisplay_ComIsBestRcd) { EXPECT_EQ(expected, perm_set->GetDistinctHostsForDisplay()); } -TEST_F(PermissionsTest, GetDistinctHostsForDisplay_NetIs2ndBestRcd) { +TEST(PermissionsTest, GetDistinctHostsForDisplay_NetIs2ndBestRcd) { scoped_refptr<PermissionSet> perm_set; APIPermissionSet empty_perms; URLPatternSet explicit_hosts; @@ -1170,7 +1154,7 @@ TEST_F(PermissionsTest, GetDistinctHostsForDisplay_NetIs2ndBestRcd) { EXPECT_EQ(expected, perm_set->GetDistinctHostsForDisplay()); } -TEST_F(PermissionsTest, +TEST(PermissionsTest, GetDistinctHostsForDisplay_OrgIs3rdBestRcd) { scoped_refptr<PermissionSet> perm_set; APIPermissionSet empty_perms; @@ -1194,7 +1178,7 @@ TEST_F(PermissionsTest, EXPECT_EQ(expected, perm_set->GetDistinctHostsForDisplay()); } -TEST_F(PermissionsTest, +TEST(PermissionsTest, GetDistinctHostsForDisplay_FirstInListIs4thBestRcd) { scoped_refptr<PermissionSet> perm_set; APIPermissionSet empty_perms; @@ -1217,7 +1201,7 @@ TEST_F(PermissionsTest, EXPECT_EQ(expected, perm_set->GetDistinctHostsForDisplay()); } -TEST_F(PermissionsTest, HasLessHostPrivilegesThan) { +TEST(PermissionsTest, HasLessHostPrivilegesThan) { URLPatternSet elist1; URLPatternSet elist2; URLPatternSet slist1; @@ -1286,7 +1270,7 @@ TEST_F(PermissionsTest, HasLessHostPrivilegesThan) { EXPECT_TRUE(set2->HasLessHostPrivilegesThan(set1.get())); } -TEST_F(PermissionsTest, GetAPIsAsStrings) { +TEST(PermissionsTest, GetAPIsAsStrings) { APIPermissionSet apis; URLPatternSet empty_set; @@ -1306,7 +1290,7 @@ TEST_F(PermissionsTest, GetAPIsAsStrings) { PermissionsInfo::GetInstance()->GetAllByName(api_names)); } -TEST_F(PermissionsTest, IsEmpty) { +TEST(PermissionsTest, IsEmpty) { APIPermissionSet empty_apis; URLPatternSet empty_extent; @@ -1336,7 +1320,7 @@ TEST_F(PermissionsTest, IsEmpty) { EXPECT_FALSE(perm_set->IsEmpty()); } -TEST_F(PermissionsTest, ImpliedPermissions) { +TEST(PermissionsTest, ImpliedPermissions) { URLPatternSet empty_extent; APIPermissionSet apis; apis.insert(APIPermission::kWebRequest); @@ -1348,7 +1332,7 @@ TEST_F(PermissionsTest, ImpliedPermissions) { EXPECT_EQ(4U, perm_set->apis().size()); } -TEST_F(PermissionsTest, SyncFileSystemPermission) { +TEST(PermissionsTest, SyncFileSystemPermission) { scoped_refptr<Extension> extension = LoadManifest( "permissions", "sync_file_system.json"); APIPermissionSet apis; diff --git a/chrome/common/extensions/permissions/socket_permission_unittest.cc b/chrome/common/extensions/permissions/socket_permission_unittest.cc index b04c3df..1fe5635 100644 --- a/chrome/common/extensions/permissions/socket_permission_unittest.cc +++ b/chrome/common/extensions/permissions/socket_permission_unittest.cc @@ -6,7 +6,7 @@ #include "base/pickle.h" #include "base/values.h" -#include "chrome/common/extensions/extension_unittest.h" +#include "chrome/common/extensions/permissions/permissions_info.h" #include "chrome/common/extensions/permissions/socket_permission.h" #include "chrome/common/extensions/permissions/socket_permission_data.h" #include "ipc/ipc_message.h" @@ -26,10 +26,7 @@ void ParseTest(const std::string& permission, EXPECT_EQ(expected_result, data.GetAsStringForTest()); } -class SocketPermissionTest : public ExtensionTest { -}; - -TEST_F(SocketPermissionTest, General) { +TEST(SocketPermissionTest, General) { SocketPermissionData data1, data2; CHECK(data1.ParseForTest("tcp-connect")); @@ -45,7 +42,7 @@ TEST_F(SocketPermissionTest, General) { EXPECT_TRUE(data1 < data2); } -TEST_F(SocketPermissionTest, Parse) { +TEST(SocketPermissionTest, Parse) { SocketPermissionData data; EXPECT_FALSE(data.ParseForTest(std::string())); @@ -119,7 +116,7 @@ TEST_F(SocketPermissionTest, Parse) { ParseTest("tcp-connect:*.example.com:99", "tcp-connect:*.example.com:99"); } -TEST_F(SocketPermissionTest, Match) { +TEST(SocketPermissionTest, Match) { SocketPermissionData data; scoped_ptr<SocketPermission::CheckParam> param; @@ -219,7 +216,7 @@ TEST_F(SocketPermissionTest, Match) { EXPECT_TRUE(data.Check(param.get())); } -TEST_F(SocketPermissionTest, IPC) { +TEST(SocketPermissionTest, IPC) { const APIPermissionInfo* permission_info = PermissionsInfo::GetInstance()->GetByID(APIPermission::kSocket); @@ -261,7 +258,7 @@ TEST_F(SocketPermissionTest, IPC) { } } -TEST_F(SocketPermissionTest, Value) { +TEST(SocketPermissionTest, Value) { const APIPermissionInfo* permission_info = PermissionsInfo::GetInstance()->GetByID(APIPermission::kSocket); diff --git a/chrome/common/extensions/unpacker_unittest.cc b/chrome/common/extensions/unpacker_unittest.cc index b13ec66..39a02be 100644 --- a/chrome/common/extensions/unpacker_unittest.cc +++ b/chrome/common/extensions/unpacker_unittest.cc @@ -9,12 +9,9 @@ #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/extensions/api/i18n/default_locale_handler.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_manifest_constants.h" -#include "chrome/common/extensions/manifest_handler.h" -#include "chrome/common/extensions/manifest_handlers/theme_handler.h" #include "chrome/common/extensions/unpacker.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -33,16 +30,6 @@ public: LOG(WARNING) << temp_dir_.Delete(); } - virtual void SetUp() OVERRIDE { - testing::Test::SetUp(); - (new DefaultLocaleHandler)->Register(); - (new ThemeHandler)->Register(); - } - - virtual void TearDown() OVERRIDE { - ManifestHandler::ClearRegistryForTesting(); - } - void SetupUnpacker(const std::string& crx_name) { base::FilePath original_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &original_path)); diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index 0439f8c..779c94c 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -16,21 +16,13 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/content_settings_pattern.h" -#include "chrome/common/extensions/api/extension_action/page_action_handler.h" -#include "chrome/common/extensions/background_info.h" -#include "chrome/common/extensions/csp_handler.h" +#include "chrome/common/extensions/chrome_manifest_handlers.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/extension_process_policy.h" #include "chrome/common/extensions/extension_set.h" -#include "chrome/common/extensions/incognito_handler.h" -#include "chrome/common/extensions/manifest_handler.h" -#include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" -#include "chrome/common/extensions/manifest_handlers/sandboxed_page_info.h" -#include "chrome/common/extensions/manifest_url_handler.h" #include "chrome/common/extensions/permissions/chrome_api_permissions.h" -#include "chrome/common/extensions/web_accessible_resources_handler.h" #include "chrome/common/external_ipc_fuzzer.h" #include "chrome/common/localized_error.h" #include "chrome/common/render_messages.h" @@ -140,20 +132,6 @@ const char kAdViewTagName[] = "ADVIEW"; chrome::ChromeContentRendererClient* g_current_client; -// Explicitly register all extension ManifestHandlers needed to parse -// fields used in the renderer. -void RegisterExtensionManifestHandlers() { - (new extensions::AppIsolationHandler)->Register(); - (new extensions::BackgroundManifestHandler)->Register(); - (new extensions::CSPHandler(false))->Register(); // not platform app. - (new extensions::CSPHandler(true))->Register(); // platform app. - (new extensions::DevToolsPageHandler)->Register(); - (new extensions::IncognitoHandler)->Register(); - (new extensions::PageActionHandler)->Register(); - (new extensions::SandboxedPageHandler)->Register(); - (new extensions::WebAccessibleResourcesHandler)->Register(); -} - static void AppendParams(const std::vector<string16>& additional_names, const std::vector<string16>& additional_values, WebVector<WebString>* existing_names, @@ -332,10 +310,9 @@ void ChromeContentRendererClient::RenderThreadStarted() { WebSecurityPolicy::registerURLSchemeAsBypassingContentSecurityPolicy( extension_resource_scheme); - extensions::ChromeAPIPermissions permissions; extensions::PermissionsInfo::GetInstance()->InitializeWithDelegate( - permissions); - RegisterExtensionManifestHandlers(); + extensions::ChromeAPIPermissions()); + extensions::RegisterChromeManifestHandlers(); } void ChromeContentRendererClient::RenderViewCreated( diff --git a/chrome/test/base/chrome_test_suite.cc b/chrome/test/base/chrome_test_suite.cc index 24313a5..9a858103 100644 --- a/chrome/test/base/chrome_test_suite.cc +++ b/chrome/test/base/chrome_test_suite.cc @@ -23,6 +23,8 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_content_client.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/extensions/chrome_manifest_handlers.h" +#include "chrome/common/extensions/permissions/chrome_api_permissions.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/testing_browser_process.h" #include "content/public/test/test_launcher.h" @@ -226,10 +228,15 @@ void ChromeTestSuite::Initialize() { #if !defined(OS_IOS) extensions::RegisterPathProvider(); + // Only want to do this for unit tests. if (!content::GetCurrentTestLauncherDelegate()) { - // Only want to do this for unit tests. For browser tests, this won't create - // the right object since TestChromeWebUIControllerFactory is used. That's - // created and registered in ChromeBrowserMainParts as in normal startup. + extensions::PermissionsInfo::GetInstance()->InitializeWithDelegate( + extensions::ChromeAPIPermissions()); + extensions::RegisterChromeManifestHandlers(); + + // For browser tests, this won't create the right object since + // TestChromeWebUIControllerFactory is used. That's created and + // registered in ChromeBrowserMainParts as in normal startup. content::WebUIControllerFactory::RegisterFactory( ChromeWebUIControllerFactory::GetInstance()); } diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc index 46a6c0e..a5c0605 100644 --- a/chrome/utility/chrome_content_utility_client.cc +++ b/chrome/utility/chrome_content_utility_client.cc @@ -17,17 +17,10 @@ #include "chrome/common/child_process_logging.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_utility_messages.h" -#include "chrome/common/extensions/api/extension_action/browser_action_handler.h" -#include "chrome/common/extensions/api/extension_action/page_action_handler.h" -#include "chrome/common/extensions/api/i18n/default_locale_handler.h" -#include "chrome/common/extensions/api/plugins/plugins_handler.h" -#include "chrome/common/extensions/background_info.h" +#include "chrome/common/extensions/chrome_manifest_handlers.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_l10n_util.h" -#include "chrome/common/extensions/incognito_handler.h" #include "chrome/common/extensions/manifest.h" -#include "chrome/common/extensions/manifest_handlers/icons_handler.h" -#include "chrome/common/extensions/manifest_handlers/theme_handler.h" #include "chrome/common/extensions/permissions/chrome_api_permissions.h" #include "chrome/common/extensions/unpacker.h" #include "chrome/common/extensions/update_manifest.h" @@ -53,22 +46,6 @@ #include "ui/gfx/gdi_util.h" #endif // defined(OS_WIN) -namespace { - -// Explicitly register all ManifestHandlers needed in the utility process. -void RegisterExtensionManifestHandlers() { - (new extensions::BackgroundManifestHandler)->Register(); - (new extensions::BrowserActionHandler)->Register(); - (new extensions::DefaultLocaleHandler)->Register(); - (new extensions::IconsHandler)->Register(); - (new extensions::IncognitoHandler)->Register(); - (new extensions::PageActionHandler)->Register(); - (new extensions::PluginsHandler)->Register(); - (new extensions::ThemeHandler)->Register(); -} - -} // namespace - namespace chrome { ChromeContentUtilityClient::ChromeContentUtilityClient() { @@ -146,10 +123,9 @@ void ChromeContentUtilityClient::OnUnpackExtension( int creation_flags) { CHECK(location > extensions::Manifest::INVALID_LOCATION); CHECK(location < extensions::Manifest::NUM_LOCATIONS); - extensions::ChromeAPIPermissions permissions; extensions::PermissionsInfo::GetInstance()->InitializeWithDelegate( - permissions); - RegisterExtensionManifestHandlers(); + extensions::ChromeAPIPermissions()); + extensions::RegisterChromeManifestHandlers(); extensions::Unpacker unpacker( extension_path, extension_id, |