diff options
author | jamescook <jamescook@chromium.org> | 2014-09-16 10:02:08 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-16 17:03:09 +0000 |
commit | bd1cc624f6fd9761409ee8a8ac5cfd3a5896c87a (patch) | |
tree | 4efb6754a787762a7a8677af63dd21fee160e36d | |
parent | d575eafb4f112ed0c0f4be8cf58dfb8f71d4a142 (diff) | |
download | chromium_src-bd1cc624f6fd9761409ee8a8ac5cfd3a5896c87a.zip chromium_src-bd1cc624f6fd9761409ee8a8ac5cfd3a5896c87a.tar.gz chromium_src-bd1cc624f6fd9761409ee8a8ac5cfd3a5896c87a.tar.bz2 |
Refactor ExtensionManifestTest to allow usage in src/extensions
This refactor will allow some manifest tests running in Chrome's unit_tests
suite to move to the extensions_unittests suite.
* Rename ExtensionManifestTest to extensions::ManifestTest and move it into
src/extensions.
* Introduce ChromeManifestTest to load manifests from Chrome's test data dir.
* Eliminate some unnecessary use of chrome::VersionInfo::Channel.
* Move SharedModuleManifestTest to extensions_unittests as an example.
FileHandlerManifestTest and ExternallyConnectableManifestTest will be next,
but require more refactoring (e.g. of permissions).
BUG=397165
TEST=unit_tests, extensions_unittests
Review URL: https://codereview.chromium.org/572813002
Cr-Commit-Position: refs/heads/master@{#295087}
70 files changed, 297 insertions, 296 deletions
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 317c95f..473c348 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,7 @@ #include "base/strings/string_number_conversions.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/manifest_handlers/mime_types_handler.h" -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "chrome/common/extensions/manifest_url_handler.h" #include "extensions/common/error_utils.h" #include "extensions/common/extension_builder.h" @@ -22,7 +22,7 @@ using extensions::ListBuilder; namespace { -class StreamsPrivateManifestTest : public ExtensionManifestTest { +class StreamsPrivateManifestTest : public ChromeManifestTest { }; TEST_F(StreamsPrivateManifestTest, ValidMimeTypesHandlerMIMETypes) { diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index eb7773a..14e4eb6 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -19,7 +19,6 @@ '../extensions/common/file_util_unittest.cc', '../extensions/common/manifest_handlers/externally_connectable_unittest.cc', '../extensions/common/manifest_handlers/file_handler_manifest_unittest.cc', - '../extensions/common/manifest_handlers/shared_module_manifest_unittest.cc', # histograms.xml is analyzed by AboutFlagsHistogramTest, so this # dependency is needed to make commit bots run unit_tests on # histograms.xml changes. @@ -1278,7 +1277,8 @@ 'common/extensions/manifest_handlers/exclude_matches_manifest_unittest.cc', 'common/extensions/manifest_handlers/settings_overrides_handler_unittest.cc', 'common/extensions/manifest_handlers/ui_overrides_handler_unittest.cc', - 'common/extensions/manifest_tests/extension_manifest_test.cc', + 'common/extensions/manifest_tests/chrome_manifest_test.cc', + 'common/extensions/manifest_tests/chrome_manifest_test.h', 'common/extensions/manifest_tests/extension_manifests_about_unittest.cc', 'common/extensions/manifest_tests/extension_manifests_background_unittest.cc', 'common/extensions/manifest_tests/extension_manifests_chromepermission_unittest.cc', diff --git a/chrome/common/extensions/api/commands/commands_manifest_unittest.cc b/chrome/common/extensions/api/commands/commands_manifest_unittest.cc index bb87595..022d149 100644 --- a/chrome/common/extensions/api/commands/commands_manifest_unittest.cc +++ b/chrome/common/extensions/api/commands/commands_manifest_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "base/command_line.h" #include "base/strings/string_util.h" @@ -17,7 +17,7 @@ namespace extensions { namespace errors = manifest_errors; -class CommandsManifestTest : public ExtensionManifestTest { +class CommandsManifestTest : public ChromeManifestTest { }; TEST_F(CommandsManifestTest, CommandManifestSimple) { 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 f69ae14..98544f8 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,7 @@ // found in the LICENSE file. #include "chrome/common/extensions/api/extension_action/action_info.h" -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/error_utils.h" #include "extensions/common/extension_builder.h" #include "extensions/common/extension_icon_set.h" @@ -17,7 +17,7 @@ namespace errors = manifest_errors; namespace { -class BrowserActionManifestTest : public ExtensionManifestTest { +class BrowserActionManifestTest : public ChromeManifestTest { }; TEST_F(BrowserActionManifestTest, @@ -105,7 +105,7 @@ TEST_F(BrowserActionManifestTest, base::string16 error = ErrorUtils::FormatErrorMessageUTF16( errors::kInvalidIconPath, "19"); - LoadAndExpectError(Manifest(manifest_value.get(), "Invalid default icon"), + LoadAndExpectError(ManifestData(manifest_value.get(), "Invalid default icon"), errors::kInvalidIconPath); } 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 7cbf241..51a5b4f 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 @@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/path_service.h" +#include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/api/extension_action/action_info.h" -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/constants.h" #include "extensions/common/error_utils.h" #include "extensions/common/extension.h" @@ -15,10 +17,12 @@ namespace extensions { namespace errors = manifest_errors; namespace keys = manifest_keys; -class PageActionManifestTest : public ExtensionManifestTest { +class PageActionManifestTest : public ChromeManifestTest { protected: - virtual const char* test_data_dir() OVERRIDE { - return "page_action"; + virtual base::FilePath GetTestDataDir() OVERRIDE { + base::FilePath path; + PathService::Get(chrome::DIR_TEST_DATA, &path); + return path.AppendASCII("extensions").AppendASCII("page_action"); } scoped_ptr<ActionInfo> LoadAction(const std::string& manifest_filename); diff --git a/chrome/common/extensions/api/file_browser_handlers/file_browser_handler_manifest_unittest.cc b/chrome/common/extensions/api/file_browser_handlers/file_browser_handler_manifest_unittest.cc index 16e669e..d829eaf 100644 --- a/chrome/common/extensions/api/file_browser_handlers/file_browser_handler_manifest_unittest.cc +++ b/chrome/common/extensions/api/file_browser_handlers/file_browser_handler_manifest_unittest.cc @@ -5,7 +5,7 @@ #include "base/strings/string_number_conversions.h" #include "chrome/common/extensions/api/file_browser_handlers/file_browser_handler.h" #include "chrome/common/extensions/extension_constants.h" -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/error_utils.h" #include "extensions/common/extension_builder.h" #include "extensions/common/manifest_constants.h" @@ -21,7 +21,7 @@ using extensions::ListBuilder; namespace { -class FileBrowserHandlerManifestTest : public ExtensionManifestTest { +class FileBrowserHandlerManifestTest : public ChromeManifestTest { }; TEST_F(FileBrowserHandlerManifestTest, InvalidFileBrowserHandlers) { 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 56bbb53..351b094 100644 --- a/chrome/common/extensions/api/i18n/default_locale_manifest_unittest.cc +++ b/chrome/common/extensions/api/i18n/default_locale_manifest_unittest.cc @@ -3,13 +3,13 @@ // found in the LICENSE file. #include "chrome/common/extensions/api/i18n/default_locale_handler.h" -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/manifest_constants.h" #include "testing/gtest/include/gtest/gtest.h" namespace extensions { -class DefaultLocaleManifestTest : public ExtensionManifestTest { +class DefaultLocaleManifestTest : public ChromeManifestTest { }; 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 ae383d8..0606c32 100644 --- a/chrome/common/extensions/api/identity/extension_manifests_auth_unittest.cc +++ b/chrome/common/extensions/api/identity/extension_manifests_auth_unittest.cc @@ -4,7 +4,7 @@ #include "base/test/values_test_util.h" #include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h" -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/manifest_constants.h" #include "testing/gtest/include/gtest/gtest.h" @@ -25,7 +25,7 @@ const char kAutoApproveNotAllowedWarning[] = } // namespace -class OAuth2ManifestTest : public ExtensionManifestTest { +class OAuth2ManifestTest : public ChromeManifestTest { protected: enum AutoApproveValue { AUTO_APPROVE_NOT_SET, @@ -107,7 +107,7 @@ TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) { ext_manifest.SetString(keys::kKey, kExtensionKey); ext_manifest.SetBoolean(keys::kOAuth2AutoApprove, true); - Manifest manifest(&ext_manifest, "test"); + ManifestData manifest(&ext_manifest, "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_TRUE(extension->install_warnings().empty()); @@ -124,7 +124,7 @@ TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) { app_manifest.SetString(keys::kLaunchLocalPath, "launch.html"); app_manifest.MergeDictionary(&base_manifest); - Manifest manifest(&app_manifest, "test"); + ManifestData manifest(&app_manifest, "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_TRUE(extension->install_warnings().empty()); @@ -141,7 +141,7 @@ TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) { app_manifest.SetString(keys::kLaunchWebURL, "http://www.google.com"); app_manifest.MergeDictionary(&base_manifest); - Manifest manifest(&app_manifest, "test"); + ManifestData manifest(&app_manifest, "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_EQ(1U, extension->install_warnings().size()); @@ -159,7 +159,7 @@ TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) { TEST_F(OAuth2ManifestTest, AutoApproveNotSetExtensionNotOnWhitelist) { base::DictionaryValue* ext_manifest = CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_DEFAULT); - Manifest manifest(ext_manifest, "test"); + ManifestData manifest(ext_manifest, "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_TRUE(extension->install_warnings().empty()); @@ -169,7 +169,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveNotSetExtensionNotOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveFalseExtensionNotOnWhitelist) { base::DictionaryValue* ext_manifest = CreateManifest(AUTO_APPROVE_FALSE, false, CLIENT_ID_DEFAULT); - Manifest manifest(ext_manifest, "test"); + ManifestData manifest(ext_manifest, "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_EQ(1U, extension->install_warnings().size()); @@ -182,7 +182,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveFalseExtensionNotOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveTrueExtensionNotOnWhitelist) { base::DictionaryValue* ext_manifest = CreateManifest(AUTO_APPROVE_TRUE, false, CLIENT_ID_DEFAULT); - Manifest manifest(ext_manifest, "test"); + ManifestData manifest(ext_manifest, "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_EQ(1U, extension->install_warnings().size()); @@ -195,7 +195,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveTrueExtensionNotOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveInvalidExtensionNotOnWhitelist) { base::DictionaryValue* ext_manifest = CreateManifest(AUTO_APPROVE_INVALID, false, CLIENT_ID_DEFAULT); - Manifest manifest(ext_manifest, "test"); + ManifestData manifest(ext_manifest, "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_EQ(1U, extension->install_warnings().size()); @@ -208,7 +208,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveInvalidExtensionNotOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveNotSetExtensionOnWhitelist) { base::DictionaryValue* ext_manifest = CreateManifest(AUTO_APPROVE_NOT_SET, true, CLIENT_ID_DEFAULT); - Manifest manifest(ext_manifest, "test"); + ManifestData manifest(ext_manifest, "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_TRUE(extension->install_warnings().empty()); @@ -218,7 +218,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveNotSetExtensionOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveFalseExtensionOnWhitelist) { base::DictionaryValue* ext_manifest = CreateManifest(AUTO_APPROVE_FALSE, true, CLIENT_ID_DEFAULT); - Manifest manifest(ext_manifest, "test"); + ManifestData manifest(ext_manifest, "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_TRUE(extension->install_warnings().empty()); @@ -228,7 +228,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveFalseExtensionOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveTrueExtensionOnWhitelist) { base::DictionaryValue* ext_manifest = CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_DEFAULT); - Manifest manifest(ext_manifest, "test"); + ManifestData manifest(ext_manifest, "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_TRUE(extension->install_warnings().empty()); @@ -238,7 +238,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveTrueExtensionOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveInvalidExtensionOnWhitelist) { base::DictionaryValue* ext_manifest = CreateManifest(AUTO_APPROVE_INVALID, true, CLIENT_ID_DEFAULT); - Manifest manifest(ext_manifest, "test"); + ManifestData manifest(ext_manifest, "test"); std::string error; scoped_refptr<extensions::Extension> extension = LoadExtension(manifest, &error); @@ -251,7 +251,7 @@ TEST_F(OAuth2ManifestTest, InvalidClientId) { { base::DictionaryValue* ext_manifest = CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_NOT_SET); - Manifest manifest(ext_manifest, "test"); + ManifestData manifest(ext_manifest, "test"); std::string error; LoadAndExpectError(manifest, errors::kInvalidOAuth2ClientId); } @@ -259,7 +259,7 @@ TEST_F(OAuth2ManifestTest, InvalidClientId) { { base::DictionaryValue* ext_manifest = CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_EMPTY); - Manifest manifest(ext_manifest, "test"); + ManifestData manifest(ext_manifest, "test"); std::string error; LoadAndExpectError(manifest, errors::kInvalidOAuth2ClientId); } @@ -270,7 +270,7 @@ TEST_F(OAuth2ManifestTest, ComponentInvalidClientId) { { base::DictionaryValue* ext_manifest = CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_NOT_SET); - Manifest manifest(ext_manifest, "test"); + ManifestData manifest(ext_manifest, "test"); std::string error; LoadAndExpectError(manifest, errors::kInvalidOAuth2ClientId, @@ -280,7 +280,7 @@ TEST_F(OAuth2ManifestTest, ComponentInvalidClientId) { { base::DictionaryValue* ext_manifest = CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_EMPTY); - Manifest manifest(ext_manifest, "test"); + ManifestData manifest(ext_manifest, "test"); std::string error; LoadAndExpectError(manifest, errors::kInvalidOAuth2ClientId, @@ -292,7 +292,7 @@ TEST_F(OAuth2ManifestTest, ComponentWithChromeClientId) { { base::DictionaryValue* ext_manifest = CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_NOT_SET); - Manifest manifest(ext_manifest, "test"); + ManifestData manifest(ext_manifest, "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest, extensions::Manifest::COMPONENT); EXPECT_TRUE(OAuth2Info::GetOAuth2Info(extension.get()).client_id.empty()); @@ -302,7 +302,7 @@ TEST_F(OAuth2ManifestTest, ComponentWithChromeClientId) { { base::DictionaryValue* ext_manifest = CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_EMPTY); - Manifest manifest(ext_manifest, "test"); + ManifestData manifest(ext_manifest, "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest, extensions::Manifest::COMPONENT); EXPECT_TRUE(OAuth2Info::GetOAuth2Info(extension.get()).client_id.empty()); @@ -313,7 +313,7 @@ TEST_F(OAuth2ManifestTest, ComponentWithChromeClientId) { TEST_F(OAuth2ManifestTest, ComponentWithStandardClientId) { base::DictionaryValue* ext_manifest = CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_DEFAULT); - Manifest manifest(ext_manifest, "test"); + ManifestData manifest(ext_manifest, "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest, extensions::Manifest::COMPONENT); EXPECT_EQ("client1", OAuth2Info::GetOAuth2Info(extension.get()).client_id); diff --git a/chrome/common/extensions/manifest_handlers/automation_unittest.cc b/chrome/common/extensions/manifest_handlers/automation_unittest.cc index 9148782..96c13e4 100644 --- a/chrome/common/extensions/manifest_handlers/automation_unittest.cc +++ b/chrome/common/extensions/manifest_handlers/automation_unittest.cc @@ -3,8 +3,9 @@ // found in the LICENSE file. #include "base/strings/utf_string_conversions.h" +#include "chrome/common/extensions/features/feature_channel.h" #include "chrome/common/extensions/manifest_handlers/automation.h" -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "chrome/grit/generated_resources.h" #include "extensions/common/error_utils.h" #include "extensions/common/manifest_constants.h" @@ -14,7 +15,7 @@ namespace extensions { -class AutomationManifestTest : public ExtensionManifestTest { +class AutomationManifestTest : public ChromeManifestTest { public: AutomationManifestTest() : channel_(chrome::VersionInfo::CHANNEL_UNKNOWN) {} @@ -156,7 +157,7 @@ TEST_F(AutomationManifestTest, EmptyMatches) { TEST_F(AutomationManifestTest, NoValidMatches) { std::string error; scoped_refptr<Extension> extension = - LoadExtension(Manifest("automation_no_valid_matches.json"), &error); + LoadExtension(ManifestData("automation_no_valid_matches.json"), &error); ASSERT_TRUE(extension.get()); EXPECT_EQ("", error); EXPECT_EQ(2u, extension->install_warnings().size()); 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 907ab92..8b831da 100644 --- a/chrome/common/extensions/manifest_handlers/content_scripts_manifest_unittest.cc +++ b/chrome/common/extensions/manifest_handlers/content_scripts_manifest_unittest.cc @@ -5,7 +5,7 @@ #include "base/command_line.h" #include "base/strings/string_number_conversions.h" #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/error_utils.h" #include "extensions/common/extension.h" #include "extensions/common/manifest_constants.h" @@ -16,7 +16,7 @@ namespace extensions { namespace errors = manifest_errors; -class ContentScriptsManifestTest : public ExtensionManifestTest { +class ContentScriptsManifestTest : public ChromeManifestTest { }; 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 ef0cd0d..7a08efb 100644 --- a/chrome/common/extensions/manifest_handlers/exclude_matches_manifest_unittest.cc +++ b/chrome/common/extensions/manifest_handlers/exclude_matches_manifest_unittest.cc @@ -2,14 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/extension.h" #include "testing/gtest/include/gtest/gtest.h" namespace extensions { -class ExcludeMatchesManifestTest : public ExtensionManifestTest { +class ExcludeMatchesManifestTest : public ChromeManifestTest { }; TEST_F(ExcludeMatchesManifestTest, ExcludeMatchPatterns) { diff --git a/chrome/common/extensions/manifest_tests/chrome_manifest_test.cc b/chrome/common/extensions/manifest_tests/chrome_manifest_test.cc new file mode 100644 index 0000000..96f3f06 --- /dev/null +++ b/chrome/common/extensions/manifest_tests/chrome_manifest_test.cc @@ -0,0 +1,21 @@ +// Copyright 2014 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/manifest_tests/chrome_manifest_test.h" + +#include "base/files/file_path.h" +#include "base/path_service.h" +#include "chrome/common/chrome_paths.h" + +ChromeManifestTest::ChromeManifestTest() { +} + +ChromeManifestTest::~ChromeManifestTest() { +} + +base::FilePath ChromeManifestTest::GetTestDataDir() { + base::FilePath path; + PathService::Get(chrome::DIR_TEST_DATA, &path); + return path.AppendASCII("extensions").AppendASCII("manifest_tests"); +} diff --git a/chrome/common/extensions/manifest_tests/chrome_manifest_test.h b/chrome/common/extensions/manifest_tests/chrome_manifest_test.h new file mode 100644 index 0000000..7ff77f6 --- /dev/null +++ b/chrome/common/extensions/manifest_tests/chrome_manifest_test.h @@ -0,0 +1,26 @@ +// Copyright 2014 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_MANIFEST_TESTS_CHROME_MANIFEST_TEST_H_ +#define CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_CHROME_MANIFEST_TEST_H_ + +#include "base/macros.h" +#include "extensions/common/manifest_test.h" + +// Base class for unit tests that load manifest data from Chrome TEST_DATA_DIR. +// TODO(jamescook): Move this class and all subclasses into the extensions +// namespace. +class ChromeManifestTest : public extensions::ManifestTest { + public: + ChromeManifestTest(); + virtual ~ChromeManifestTest(); + + // ManifestTest overrides: + virtual base::FilePath GetTestDataDir() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(ChromeManifestTest); +}; + +#endif // CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_CHROME_MANIFEST_TEST_H_ diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_about_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_about_unittest.cc index b177fbf..c0dd431 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_about_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_about_unittest.cc @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "chrome/common/extensions/manifest_url_handler.h" #include "extensions/common/manifest_constants.h" #include "testing/gtest/include/gtest/gtest.h" namespace errors = extensions::manifest_errors; -class AboutPageManifestTest : public ExtensionManifestTest {}; +class AboutPageManifestTest : public ChromeManifestTest {}; TEST_F(AboutPageManifestTest, AboutPageInSharedModules) { scoped_refptr<extensions::Extension> extension; 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 ae819d8..b78180f 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_background_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_background_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "base/command_line.h" #include "base/memory/scoped_ptr.h" @@ -20,7 +20,7 @@ namespace extensions { namespace errors = manifest_errors; namespace keys = manifest_keys; -class ExtensionManifestBackgroundTest : public ExtensionManifestTest { +class ExtensionManifestBackgroundTest : public ChromeManifestTest { }; TEST_F(ExtensionManifestBackgroundTest, BackgroundPermission) { @@ -35,7 +35,7 @@ TEST_F(ExtensionManifestBackgroundTest, BackgroundScripts) { ASSERT_TRUE(manifest.get()); scoped_refptr<Extension> extension( - LoadAndExpectSuccess(Manifest(manifest.get(), ""))); + LoadAndExpectSuccess(ManifestData(manifest.get(), ""))); ASSERT_TRUE(extension.get()); const std::vector<std::string>& background_scripts = BackgroundInfo::GetBackgroundScripts(extension.get()); @@ -49,7 +49,7 @@ TEST_F(ExtensionManifestBackgroundTest, BackgroundScripts) { BackgroundInfo::GetBackgroundURL(extension.get()).path()); manifest->SetString("background_page", "monkey.html"); - LoadAndExpectError(Manifest(manifest.get(), ""), + LoadAndExpectError(ManifestData(manifest.get(), ""), errors::kInvalidBackgroundCombination); } @@ -65,14 +65,14 @@ TEST_F(ExtensionManifestBackgroundTest, BackgroundPage) { scoped_ptr<base::DictionaryValue> manifest( LoadManifest("background_page_legacy.json", &error)); ASSERT_TRUE(manifest.get()); - extension = LoadAndExpectSuccess(Manifest(manifest.get(), "")); + extension = LoadAndExpectSuccess(ManifestData(manifest.get(), "")); ASSERT_TRUE(extension.get()); EXPECT_EQ("/foo.html", BackgroundInfo::GetBackgroundURL(extension.get()).path()); manifest->SetInteger(keys::kManifestVersion, 2); LoadAndExpectWarning( - Manifest(manifest.get(), ""), + ManifestData(manifest.get(), ""), "'background_page' requires manifest version of 1 or lower."); } @@ -97,14 +97,14 @@ TEST_F(ExtensionManifestBackgroundTest, BackgroundPageWebRequest) { manifest->SetBoolean(keys::kBackgroundPersistent, false); manifest->SetInteger(keys::kManifestVersion, 2); scoped_refptr<Extension> extension( - LoadAndExpectSuccess(Manifest(manifest.get(), ""))); + LoadAndExpectSuccess(ManifestData(manifest.get(), ""))); ASSERT_TRUE(extension.get()); EXPECT_TRUE(BackgroundInfo::HasLazyBackgroundPage(extension.get())); base::ListValue* permissions = new base::ListValue(); permissions->Append(new base::StringValue("webRequest")); manifest->Set(keys::kPermissions, permissions); - LoadAndExpectError(Manifest(manifest.get(), ""), + LoadAndExpectError(ManifestData(manifest.get(), ""), errors::kWebRequestConflictsWithLazyBackground); } diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_chromepermission_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_chromepermission_unittest.cc index ad05250..d5b112f 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_chromepermission_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_chromepermission_unittest.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "base/command_line.h" -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "chrome/common/url_constants.h" #include "extensions/common/error_utils.h" #include "extensions/common/extension.h" @@ -17,14 +17,16 @@ namespace extensions { namespace errors = manifest_errors; -TEST_F(ExtensionManifestTest, ChromeURLPermissionInvalid) { +typedef ChromeManifestTest ChromePermissionManifestTest; + +TEST_F(ChromePermissionManifestTest, ChromeURLPermissionInvalid) { LoadAndExpectWarning("permission_chrome_url_invalid.json", ErrorUtils::FormatErrorMessage( errors::kInvalidPermissionScheme, chrome::kChromeUINewTabURL)); } -TEST_F(ExtensionManifestTest, ChromeURLPermissionAllowedWithFlag) { +TEST_F(ChromePermissionManifestTest, ChromeURLPermissionAllowedWithFlag) { // Ignore the policy delegate for this test. PermissionsData::SetPolicyDelegate(NULL); CommandLine::ForCurrentProcess()->AppendSwitch( @@ -39,13 +41,14 @@ TEST_F(ExtensionManifestTest, ChromeURLPermissionAllowedWithFlag) { << error; } -TEST_F(ExtensionManifestTest, ChromeResourcesPermissionValidOnlyForComponents) { +TEST_F(ChromePermissionManifestTest, + ChromeResourcesPermissionValidOnlyForComponents) { LoadAndExpectWarning("permission_chrome_resources_url.json", ErrorUtils::FormatErrorMessage( errors::kInvalidPermissionScheme, "chrome://resources/")); std::string error; - LoadExtension(Manifest("permission_chrome_resources_url.json"), + LoadExtension(ManifestData("permission_chrome_resources_url.json"), &error, extensions::Manifest::COMPONENT, Extension::NO_FLAGS); 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 549b2aa..ef13f96 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_contentsecuritypolicy_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_contentsecuritypolicy_unittest.cc @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/manifest_constants.h" #include "testing/gtest/include/gtest/gtest.h" namespace errors = extensions::manifest_errors; -class ContentSecurityPolicyManifestTest : public ExtensionManifestTest { +class ContentSecurityPolicyManifestTest : public ChromeManifestTest { }; TEST_F(ContentSecurityPolicyManifestTest, InsecureContentSecurityPolicy) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_default_extent_path_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_default_extent_path_unittest.cc index aeead3f..9d2a9bb 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_default_extent_path_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_default_extent_path_unittest.cc @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/extension.h" #include "testing/gtest/include/gtest/gtest.h" -TEST_F(ExtensionManifestTest, DefaultPathForExtent) { +TEST_F(ChromeManifestTest, DefaultPathForExtent) { scoped_refptr<extensions::Extension> extension( LoadAndExpectSuccess("default_path_for_extent.json")); 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 290a434..3528ada 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_devtools_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_devtools_unittest.cc @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "chrome/common/extensions/manifest_url_handler.h" #include "extensions/common/extension.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/permissions/permissions_data.h" #include "testing/gtest/include/gtest/gtest.h" -class DevToolsPageManifestTest : public ExtensionManifestTest { +class DevToolsPageManifestTest : public ChromeManifestTest { }; TEST_F(DevToolsPageManifestTest, DevToolsExtensions) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_dummy_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_dummy_unittest.cc index 73c1350..1e9a34e 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_dummy_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_dummy_unittest.cc @@ -2,17 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" namespace extensions { -TEST_F(ExtensionManifestTest, PlatformsKey) { +TEST_F(ChromeManifestTest, PlatformsKey) { scoped_refptr<Extension> extension = LoadAndExpectSuccess("platforms_key.json"); EXPECT_EQ(0u, extension->install_warnings().size()); } -TEST_F(ExtensionManifestTest, UnrecognizedKeyWarning) { +TEST_F(ChromeManifestTest, UnrecognizedKeyWarning) { scoped_refptr<Extension> extension = LoadAndExpectWarning("unrecognized_key.json", "Unrecognized manifest key 'unrecognized_key_1'."); diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_experimental_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_experimental_unittest.cc index b376f47..6c1b727 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_experimental_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_experimental_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "base/command_line.h" #include "extensions/common/extension.h" @@ -13,7 +13,7 @@ namespace errors = extensions::manifest_errors; -TEST_F(ExtensionManifestTest, ExperimentalPermission) { +TEST_F(ChromeManifestTest, ExperimentalPermission) { LoadAndExpectError("experimental.json", errors::kExperimentalFlagRequired); LoadAndExpectSuccess("experimental.json", extensions::Manifest::COMPONENT); LoadAndExpectSuccess("experimental.json", extensions::Manifest::INTERNAL, 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 8b9c685..a72b98c 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "base/strings/string_util.h" -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "chrome/common/extensions/manifest_url_handler.h" #include "extensions/common/extension.h" #include "extensions/common/manifest_constants.h" @@ -11,7 +11,7 @@ namespace errors = extensions::manifest_errors; -class HomepageURLManifestTest : public ExtensionManifestTest { +class HomepageURLManifestTest : public ChromeManifestTest { }; 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 e827559..20c26bb 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_icons_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_icons_unittest.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "base/memory/linked_ptr.h" -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/constants.h" #include "extensions/common/extension.h" #include "extensions/common/extension_icon_set.h" @@ -12,7 +12,7 @@ namespace extensions { -class IconsManifestTest : public ExtensionManifestTest { +class IconsManifestTest : public ChromeManifestTest { }; 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 51c648b..6807f8a 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc @@ -7,7 +7,7 @@ #include "base/path_service.h" #include "base/strings/utf_string_conversions.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "components/crx_file/id_util.h" #include "extensions/common/extension.h" #include "extensions/common/manifest_constants.h" @@ -28,7 +28,7 @@ const char kWhitelistID[] = "lmadimbbgapmngbiclpjjngmdickadpl"; namespace errors = manifest_errors; namespace keys = manifest_keys; -class InitValueManifestTest : public ExtensionManifestTest { +class InitValueManifestTest : public ChromeManifestTest { }; 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 26abab5..ead28c4 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_isolatedapp_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_isolatedapp_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "base/command_line.h" #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" @@ -15,7 +15,7 @@ namespace extensions { namespace errors = manifest_errors; -class IsolatedAppsManifestTest : public ExtensionManifestTest { +class IsolatedAppsManifestTest : public ChromeManifestTest { }; 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 f79d79d..3922cc7 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,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/extension.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_handlers/kiosk_mode_info.h" @@ -10,7 +10,7 @@ namespace extensions { -class ExtensionManifestKioskModeTest : public ExtensionManifestTest { +class ExtensionManifestKioskModeTest : public ChromeManifestTest { }; TEST_F(ExtensionManifestKioskModeTest, InvalidKioskEnabled) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc index 6912dac..d8e31eb 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc @@ -5,7 +5,7 @@ #include "base/command_line.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/error_utils.h" #include "extensions/common/extension.h" #include "extensions/common/manifest_constants.h" @@ -16,7 +16,7 @@ namespace extensions { namespace errors = manifest_errors; namespace keys = manifest_keys; -class AppLaunchManifestTest : public ExtensionManifestTest { +class AppLaunchManifestTest : public ChromeManifestTest { }; TEST_F(AppLaunchManifestTest, AppLaunchContainer) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_launcher_page_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_launcher_page_unittest.cc index be7ba75..8d9007f 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_launcher_page_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_launcher_page_unittest.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "base/command_line.h" -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/constants.h" #include "extensions/common/extension.h" #include "extensions/common/manifest_handlers/launcher_page_info.h" @@ -19,7 +19,7 @@ const char kWhitelistID[] = "lmadimbbgapmngbiclpjjngmdickadpl"; } // namespace -typedef ExtensionManifestTest LauncherPageManifestTest; +typedef ChromeManifestTest LauncherPageManifestTest; TEST_F(LauncherPageManifestTest, ValidLauncherPage) { CommandLine::ForCurrentProcess()->AppendSwitchASCII( diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_manifest_version_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_manifest_version_unittest.cc index cce186b..b715831 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_manifest_version_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_manifest_version_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/manifest_constants.h" #include "testing/gtest/include/gtest/gtest.h" @@ -12,7 +12,7 @@ using extensions::Extension; namespace errors = extensions::manifest_errors; -TEST_F(ExtensionManifestTest, ManifestVersionError) { +TEST_F(ChromeManifestTest, ManifestVersionError) { scoped_ptr<base::DictionaryValue> manifest1(new base::DictionaryValue()); manifest1->SetString("name", "Miles"); manifest1->SetString("version", "0.55"); @@ -43,13 +43,13 @@ TEST_F(ExtensionManifestTest, ManifestVersionError) { create_flags |= Extension::REQUIRE_MODERN_MANIFEST_VERSION; if (test_data[i].expect_error) { LoadAndExpectError( - Manifest(test_data[i].manifest, + ManifestData(test_data[i].manifest, test_data[i].test_name), errors::kInvalidManifestVersionOld, extensions::Manifest::UNPACKED, create_flags); } else { - LoadAndExpectSuccess(Manifest(test_data[i].manifest, + LoadAndExpectSuccess(ManifestData(test_data[i].manifest, test_data[i].test_name), extensions::Manifest::UNPACKED, create_flags); 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 be0628d..67934e4 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,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/extension.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_handlers/offline_enabled_info.h" @@ -12,7 +12,7 @@ namespace extensions { namespace errors = manifest_errors; -class ExtensionManifestOfflineEnabledTest : public ExtensionManifestTest { +class ExtensionManifestOfflineEnabledTest : public ChromeManifestTest { }; TEST_F(ExtensionManifestOfflineEnabledTest, OfflineEnabled) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_old_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_old_unittest.cc index 2091280..e9fd914 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_old_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_old_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/extension.h" #include "extensions/common/permissions/permissions_data.h" @@ -10,7 +10,7 @@ // Tests that the old permission name "unlimited_storage" still works for // backwards compatibility (we renamed it to "unlimitedStorage"). -TEST_F(ExtensionManifestTest, OldUnlimitedStoragePermission) { +TEST_F(ChromeManifestTest, OldUnlimitedStoragePermission) { scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess( "old_unlimited_storage.json", extensions::Manifest::INTERNAL, extensions::Extension::NO_FLAGS); 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 a51ce9c..03527cb 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_options_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_options_unittest.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "base/strings/stringprintf.h" -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/error_utils.h" #include "extensions/common/feature_switch.h" #include "extensions/common/manifest_constants.h" @@ -14,7 +14,7 @@ using namespace extensions; namespace errors = extensions::manifest_errors; -class OptionsPageManifestTest : public ExtensionManifestTest { +class OptionsPageManifestTest : public ChromeManifestTest { }; 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 7c8b1b0..8a5ac9f 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_override_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_override_unittest.cc @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "chrome/common/extensions/manifest_url_handler.h" #include "extensions/common/manifest_constants.h" #include "testing/gtest/include/gtest/gtest.h" namespace errors = extensions::manifest_errors; -class URLOverridesManifestTest : public ExtensionManifestTest { +class URLOverridesManifestTest : public ChromeManifestTest { }; 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 ddbe4b4..6c168e0a 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,7 @@ #include "base/json/json_file_value_serializer.h" #include "base/memory/linked_ptr.h" #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/error_utils.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_handlers/csp_info.h" @@ -18,7 +18,7 @@ namespace extensions { namespace errors = manifest_errors; -class PlatformAppsManifestTest : public ExtensionManifestTest { +class PlatformAppsManifestTest : public ChromeManifestTest { }; TEST_F(PlatformAppsManifestTest, PlatformApps) { @@ -131,7 +131,7 @@ TEST_F(PlatformAppsManifestTest, CertainApisRequirePlatformApps) { // First try to load without any flags. This should fail for every API. for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { - LoadAndExpectError(Manifest(manifests[i].get(), ""), + LoadAndExpectError(ManifestData(manifests[i].get(), ""), errors::kExperimentalFlagRequired); } @@ -139,7 +139,7 @@ TEST_F(PlatformAppsManifestTest, CertainApisRequirePlatformApps) { CommandLine::ForCurrentProcess()->AppendSwitch( switches::kEnableExperimentalExtensionApis); for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { - LoadAndExpectSuccess(Manifest(manifests[i].get(), "")); + LoadAndExpectSuccess(ManifestData(manifests[i].get(), "")); } } diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_portsinpermissions_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_portsinpermissions_unittest.cc index e9207cc..874d7e8 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_portsinpermissions_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_portsinpermissions_unittest.cc @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "testing/gtest/include/gtest/gtest.h" -TEST_F(ExtensionManifestTest, PortsInPermissions) { +TEST_F(ChromeManifestTest, PortsInPermissions) { // Loading as a user would shoud not trigger an error. LoadAndExpectSuccess("ports_in_permissions.json"); } 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 c1b5fb8..99c1a9d 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,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/error_utils.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_handlers/requirements_info.h" @@ -12,7 +12,7 @@ namespace extensions { namespace errors = manifest_errors; -class RequirementsManifestTest : public ExtensionManifestTest { +class RequirementsManifestTest : public ChromeManifestTest { }; 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 9220aed..c467e17 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_sandboxed_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_sandboxed_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_handlers/csp_info.h" #include "testing/gtest/include/gtest/gtest.h" @@ -11,7 +11,7 @@ namespace extensions { namespace errors = manifest_errors; -class SandboxedPagesManifestTest : public ExtensionManifestTest { +class SandboxedPagesManifestTest : public ChromeManifestTest { }; TEST_F(SandboxedPagesManifestTest, SandboxedPages) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_storage_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_storage_unittest.cc index fc60bac..4e731c8 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_storage_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_storage_unittest.cc @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/manifest_constants.h" #include "testing/gtest/include/gtest/gtest.h" namespace keys = extensions::manifest_keys; -TEST_F(ExtensionManifestTest, StorageAPIManifestVersionAvailability) { +TEST_F(ChromeManifestTest, StorageAPIManifestVersionAvailability) { base::DictionaryValue base_manifest; { base_manifest.SetString(keys::kName, "test"); @@ -24,7 +24,7 @@ TEST_F(ExtensionManifestTest, StorageAPIManifestVersionAvailability) { // Extension with no manifest version cannot use storage API. { - Manifest manifest(&base_manifest, "test"); + ManifestData manifest(&base_manifest, "test"); LoadAndExpectWarning(manifest, kManifestVersionError); } @@ -34,7 +34,7 @@ TEST_F(ExtensionManifestTest, StorageAPIManifestVersionAvailability) { manifest_with_version.SetInteger(keys::kManifestVersion, 1); manifest_with_version.MergeDictionary(&base_manifest); - Manifest manifest(&manifest_with_version, "test"); + ManifestData manifest(&manifest_with_version, "test"); LoadAndExpectWarning(manifest, kManifestVersionError); } @@ -44,7 +44,7 @@ TEST_F(ExtensionManifestTest, StorageAPIManifestVersionAvailability) { manifest_with_version.SetInteger(keys::kManifestVersion, 2); manifest_with_version.MergeDictionary(&base_manifest); - Manifest manifest(&manifest_with_version, "test"); + ManifestData manifest(&manifest_with_version, "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_TRUE(extension->install_warnings().empty()); 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 def777f..264eb9d 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_ui_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_ui_unittest.cc @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/manifest_constants.h" #include "testing/gtest/include/gtest/gtest.h" namespace extensions { -class UIManifestTest : public ExtensionManifestTest { +class UIManifestTest : public ChromeManifestTest { }; 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 0f01502..0b3ef20 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_update_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_update_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "chrome/common/extensions/manifest_url_handler.h" #include "extensions/common/manifest_constants.h" #include "testing/gtest/include/gtest/gtest.h" @@ -11,7 +11,7 @@ using extensions::Extension; namespace errors = extensions::manifest_errors; -class UpdateURLManifestTest : public ExtensionManifestTest { +class UpdateURLManifestTest : public ChromeManifestTest { }; TEST_F(UpdateURLManifestTest, UpdateUrls) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_validapp_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_validapp_unittest.cc index 98b8b5a..11174b0 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_validapp_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_validapp_unittest.cc @@ -5,10 +5,10 @@ #include "base/memory/scoped_ptr.h" #include "base/values.h" #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "testing/gtest/include/gtest/gtest.h" -typedef ExtensionManifestTest ValidAppManifestTest; +typedef ChromeManifestTest ValidAppManifestTest; TEST_F(ValidAppManifestTest, ValidApp) { scoped_refptr<extensions::Extension> extension( @@ -30,5 +30,5 @@ TEST_F(ValidAppManifestTest, AllowUnrecognizedPermissions) { base::ListValue* permissions = NULL; ASSERT_TRUE(manifest->GetList("permissions", &permissions)); permissions->Append(new base::StringValue("not-a-valid-permission")); - LoadAndExpectSuccess(Manifest(manifest.get(), "")); + LoadAndExpectSuccess(ManifestData(manifest.get(), "")); } 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 f1df3ae..ee6b8d5 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 @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/manifest_handlers/web_accessible_resources_info.h" #include "testing/gtest/include/gtest/gtest.h" using extensions::Extension; using extensions::WebAccessibleResourcesInfo; -class WebAccessibleResourcesManifestTest : public ExtensionManifestTest { +class WebAccessibleResourcesManifestTest : public ChromeManifestTest { }; TEST_F(WebAccessibleResourcesManifestTest, WebAccessibleResources) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_web_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_web_unittest.cc index 1f97025..9fdd7de 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_web_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_web_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" @@ -15,7 +15,7 @@ using extensions::Extension; namespace errors = extensions::manifest_errors; -TEST_F(ExtensionManifestTest, AppWebUrls) { +TEST_F(ChromeManifestTest, AppWebUrls) { Testcase testcases[] = { Testcase("web_urls_wrong_type.json", errors::kInvalidWebURLs), Testcase("web_urls_invalid_1.json", diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_webview_accessible_resources_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_webview_accessible_resources_unittest.cc index e7f4561..1f85786 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_webview_accessible_resources_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_webview_accessible_resources_unittest.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "base/strings/string_number_conversions.h" -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/error_utils.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_handlers/webview_info.h" @@ -13,7 +13,7 @@ using extensions::Extension; using extensions::WebviewInfo; namespace errors = extensions::manifest_errors; -class WebviewAccessibleResourcesManifestTest : public ExtensionManifestTest { +class WebviewAccessibleResourcesManifestTest : public ChromeManifestTest { }; TEST_F(WebviewAccessibleResourcesManifestTest, WebviewAccessibleResources) { diff --git a/chrome/common/extensions/manifest_unittest.cc b/chrome/common/extensions/manifest_unittest.cc index 97150f1..6bf35e6 100644 --- a/chrome/common/extensions/manifest_unittest.cc +++ b/chrome/common/extensions/manifest_unittest.cc @@ -23,9 +23,10 @@ namespace extensions { namespace errors = manifest_errors; namespace keys = manifest_keys; -class ManifestTest : public testing::Test { +// Not named "ManifestTest" because a test utility class has that name. +class ManifestUnitTest : public testing::Test { public: - ManifestTest() : default_value_("test") {} + ManifestUnitTest() : default_value_("test") {} protected: void AssertType(Manifest* manifest, Manifest::Type type) { @@ -59,7 +60,7 @@ class ManifestTest : public testing::Test { }; // Verifies that extensions can access the correct keys. -TEST_F(ManifestTest, Extension) { +TEST_F(ManifestUnitTest, Extension) { scoped_ptr<base::DictionaryValue> manifest_value(new base::DictionaryValue()); manifest_value->SetString(keys::kName, "extension"); manifest_value->SetString(keys::kVersion, "1"); @@ -117,7 +118,7 @@ TEST_F(ManifestTest, Extension) { } // Verifies that key restriction based on type works. -TEST_F(ManifestTest, ExtensionTypes) { +TEST_F(ManifestUnitTest, ExtensionTypes) { scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); value->SetString(keys::kName, "extension"); value->SetString(keys::kVersion, "1"); @@ -173,7 +174,7 @@ TEST_F(ManifestTest, ExtensionTypes) { }; // Verifies that the getters filter restricted keys. -TEST_F(ManifestTest, RestrictedKeys) { +TEST_F(ManifestUnitTest, RestrictedKeys) { scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); value->SetString(keys::kName, "extension"); value->SetString(keys::kVersion, "1"); diff --git a/chrome/common/extensions/permissions/settings_override_permission_unittest.cc b/chrome/common/extensions/permissions/settings_override_permission_unittest.cc index 61f6b5b..e154769 100644 --- a/chrome/common/extensions/permissions/settings_override_permission_unittest.cc +++ b/chrome/common/extensions/permissions/settings_override_permission_unittest.cc @@ -7,7 +7,7 @@ #include "base/basictypes.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/permissions/permission_set.h" #include "extensions/common/permissions/permissions_data.h" @@ -18,7 +18,7 @@ namespace extensions { namespace { -class SettingsOverridePermissionTest : public ExtensionManifestTest { +class SettingsOverridePermissionTest : public ChromeManifestTest { protected: enum Flags { kHomepage = 1, @@ -56,7 +56,7 @@ class SettingsOverridePermissionTest : public ExtensionManifestTest { ext_manifest.Set( manifest_keys::kSettingsOverride, settings_override.release()); - Manifest manifest(&ext_manifest, "test"); + ManifestData manifest(&ext_manifest, "test"); return LoadAndExpectSuccess(manifest); } }; diff --git a/extensions/BUILD.gn b/extensions/BUILD.gn index 52d5749..0b46037 100644 --- a/extensions/BUILD.gn +++ b/extensions/BUILD.gn @@ -75,6 +75,8 @@ source_set("test_support") { "browser/test_runtime_api_delegate.h", "common/extension_builder.cc", "common/extension_builder.h", + "common/manifest_test.cc", + "common/manifest_test.h", "common/test_util.cc", "common/test_util.h", "common/value_builder.cc", @@ -206,6 +208,7 @@ test("unittests") { "common/extension_resource_unittest.cc", "common/extension_set_unittest.cc", "common/manifest_handler_unittest.cc", + "common/manifest_handlers/shared_module_manifest_unittest.cc", "common/message_bundle_unittest.cc", "common/one_shot_event_unittest.cc", "common/permissions/manifest_permission_set_unittest.cc", diff --git a/extensions/DEPS b/extensions/DEPS index 836d930..7cfd017 100644 --- a/extensions/DEPS +++ b/extensions/DEPS @@ -39,7 +39,7 @@ specific_include_rules = { "+chrome/browser/ui/browser.h", "+chrome/common/chrome_paths.h", "+chrome/common/extensions/features/feature_channel.h", - "+chrome/common/extensions/manifest_tests/extension_manifest_test.h", + "+chrome/common/extensions/manifest_tests/chrome_manifest_test.h", "+chrome/test/base/testing_profile.h", "+chrome/test/base/ui_test_utils.h", ], diff --git a/extensions/common/manifest_handlers/externally_connectable_unittest.cc b/extensions/common/manifest_handlers/externally_connectable_unittest.cc index 77acf35..87e29cc 100644 --- a/extensions/common/manifest_handlers/externally_connectable_unittest.cc +++ b/extensions/common/manifest_handlers/externally_connectable_unittest.cc @@ -4,8 +4,7 @@ #include <algorithm> -#include "chrome/common/extensions/features/feature_channel.h" -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/error_utils.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_handlers/externally_connectable.h" @@ -19,9 +18,11 @@ namespace extensions { namespace errors = externally_connectable_errors; -class ExternallyConnectableTest : public ExtensionManifestTest { +// TODO(jamescook): Convert from ChromeManifestTest to ManifestTest. +class ExternallyConnectableTest : public ChromeManifestTest { public: - ExternallyConnectableTest() : channel_(chrome::VersionInfo::CHANNEL_DEV) {} + ExternallyConnectableTest() {} + virtual ~ExternallyConnectableTest() {} protected: ExternallyConnectableInfo* GetExternallyConnectableInfo( @@ -29,9 +30,6 @@ class ExternallyConnectableTest : public ExtensionManifestTest { return static_cast<ExternallyConnectableInfo*>( extension->GetManifestData(manifest_keys::kExternallyConnectable)); } - - private: - ScopedCurrentChannel channel_; }; TEST_F(ExternallyConnectableTest, IDsAndMatches) { diff --git a/extensions/common/manifest_handlers/file_handler_manifest_unittest.cc b/extensions/common/manifest_handlers/file_handler_manifest_unittest.cc index 678dc6b..f45d922 100644 --- a/extensions/common/manifest_handlers/file_handler_manifest_unittest.cc +++ b/extensions/common/manifest_handlers/file_handler_manifest_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_handlers/file_handler_info.h" #include "testing/gtest/include/gtest/gtest.h" @@ -11,7 +11,8 @@ namespace extensions { namespace errors = manifest_errors; -class FileHandlersManifestTest : public ExtensionManifestTest { +// TODO(jamescook): Convert from ChromeManifestTest to ManifestTest. +class FileHandlersManifestTest : public ChromeManifestTest { }; TEST_F(FileHandlersManifestTest, InvalidFileHandlers) { diff --git a/extensions/common/manifest_handlers/shared_module_manifest_unittest.cc b/extensions/common/manifest_handlers/shared_module_manifest_unittest.cc index 9fad618..ef90a1a 100644 --- a/extensions/common/manifest_handlers/shared_module_manifest_unittest.cc +++ b/extensions/common/manifest_handlers/shared_module_manifest_unittest.cc @@ -3,9 +3,9 @@ // found in the LICENSE file. #include "base/version.h" -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "extensions/common/extension.h" #include "extensions/common/manifest_handlers/shared_module_info.h" +#include "extensions/common/manifest_test.h" #include "testing/gtest/include/gtest/gtest.h" namespace { @@ -23,11 +23,11 @@ const char* kNoImport = "cccccccccccccccccccccccccccccccc"; namespace extensions { -class SharedModuleManifestTest : public ExtensionManifestTest { +class SharedModuleManifestTest : public ManifestTest { }; TEST_F(SharedModuleManifestTest, ExportsAll) { - Manifest manifest("shared_module_export.json"); + ManifestData manifest("shared_module_export.json"); scoped_refptr<Extension> extension = LoadAndExpectSuccess(manifest); @@ -49,7 +49,7 @@ TEST_F(SharedModuleManifestTest, ExportsAll) { } TEST_F(SharedModuleManifestTest, ExportWhitelistAll) { - Manifest manifest("shared_module_export_no_whitelist.json"); + ManifestData manifest("shared_module_export_no_whitelist.json"); scoped_refptr<Extension> extension = LoadAndExpectSuccess(manifest); @@ -62,7 +62,7 @@ TEST_F(SharedModuleManifestTest, ExportWhitelistAll) { } TEST_F(SharedModuleManifestTest, ExportFoo) { - Manifest manifest("shared_module_export_foo.json"); + ManifestData manifest("shared_module_export_foo.json"); scoped_refptr<Extension> extension = LoadAndExpectSuccess(manifest); @@ -108,7 +108,7 @@ TEST_F(SharedModuleManifestTest, SharedModuleStaticFunctions) { } TEST_F(SharedModuleManifestTest, Import) { - Manifest manifest("shared_module_import.json"); + ManifestData manifest("shared_module_import.json"); scoped_refptr<Extension> extension = LoadAndExpectSuccess(manifest); diff --git a/chrome/common/extensions/manifest_tests/extension_manifest_test.cc b/extensions/common/manifest_test.cc index c2936d8..b1ab115 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifest_test.cc +++ b/extensions/common/manifest_test.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" +#include "extensions/common/manifest_test.h" #include "base/files/file_path.h" #include "base/files/file_util.h" @@ -10,25 +10,18 @@ #include "base/path_service.h" #include "base/strings/string_util.h" #include "base/values.h" -#include "chrome/common/chrome_paths.h" #include "extensions/common/extension_l10n_util.h" +#include "extensions/common/extension_paths.h" #include "extensions/common/test_util.h" #include "ui/base/l10n/l10n_util.h" -using extensions::Extension; - +namespace extensions { namespace { -// If filename is a relative path, LoadManifestFile will treat it relative to -// the appropriate test directory. -base::DictionaryValue* LoadManifestFile(const base::FilePath& filename_path, +// |manifest_path| is an absolute path to a manifest file. +base::DictionaryValue* LoadManifestFile(const base::FilePath& manifest_path, std::string* error) { - base::FilePath extension_path; - base::FilePath manifest_path; - - PathService::Get(chrome::DIR_TEST_DATA, &manifest_path); - manifest_path = manifest_path.Append(filename_path); - extension_path = manifest_path.DirName(); + base::FilePath extension_path = manifest_path.DirName(); EXPECT_TRUE(base::PathExists(manifest_path)) << "Couldn't find " << manifest_path.value(); @@ -42,7 +35,7 @@ base::DictionaryValue* LoadManifestFile(const base::FilePath& filename_path, // Only localize manifests that indicate they want to be localized. // Calling LocalizeExtension at this point mirrors file_util::LoadExtension. if (manifest && - filename_path.value().find(FILE_PATH_LITERAL("localized")) != + manifest_path.value().find(FILE_PATH_LITERAL("localized")) != std::string::npos) extension_l10n_util::LocalizeExtension(extension_path, manifest, error); @@ -51,79 +44,76 @@ base::DictionaryValue* LoadManifestFile(const base::FilePath& filename_path, } // namespace -ExtensionManifestTest::ExtensionManifestTest() - : enable_apps_(true), - // UNKNOWN == trunk. - current_channel_(chrome::VersionInfo::CHANNEL_UNKNOWN) {} +ManifestTest::ManifestTest() + : enable_apps_(true) { +} + +ManifestTest::~ManifestTest() { +} // Helper class that simplifies creating methods that take either a filename // to a manifest or the manifest itself. -ExtensionManifestTest::Manifest::Manifest(const char* name) +ManifestTest::ManifestData::ManifestData(const char* name) : name_(name), manifest_(NULL) { } -ExtensionManifestTest::Manifest::Manifest(base::DictionaryValue* manifest, +ManifestTest::ManifestData::ManifestData(base::DictionaryValue* manifest, const char* name) : name_(name), manifest_(manifest) { CHECK(manifest_) << "Manifest NULL"; } -ExtensionManifestTest::Manifest::Manifest( +ManifestTest::ManifestData::ManifestData( scoped_ptr<base::DictionaryValue> manifest) : manifest_(manifest.get()), manifest_holder_(manifest.Pass()) { CHECK(manifest_) << "Manifest NULL"; } -ExtensionManifestTest::Manifest::Manifest(const Manifest& m) { +ManifestTest::ManifestData::ManifestData(const ManifestData& m) { NOTREACHED(); } -ExtensionManifestTest::Manifest::~Manifest() { +ManifestTest::ManifestData::~ManifestData() { } -base::DictionaryValue* ExtensionManifestTest::Manifest::GetManifest( - char const* test_data_dir, std::string* error) const { +base::DictionaryValue* ManifestTest::ManifestData::GetManifest( + base::FilePath test_data_dir, std::string* error) const { if (manifest_) return manifest_; - base::FilePath filename_path; - filename_path = filename_path.AppendASCII("extensions") - .AppendASCII(test_data_dir) - .AppendASCII(name_); - manifest_ = LoadManifestFile(filename_path, error); + base::FilePath manifest_path = test_data_dir.AppendASCII(name_); + manifest_ = LoadManifestFile(manifest_path, error); manifest_holder_.reset(manifest_); return manifest_; } -char const* ExtensionManifestTest::test_data_dir() { - return "manifest_tests"; +base::FilePath ManifestTest::GetTestDataDir() { + base::FilePath path; + PathService::Get(DIR_TEST_DATA, &path); + return path.AppendASCII("manifest_tests"); } -scoped_ptr<base::DictionaryValue> ExtensionManifestTest::LoadManifest( +scoped_ptr<base::DictionaryValue> ManifestTest::LoadManifest( char const* manifest_name, std::string* error) { - base::FilePath filename_path; - filename_path = filename_path.AppendASCII("extensions") - .AppendASCII(test_data_dir()) - .AppendASCII(manifest_name); - return make_scoped_ptr(LoadManifestFile(filename_path, error)); + base::FilePath manifest_path = GetTestDataDir().AppendASCII(manifest_name); + return make_scoped_ptr(LoadManifestFile(manifest_path, error)); } -scoped_refptr<Extension> ExtensionManifestTest::LoadExtension( - const Manifest& manifest, +scoped_refptr<Extension> ManifestTest::LoadExtension( + const ManifestData& manifest, std::string* error, extensions::Manifest::Location location, int flags) { - base::DictionaryValue* value = manifest.GetManifest(test_data_dir(), error); + base::FilePath test_data_dir = GetTestDataDir(); + base::DictionaryValue* value = manifest.GetManifest(test_data_dir, error); if (!value) return NULL; - base::FilePath path; - PathService::Get(chrome::DIR_TEST_DATA, &path); - path = path.AppendASCII("extensions").AppendASCII(test_data_dir()); - return Extension::Create(path.DirName(), location, *value, flags, error); + return Extension::Create( + test_data_dir.DirName(), location, *value, flags, error); } -scoped_refptr<Extension> ExtensionManifestTest::LoadAndExpectSuccess( - const Manifest& manifest, +scoped_refptr<Extension> ManifestTest::LoadAndExpectSuccess( + const ManifestData& manifest, extensions::Manifest::Location location, int flags) { std::string error; @@ -134,22 +124,15 @@ scoped_refptr<Extension> ExtensionManifestTest::LoadAndExpectSuccess( return extension; } -scoped_refptr<Extension> ExtensionManifestTest::LoadAndExpectSuccess( +scoped_refptr<Extension> ManifestTest::LoadAndExpectSuccess( char const* manifest_name, extensions::Manifest::Location location, int flags) { - return LoadAndExpectSuccess(Manifest(manifest_name), location, flags); + return LoadAndExpectSuccess(ManifestData(manifest_name), location, flags); } -scoped_refptr<Extension> ExtensionManifestTest::LoadFromStringAndExpectSuccess( - char const* manifest_json) { - return LoadAndExpectSuccess( - Manifest(extensions::test_util::ParseJsonDictionaryWithSingleQuotes( - manifest_json))); -} - -scoped_refptr<Extension> ExtensionManifestTest::LoadAndExpectWarning( - const Manifest& manifest, +scoped_refptr<Extension> ManifestTest::LoadAndExpectWarning( + const ManifestData& manifest, const std::string& expected_warning, extensions::Manifest::Location location, int flags) { @@ -163,16 +146,16 @@ scoped_refptr<Extension> ExtensionManifestTest::LoadAndExpectWarning( return extension; } -scoped_refptr<Extension> ExtensionManifestTest::LoadAndExpectWarning( +scoped_refptr<Extension> ManifestTest::LoadAndExpectWarning( char const* manifest_name, const std::string& expected_warning, extensions::Manifest::Location location, int flags) { return LoadAndExpectWarning( - Manifest(manifest_name), expected_warning, location, flags); + ManifestData(manifest_name), expected_warning, location, flags); } -void ExtensionManifestTest::VerifyExpectedError( +void ManifestTest::VerifyExpectedError( Extension* extension, const std::string& name, const std::string& error, @@ -184,8 +167,8 @@ void ExtensionManifestTest::VerifyExpectedError( " expected '" << expected_error << "' but got '" << error << "'"; } -void ExtensionManifestTest::LoadAndExpectError( - const Manifest& manifest, +void ManifestTest::LoadAndExpectError( + const ManifestData& manifest, const std::string& expected_error, extensions::Manifest::Location location, int flags) { @@ -196,31 +179,22 @@ void ExtensionManifestTest::LoadAndExpectError( expected_error); } -void ExtensionManifestTest::LoadAndExpectError( +void ManifestTest::LoadAndExpectError( char const* manifest_name, const std::string& expected_error, extensions::Manifest::Location location, int flags) { return LoadAndExpectError( - Manifest(manifest_name), expected_error, location, flags); + ManifestData(manifest_name), expected_error, location, flags); } -void ExtensionManifestTest::LoadFromStringAndExpectError( - char const* manifest_json, - const std::string& expected_error) { - return LoadAndExpectError( - Manifest(extensions::test_util::ParseJsonDictionaryWithSingleQuotes( - manifest_json)), - expected_error); -} - -void ExtensionManifestTest::AddPattern(extensions::URLPatternSet* extent, +void ManifestTest::AddPattern(extensions::URLPatternSet* extent, const std::string& pattern) { int schemes = URLPattern::SCHEME_ALL; extent->AddPattern(URLPattern(schemes, pattern)); } -ExtensionManifestTest::Testcase::Testcase( +ManifestTest::Testcase::Testcase( std::string manifest_filename, std::string expected_error, extensions::Manifest::Location location, @@ -230,7 +204,7 @@ ExtensionManifestTest::Testcase::Testcase( location_(location), flags_(flags) { } -ExtensionManifestTest::Testcase::Testcase(std::string manifest_filename, +ManifestTest::Testcase::Testcase(std::string manifest_filename, std::string expected_error) : manifest_filename_(manifest_filename), expected_error_(expected_error), @@ -238,12 +212,12 @@ ExtensionManifestTest::Testcase::Testcase(std::string manifest_filename, flags_(Extension::NO_FLAGS) { } -ExtensionManifestTest::Testcase::Testcase(std::string manifest_filename) +ManifestTest::Testcase::Testcase(std::string manifest_filename) : manifest_filename_(manifest_filename), location_(extensions::Manifest::INTERNAL), flags_(Extension::NO_FLAGS) {} -ExtensionManifestTest::Testcase::Testcase( +ManifestTest::Testcase::Testcase( std::string manifest_filename, extensions::Manifest::Location location, int flags) @@ -251,14 +225,14 @@ ExtensionManifestTest::Testcase::Testcase( location_(location), flags_(flags) {} -void ExtensionManifestTest::RunTestcases(const Testcase* testcases, +void ManifestTest::RunTestcases(const Testcase* testcases, size_t num_testcases, ExpectType type) { for (size_t i = 0; i < num_testcases; ++i) RunTestcase(testcases[i], type); } -void ExtensionManifestTest::RunTestcase(const Testcase& testcase, +void ManifestTest::RunTestcase(const Testcase& testcase, ExpectType type) { switch (type) { case EXPECT_TYPE_ERROR: @@ -280,3 +254,5 @@ void ExtensionManifestTest::RunTestcase(const Testcase& testcase, break; } } + +} // namespace extensions diff --git a/chrome/common/extensions/manifest_tests/extension_manifest_test.h b/extensions/common/manifest_test.h index 6d68cf9..d331a3b 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifest_test.h +++ b/extensions/common/manifest_test.h @@ -2,29 +2,36 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_MANIFEST_TEST_H_ -#define CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_MANIFEST_TEST_H_ +#ifndef EXTENSIONS_COMMON_MANIFEST_TEST_H_ +#define EXTENSIONS_COMMON_MANIFEST_TEST_H_ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/values.h" -#include "chrome/common/extensions/features/feature_channel.h" #include "extensions/common/extension.h" #include "extensions/common/manifest.h" #include "testing/gtest/include/gtest/gtest.h" -class ExtensionManifestTest : public testing::Test { +namespace base { +class FilePath; +} + +namespace extensions { + +// Base class for tests that parse a manifest file. +class ManifestTest : public testing::Test { public: - ExtensionManifestTest(); + ManifestTest(); + virtual ~ManifestTest(); protected: // Helper class that simplifies creating methods that take either a filename // to a manifest or the manifest itself. - class Manifest { + class ManifestData { public: - explicit Manifest(const char* name); - Manifest(base::DictionaryValue* manifest, const char* name); - explicit Manifest(scoped_ptr<base::DictionaryValue> manifest); + explicit ManifestData(const char* name); + ManifestData(base::DictionaryValue* manifest, const char* name); + explicit ManifestData(scoped_ptr<base::DictionaryValue> manifest); // C++98 requires the copy constructor for a type to be visible if you // take a const-ref of a temporary for that type. Since Manifest // contains a scoped_ptr, its implicit copy constructor is declared @@ -34,13 +41,13 @@ class ExtensionManifestTest : public testing::Test { // // To get around this spec pedantry, we declare the copy constructor // explicitly. It will never get invoked. - Manifest(const Manifest& m); + ManifestData(const ManifestData& m); - ~Manifest(); + ~ManifestData(); const std::string& name() const { return name_; }; - base::DictionaryValue* GetManifest(char const* test_data_dir, + base::DictionaryValue* GetManifest(base::FilePath manifest_path, std::string* error) const; private: @@ -49,22 +56,23 @@ class ExtensionManifestTest : public testing::Test { mutable scoped_ptr<base::DictionaryValue> manifest_holder_; }; - // The subdirectory in which to find test data files. - virtual char const* test_data_dir(); + // Returns the path in which to find test manifest data files, for example + // extensions/test/data/manifest_tests. + virtual base::FilePath GetTestDataDir(); scoped_ptr<base::DictionaryValue> LoadManifest( char const* manifest_name, std::string* error); scoped_refptr<extensions::Extension> LoadExtension( - const Manifest& manifest, + const ManifestData& manifest, std::string* error, extensions::Manifest::Location location = extensions::Manifest::INTERNAL, int flags = extensions::Extension::NO_FLAGS); scoped_refptr<extensions::Extension> LoadAndExpectSuccess( - const Manifest& manifest, + const ManifestData& manifest, extensions::Manifest::Location location = extensions::Manifest::INTERNAL, int flags = extensions::Extension::NO_FLAGS); @@ -75,13 +83,8 @@ class ExtensionManifestTest : public testing::Test { extensions::Manifest::INTERNAL, int flags = extensions::Extension::NO_FLAGS); - // Load and expect success from a manifest provided as a json string. Single - // quotes will be replaced with double quotes for test readability. - scoped_refptr<extensions::Extension> LoadFromStringAndExpectSuccess( - char const* manifest_json); - scoped_refptr<extensions::Extension> LoadAndExpectWarning( - const Manifest& manifest, + const ManifestData& manifest, const std::string& expected_error, extensions::Manifest::Location location = extensions::Manifest::INTERNAL, @@ -105,17 +108,12 @@ class ExtensionManifestTest : public testing::Test { extensions::Manifest::INTERNAL, int flags = extensions::Extension::NO_FLAGS); - void LoadAndExpectError(const Manifest& manifest, + void LoadAndExpectError(const ManifestData& manifest, const std::string& expected_error, extensions::Manifest::Location location = extensions::Manifest::INTERNAL, int flags = extensions::Extension::NO_FLAGS); - // Load and expect an error from a manifest provided as a json string. Single - // quotes will be replaced with double quotes for test readability. - void LoadFromStringAndExpectError(char const* manifest_json, - const std::string& expected_error); - void AddPattern(extensions::URLPatternSet* extent, const std::string& pattern); @@ -153,13 +151,10 @@ class ExtensionManifestTest : public testing::Test { bool enable_apps_; - // Force the manifest tests to run as though they are on trunk, since several - // tests rely on manifest features being available that aren't on - // stable/beta. - // - // These objects nest, so if a test wants to explicitly test the behaviour - // on stable or beta, declare it inside that test. - extensions::ScopedCurrentChannel current_channel_; + private: + DISALLOW_COPY_AND_ASSIGN(ManifestTest); }; -#endif // CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_MANIFEST_TEST_H_ +} // namespace extensions + +#endif // EXTENSIONS_COMMON_MANIFEST_TEST_H_ diff --git a/extensions/common/test_util.cc b/extensions/common/test_util.cc index 03b35b8..4eacfa6 100644 --- a/extensions/common/test_util.cc +++ b/extensions/common/test_util.cc @@ -4,12 +4,9 @@ #include "extensions/common/test_util.h" -#include "base/json/json_reader.h" -#include "base/values.h" #include "extensions/common/extension.h" #include "extensions/common/extension_builder.h" #include "extensions/common/value_builder.h" -#include "testing/gtest/include/gtest/gtest.h" namespace extensions { namespace test_util { @@ -39,21 +36,5 @@ scoped_refptr<Extension> CreateExtensionWithID(const std::string& id) { .Build(); } -scoped_ptr<base::DictionaryValue> ParseJsonDictionaryWithSingleQuotes( - std::string json) { - std::replace(json.begin(), json.end(), '\'', '"'); - std::string error_msg; - scoped_ptr<base::Value> result(base::JSONReader::ReadAndReturnError( - json, base::JSON_ALLOW_TRAILING_COMMAS, NULL, &error_msg)); - scoped_ptr<base::DictionaryValue> result_dict; - if (result && result->IsType(base::Value::TYPE_DICTIONARY)) { - result_dict.reset(static_cast<base::DictionaryValue*>(result.release())); - } else { - ADD_FAILURE() << "Failed to parse \"" << json << "\": " << error_msg; - result_dict.reset(new base::DictionaryValue()); - } - return result_dict.Pass(); -} - } // namespace test_util } // namespace extensions diff --git a/extensions/common/test_util.h b/extensions/common/test_util.h index 46ac5d08..862c469 100644 --- a/extensions/common/test_util.h +++ b/extensions/common/test_util.h @@ -8,11 +8,6 @@ #include <string> #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" - -namespace base { -class DictionaryValue; -} // namespace base namespace extensions { class Extension; @@ -30,12 +25,6 @@ scoped_refptr<Extension> CreateEmptyExtension(); // Return a very simple extension with a given |id|. scoped_refptr<Extension> CreateExtensionWithID(const std::string& id); -// Parses |json| allowing trailing commas and replacing single quotes with -// double quotes for test readability. If the json fails to parse, calls gtest's -// ADD_FAILURE and returns an empty dictionary. -scoped_ptr<base::DictionaryValue> ParseJsonDictionaryWithSingleQuotes( - std::string json); - } // namespace test_util } // namespace extensions diff --git a/extensions/extensions.gyp b/extensions/extensions.gyp index c39ff3c..57e6e05 100644 --- a/extensions/extensions.gyp +++ b/extensions/extensions.gyp @@ -930,6 +930,8 @@ 'browser/test_runtime_api_delegate.h', 'common/extension_builder.cc', 'common/extension_builder.h', + 'common/manifest_test.cc', + 'common/manifest_test.h', 'common/test_util.cc', 'common/test_util.h', 'common/value_builder.cc', @@ -1090,6 +1092,7 @@ 'common/features/complex_feature_unittest.cc', 'common/features/simple_feature_unittest.cc', 'common/manifest_handler_unittest.cc', + 'common/manifest_handlers/shared_module_manifest_unittest.cc', 'common/message_bundle_unittest.cc', 'common/one_shot_event_unittest.cc', 'common/permissions/api_permission_set_unittest.cc', diff --git a/chrome/test/data/extensions/manifest_tests/shared_module_export.json b/extensions/test/data/manifest_tests/shared_module_export.json index 49c0c11..49c0c11 100644 --- a/chrome/test/data/extensions/manifest_tests/shared_module_export.json +++ b/extensions/test/data/manifest_tests/shared_module_export.json diff --git a/chrome/test/data/extensions/manifest_tests/shared_module_export_and_import.json b/extensions/test/data/manifest_tests/shared_module_export_and_import.json index 3f59ac2..3f59ac2 100644 --- a/chrome/test/data/extensions/manifest_tests/shared_module_export_and_import.json +++ b/extensions/test/data/manifest_tests/shared_module_export_and_import.json diff --git a/chrome/test/data/extensions/manifest_tests/shared_module_export_foo.json b/extensions/test/data/manifest_tests/shared_module_export_foo.json index e0b583f..e0b583f 100644 --- a/chrome/test/data/extensions/manifest_tests/shared_module_export_foo.json +++ b/extensions/test/data/manifest_tests/shared_module_export_foo.json diff --git a/chrome/test/data/extensions/manifest_tests/shared_module_export_no_whitelist.json b/extensions/test/data/manifest_tests/shared_module_export_no_whitelist.json index aafb5f8..aafb5f8 100644 --- a/chrome/test/data/extensions/manifest_tests/shared_module_export_no_whitelist.json +++ b/extensions/test/data/manifest_tests/shared_module_export_no_whitelist.json diff --git a/chrome/test/data/extensions/manifest_tests/shared_module_export_not_dict.json b/extensions/test/data/manifest_tests/shared_module_export_not_dict.json index 2500644..2500644 100644 --- a/chrome/test/data/extensions/manifest_tests/shared_module_export_not_dict.json +++ b/extensions/test/data/manifest_tests/shared_module_export_not_dict.json diff --git a/chrome/test/data/extensions/manifest_tests/shared_module_export_resource_not_string.json b/extensions/test/data/manifest_tests/shared_module_export_resource_not_string.json index 2021553..2021553 100644 --- a/chrome/test/data/extensions/manifest_tests/shared_module_export_resource_not_string.json +++ b/extensions/test/data/manifest_tests/shared_module_export_resource_not_string.json diff --git a/chrome/test/data/extensions/manifest_tests/shared_module_export_resources_not_list.json b/extensions/test/data/manifest_tests/shared_module_export_resources_not_list.json index 76971072..76971072 100644 --- a/chrome/test/data/extensions/manifest_tests/shared_module_export_resources_not_list.json +++ b/extensions/test/data/manifest_tests/shared_module_export_resources_not_list.json diff --git a/chrome/test/data/extensions/manifest_tests/shared_module_export_whitelist_item_not_id.json b/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_id.json index 6c1bb1b..6c1bb1b 100644 --- a/chrome/test/data/extensions/manifest_tests/shared_module_export_whitelist_item_not_id.json +++ b/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_id.json diff --git a/chrome/test/data/extensions/manifest_tests/shared_module_export_whitelist_item_not_string.json b/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_string.json index 2e75502..2e75502 100644 --- a/chrome/test/data/extensions/manifest_tests/shared_module_export_whitelist_item_not_string.json +++ b/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_string.json diff --git a/chrome/test/data/extensions/manifest_tests/shared_module_export_whitelist_not_list.json b/extensions/test/data/manifest_tests/shared_module_export_whitelist_not_list.json index 06d3e18..06d3e18 100644 --- a/chrome/test/data/extensions/manifest_tests/shared_module_export_whitelist_not_list.json +++ b/extensions/test/data/manifest_tests/shared_module_export_whitelist_not_list.json diff --git a/chrome/test/data/extensions/manifest_tests/shared_module_import.json b/extensions/test/data/manifest_tests/shared_module_import.json index ca9e170..ca9e170 100644 --- a/chrome/test/data/extensions/manifest_tests/shared_module_import.json +++ b/extensions/test/data/manifest_tests/shared_module_import.json diff --git a/chrome/test/data/extensions/manifest_tests/shared_module_import_invalid_id.json b/extensions/test/data/manifest_tests/shared_module_import_invalid_id.json index aadd9ae..aadd9ae 100644 --- a/chrome/test/data/extensions/manifest_tests/shared_module_import_invalid_id.json +++ b/extensions/test/data/manifest_tests/shared_module_import_invalid_id.json diff --git a/chrome/test/data/extensions/manifest_tests/shared_module_import_invalid_version.json b/extensions/test/data/manifest_tests/shared_module_import_invalid_version.json index 77a921c..77a921c 100644 --- a/chrome/test/data/extensions/manifest_tests/shared_module_import_invalid_version.json +++ b/extensions/test/data/manifest_tests/shared_module_import_invalid_version.json diff --git a/chrome/test/data/extensions/manifest_tests/shared_module_import_not_list.json b/extensions/test/data/manifest_tests/shared_module_import_not_list.json index a989bd9..a989bd9 100644 --- a/chrome/test/data/extensions/manifest_tests/shared_module_import_not_list.json +++ b/extensions/test/data/manifest_tests/shared_module_import_not_list.json |