diff options
70 files changed, 296 insertions, 297 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 473c348..317c95f 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class StreamsPrivateManifestTest : public ExtensionManifestTest { }; TEST_F(StreamsPrivateManifestTest, ValidMimeTypesHandlerMIMETypes) { diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index 2ee572e..a8cb9dc 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -19,6 +19,7 @@ '../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. @@ -1279,8 +1280,7 @@ '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/chrome_manifest_test.cc', - 'common/extensions/manifest_tests/chrome_manifest_test.h', + 'common/extensions/manifest_tests/extension_manifest_test.cc', '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 022d149..bb87595 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class CommandsManifestTest : public ExtensionManifestTest { }; 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 98544f8..f69ae14 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class BrowserActionManifestTest : public ExtensionManifestTest { }; TEST_F(BrowserActionManifestTest, @@ -105,7 +105,7 @@ TEST_F(BrowserActionManifestTest, base::string16 error = ErrorUtils::FormatErrorMessageUTF16( errors::kInvalidIconPath, "19"); - LoadAndExpectError(ManifestData(manifest_value.get(), "Invalid default icon"), + LoadAndExpectError(Manifest(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 51a5b4f..7cbf241 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,10 +2,8 @@ // 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "extensions/common/constants.h" #include "extensions/common/error_utils.h" #include "extensions/common/extension.h" @@ -17,12 +15,10 @@ namespace extensions { namespace errors = manifest_errors; namespace keys = manifest_keys; -class PageActionManifestTest : public ChromeManifestTest { +class PageActionManifestTest : public ExtensionManifestTest { protected: - virtual base::FilePath GetTestDataDir() OVERRIDE { - base::FilePath path; - PathService::Get(chrome::DIR_TEST_DATA, &path); - return path.AppendASCII("extensions").AppendASCII("page_action"); + virtual const char* test_data_dir() OVERRIDE { + return "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 d829eaf..16e669e 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class FileBrowserHandlerManifestTest : public ExtensionManifestTest { }; 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 351b094..56bbb53 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "extensions/common/manifest_constants.h" #include "testing/gtest/include/gtest/gtest.h" namespace extensions { -class DefaultLocaleManifestTest : public ChromeManifestTest { +class DefaultLocaleManifestTest : public ExtensionManifestTest { }; 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 0606c32..ae383d8 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class OAuth2ManifestTest : public ExtensionManifestTest { 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); - ManifestData manifest(&ext_manifest, "test"); + Manifest 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); - ManifestData manifest(&app_manifest, "test"); + Manifest 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); - ManifestData manifest(&app_manifest, "test"); + Manifest 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); - ManifestData manifest(ext_manifest, "test"); + Manifest 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); - ManifestData manifest(ext_manifest, "test"); + Manifest 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); - ManifestData manifest(ext_manifest, "test"); + Manifest 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); - ManifestData manifest(ext_manifest, "test"); + Manifest 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); - ManifestData manifest(ext_manifest, "test"); + Manifest 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); - ManifestData manifest(ext_manifest, "test"); + Manifest 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); - ManifestData manifest(ext_manifest, "test"); + Manifest 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); - ManifestData manifest(ext_manifest, "test"); + Manifest 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); - ManifestData manifest(ext_manifest, "test"); + Manifest 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); - ManifestData manifest(ext_manifest, "test"); + Manifest 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); - ManifestData manifest(ext_manifest, "test"); + Manifest 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); - ManifestData manifest(ext_manifest, "test"); + Manifest 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); - ManifestData manifest(ext_manifest, "test"); + Manifest 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); - ManifestData manifest(ext_manifest, "test"); + Manifest 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); - ManifestData manifest(ext_manifest, "test"); + Manifest 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 96c13e4..9148782 100644 --- a/chrome/common/extensions/manifest_handlers/automation_unittest.cc +++ b/chrome/common/extensions/manifest_handlers/automation_unittest.cc @@ -3,9 +3,8 @@ // 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "chrome/grit/generated_resources.h" #include "extensions/common/error_utils.h" #include "extensions/common/manifest_constants.h" @@ -15,7 +14,7 @@ namespace extensions { -class AutomationManifestTest : public ChromeManifestTest { +class AutomationManifestTest : public ExtensionManifestTest { public: AutomationManifestTest() : channel_(chrome::VersionInfo::CHANNEL_UNKNOWN) {} @@ -157,7 +156,7 @@ TEST_F(AutomationManifestTest, EmptyMatches) { TEST_F(AutomationManifestTest, NoValidMatches) { std::string error; scoped_refptr<Extension> extension = - LoadExtension(ManifestData("automation_no_valid_matches.json"), &error); + LoadExtension(Manifest("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 8b831da..907ab92 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class ContentScriptsManifestTest : public ExtensionManifestTest { }; 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 7a08efb..ef0cd0d 100644 --- a/chrome/common/extensions/manifest_handlers/exclude_matches_manifest_unittest.cc +++ b/chrome/common/extensions/manifest_handlers/exclude_matches_manifest_unittest.cc @@ -2,13 +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/chrome_manifest_test.h" + +#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "extensions/common/extension.h" #include "testing/gtest/include/gtest/gtest.h" namespace extensions { -class ExcludeMatchesManifestTest : public ChromeManifestTest { +class ExcludeMatchesManifestTest : public ExtensionManifestTest { }; 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 deleted file mode 100644 index 96f3f06..0000000 --- a/chrome/common/extensions/manifest_tests/chrome_manifest_test.cc +++ /dev/null @@ -1,21 +0,0 @@ -// 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 deleted file mode 100644 index 7ff77f6..0000000 --- a/chrome/common/extensions/manifest_tests/chrome_manifest_test.h +++ /dev/null @@ -1,26 +0,0 @@ -// 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/extensions/common/manifest_test.cc b/chrome/common/extensions/manifest_tests/extension_manifest_test.cc index b1ab115..c2936d8 100644 --- a/extensions/common/manifest_test.cc +++ b/chrome/common/extensions/manifest_tests/extension_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 "extensions/common/manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "base/files/file_path.h" #include "base/files/file_util.h" @@ -10,18 +10,25 @@ #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" -namespace extensions { +using extensions::Extension; + namespace { -// |manifest_path| is an absolute path to a manifest file. -base::DictionaryValue* LoadManifestFile(const base::FilePath& manifest_path, +// If filename is a relative path, LoadManifestFile will treat it relative to +// the appropriate test directory. +base::DictionaryValue* LoadManifestFile(const base::FilePath& filename_path, std::string* error) { - base::FilePath extension_path = manifest_path.DirName(); + 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(); EXPECT_TRUE(base::PathExists(manifest_path)) << "Couldn't find " << manifest_path.value(); @@ -35,7 +42,7 @@ base::DictionaryValue* LoadManifestFile(const base::FilePath& manifest_path, // Only localize manifests that indicate they want to be localized. // Calling LocalizeExtension at this point mirrors file_util::LoadExtension. if (manifest && - manifest_path.value().find(FILE_PATH_LITERAL("localized")) != + filename_path.value().find(FILE_PATH_LITERAL("localized")) != std::string::npos) extension_l10n_util::LocalizeExtension(extension_path, manifest, error); @@ -44,76 +51,79 @@ base::DictionaryValue* LoadManifestFile(const base::FilePath& manifest_path, } // namespace -ManifestTest::ManifestTest() - : enable_apps_(true) { -} - -ManifestTest::~ManifestTest() { -} +ExtensionManifestTest::ExtensionManifestTest() + : enable_apps_(true), + // UNKNOWN == trunk. + current_channel_(chrome::VersionInfo::CHANNEL_UNKNOWN) {} // Helper class that simplifies creating methods that take either a filename // to a manifest or the manifest itself. -ManifestTest::ManifestData::ManifestData(const char* name) +ExtensionManifestTest::Manifest::Manifest(const char* name) : name_(name), manifest_(NULL) { } -ManifestTest::ManifestData::ManifestData(base::DictionaryValue* manifest, +ExtensionManifestTest::Manifest::Manifest(base::DictionaryValue* manifest, const char* name) : name_(name), manifest_(manifest) { CHECK(manifest_) << "Manifest NULL"; } -ManifestTest::ManifestData::ManifestData( +ExtensionManifestTest::Manifest::Manifest( scoped_ptr<base::DictionaryValue> manifest) : manifest_(manifest.get()), manifest_holder_(manifest.Pass()) { CHECK(manifest_) << "Manifest NULL"; } -ManifestTest::ManifestData::ManifestData(const ManifestData& m) { +ExtensionManifestTest::Manifest::Manifest(const Manifest& m) { NOTREACHED(); } -ManifestTest::ManifestData::~ManifestData() { +ExtensionManifestTest::Manifest::~Manifest() { } -base::DictionaryValue* ManifestTest::ManifestData::GetManifest( - base::FilePath test_data_dir, std::string* error) const { +base::DictionaryValue* ExtensionManifestTest::Manifest::GetManifest( + char const* test_data_dir, std::string* error) const { if (manifest_) return manifest_; - base::FilePath manifest_path = test_data_dir.AppendASCII(name_); - manifest_ = LoadManifestFile(manifest_path, error); + base::FilePath filename_path; + filename_path = filename_path.AppendASCII("extensions") + .AppendASCII(test_data_dir) + .AppendASCII(name_); + manifest_ = LoadManifestFile(filename_path, error); manifest_holder_.reset(manifest_); return manifest_; } -base::FilePath ManifestTest::GetTestDataDir() { - base::FilePath path; - PathService::Get(DIR_TEST_DATA, &path); - return path.AppendASCII("manifest_tests"); +char const* ExtensionManifestTest::test_data_dir() { + return "manifest_tests"; } -scoped_ptr<base::DictionaryValue> ManifestTest::LoadManifest( +scoped_ptr<base::DictionaryValue> ExtensionManifestTest::LoadManifest( char const* manifest_name, std::string* error) { - base::FilePath manifest_path = GetTestDataDir().AppendASCII(manifest_name); - return make_scoped_ptr(LoadManifestFile(manifest_path, 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)); } -scoped_refptr<Extension> ManifestTest::LoadExtension( - const ManifestData& manifest, +scoped_refptr<Extension> ExtensionManifestTest::LoadExtension( + const Manifest& manifest, std::string* error, extensions::Manifest::Location location, int flags) { - base::FilePath test_data_dir = GetTestDataDir(); - base::DictionaryValue* value = manifest.GetManifest(test_data_dir, error); + base::DictionaryValue* value = manifest.GetManifest(test_data_dir(), error); if (!value) return NULL; - return Extension::Create( - test_data_dir.DirName(), location, *value, flags, error); + 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); } -scoped_refptr<Extension> ManifestTest::LoadAndExpectSuccess( - const ManifestData& manifest, +scoped_refptr<Extension> ExtensionManifestTest::LoadAndExpectSuccess( + const Manifest& manifest, extensions::Manifest::Location location, int flags) { std::string error; @@ -124,15 +134,22 @@ scoped_refptr<Extension> ManifestTest::LoadAndExpectSuccess( return extension; } -scoped_refptr<Extension> ManifestTest::LoadAndExpectSuccess( +scoped_refptr<Extension> ExtensionManifestTest::LoadAndExpectSuccess( char const* manifest_name, extensions::Manifest::Location location, int flags) { - return LoadAndExpectSuccess(ManifestData(manifest_name), location, flags); + return LoadAndExpectSuccess(Manifest(manifest_name), location, flags); } -scoped_refptr<Extension> ManifestTest::LoadAndExpectWarning( - const ManifestData& manifest, +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, const std::string& expected_warning, extensions::Manifest::Location location, int flags) { @@ -146,16 +163,16 @@ scoped_refptr<Extension> ManifestTest::LoadAndExpectWarning( return extension; } -scoped_refptr<Extension> ManifestTest::LoadAndExpectWarning( +scoped_refptr<Extension> ExtensionManifestTest::LoadAndExpectWarning( char const* manifest_name, const std::string& expected_warning, extensions::Manifest::Location location, int flags) { return LoadAndExpectWarning( - ManifestData(manifest_name), expected_warning, location, flags); + Manifest(manifest_name), expected_warning, location, flags); } -void ManifestTest::VerifyExpectedError( +void ExtensionManifestTest::VerifyExpectedError( Extension* extension, const std::string& name, const std::string& error, @@ -167,8 +184,8 @@ void ManifestTest::VerifyExpectedError( " expected '" << expected_error << "' but got '" << error << "'"; } -void ManifestTest::LoadAndExpectError( - const ManifestData& manifest, +void ExtensionManifestTest::LoadAndExpectError( + const Manifest& manifest, const std::string& expected_error, extensions::Manifest::Location location, int flags) { @@ -179,22 +196,31 @@ void ManifestTest::LoadAndExpectError( expected_error); } -void ManifestTest::LoadAndExpectError( +void ExtensionManifestTest::LoadAndExpectError( char const* manifest_name, const std::string& expected_error, extensions::Manifest::Location location, int flags) { return LoadAndExpectError( - ManifestData(manifest_name), expected_error, location, flags); + Manifest(manifest_name), expected_error, location, flags); } -void ManifestTest::AddPattern(extensions::URLPatternSet* extent, +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, const std::string& pattern) { int schemes = URLPattern::SCHEME_ALL; extent->AddPattern(URLPattern(schemes, pattern)); } -ManifestTest::Testcase::Testcase( +ExtensionManifestTest::Testcase::Testcase( std::string manifest_filename, std::string expected_error, extensions::Manifest::Location location, @@ -204,7 +230,7 @@ ManifestTest::Testcase::Testcase( location_(location), flags_(flags) { } -ManifestTest::Testcase::Testcase(std::string manifest_filename, +ExtensionManifestTest::Testcase::Testcase(std::string manifest_filename, std::string expected_error) : manifest_filename_(manifest_filename), expected_error_(expected_error), @@ -212,12 +238,12 @@ ManifestTest::Testcase::Testcase(std::string manifest_filename, flags_(Extension::NO_FLAGS) { } -ManifestTest::Testcase::Testcase(std::string manifest_filename) +ExtensionManifestTest::Testcase::Testcase(std::string manifest_filename) : manifest_filename_(manifest_filename), location_(extensions::Manifest::INTERNAL), flags_(Extension::NO_FLAGS) {} -ManifestTest::Testcase::Testcase( +ExtensionManifestTest::Testcase::Testcase( std::string manifest_filename, extensions::Manifest::Location location, int flags) @@ -225,14 +251,14 @@ ManifestTest::Testcase::Testcase( location_(location), flags_(flags) {} -void ManifestTest::RunTestcases(const Testcase* testcases, +void ExtensionManifestTest::RunTestcases(const Testcase* testcases, size_t num_testcases, ExpectType type) { for (size_t i = 0; i < num_testcases; ++i) RunTestcase(testcases[i], type); } -void ManifestTest::RunTestcase(const Testcase& testcase, +void ExtensionManifestTest::RunTestcase(const Testcase& testcase, ExpectType type) { switch (type) { case EXPECT_TYPE_ERROR: @@ -254,5 +280,3 @@ void ManifestTest::RunTestcase(const Testcase& testcase, break; } } - -} // namespace extensions diff --git a/extensions/common/manifest_test.h b/chrome/common/extensions/manifest_tests/extension_manifest_test.h index d331a3b..6d68cf9 100644 --- a/extensions/common/manifest_test.h +++ b/chrome/common/extensions/manifest_tests/extension_manifest_test.h @@ -2,36 +2,29 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef EXTENSIONS_COMMON_MANIFEST_TEST_H_ -#define EXTENSIONS_COMMON_MANIFEST_TEST_H_ +#ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_MANIFEST_TEST_H_ +#define CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_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" -namespace base { -class FilePath; -} - -namespace extensions { - -// Base class for tests that parse a manifest file. -class ManifestTest : public testing::Test { +class ExtensionManifestTest : public testing::Test { public: - ManifestTest(); - virtual ~ManifestTest(); + ExtensionManifestTest(); protected: // Helper class that simplifies creating methods that take either a filename // to a manifest or the manifest itself. - class ManifestData { + class Manifest { public: - explicit ManifestData(const char* name); - ManifestData(base::DictionaryValue* manifest, const char* name); - explicit ManifestData(scoped_ptr<base::DictionaryValue> manifest); + explicit Manifest(const char* name); + Manifest(base::DictionaryValue* manifest, const char* name); + explicit Manifest(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 @@ -41,13 +34,13 @@ class ManifestTest : public testing::Test { // // To get around this spec pedantry, we declare the copy constructor // explicitly. It will never get invoked. - ManifestData(const ManifestData& m); + Manifest(const Manifest& m); - ~ManifestData(); + ~Manifest(); const std::string& name() const { return name_; }; - base::DictionaryValue* GetManifest(base::FilePath manifest_path, + base::DictionaryValue* GetManifest(char const* test_data_dir, std::string* error) const; private: @@ -56,23 +49,22 @@ class ManifestTest : public testing::Test { mutable scoped_ptr<base::DictionaryValue> manifest_holder_; }; - // Returns the path in which to find test manifest data files, for example - // extensions/test/data/manifest_tests. - virtual base::FilePath GetTestDataDir(); + // The subdirectory in which to find test data files. + virtual char const* test_data_dir(); scoped_ptr<base::DictionaryValue> LoadManifest( char const* manifest_name, std::string* error); scoped_refptr<extensions::Extension> LoadExtension( - const ManifestData& manifest, + const Manifest& manifest, std::string* error, extensions::Manifest::Location location = extensions::Manifest::INTERNAL, int flags = extensions::Extension::NO_FLAGS); scoped_refptr<extensions::Extension> LoadAndExpectSuccess( - const ManifestData& manifest, + const Manifest& manifest, extensions::Manifest::Location location = extensions::Manifest::INTERNAL, int flags = extensions::Extension::NO_FLAGS); @@ -83,8 +75,13 @@ class ManifestTest : 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 ManifestData& manifest, + const Manifest& manifest, const std::string& expected_error, extensions::Manifest::Location location = extensions::Manifest::INTERNAL, @@ -108,12 +105,17 @@ class ManifestTest : public testing::Test { extensions::Manifest::INTERNAL, int flags = extensions::Extension::NO_FLAGS); - void LoadAndExpectError(const ManifestData& manifest, + void LoadAndExpectError(const Manifest& 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); @@ -151,10 +153,13 @@ class ManifestTest : public testing::Test { bool enable_apps_; - private: - DISALLOW_COPY_AND_ASSIGN(ManifestTest); + // 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_; }; -} // namespace extensions - -#endif // EXTENSIONS_COMMON_MANIFEST_TEST_H_ +#endif // CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_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 c0dd431..b177fbf 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest {}; +class AboutPageManifestTest : public ExtensionManifestTest {}; 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 b78180f..ae819d8 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class ExtensionManifestBackgroundTest : public ExtensionManifestTest { }; TEST_F(ExtensionManifestBackgroundTest, BackgroundPermission) { @@ -35,7 +35,7 @@ TEST_F(ExtensionManifestBackgroundTest, BackgroundScripts) { ASSERT_TRUE(manifest.get()); scoped_refptr<Extension> extension( - LoadAndExpectSuccess(ManifestData(manifest.get(), ""))); + LoadAndExpectSuccess(Manifest(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(ManifestData(manifest.get(), ""), + LoadAndExpectError(Manifest(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(ManifestData(manifest.get(), "")); + extension = LoadAndExpectSuccess(Manifest(manifest.get(), "")); ASSERT_TRUE(extension.get()); EXPECT_EQ("/foo.html", BackgroundInfo::GetBackgroundURL(extension.get()).path()); manifest->SetInteger(keys::kManifestVersion, 2); LoadAndExpectWarning( - ManifestData(manifest.get(), ""), + Manifest(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(ManifestData(manifest.get(), ""))); + LoadAndExpectSuccess(Manifest(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(ManifestData(manifest.get(), ""), + LoadAndExpectError(Manifest(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 d5b112f..ad05250 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "chrome/common/url_constants.h" #include "extensions/common/error_utils.h" #include "extensions/common/extension.h" @@ -17,16 +17,14 @@ namespace extensions { namespace errors = manifest_errors; -typedef ChromeManifestTest ChromePermissionManifestTest; - -TEST_F(ChromePermissionManifestTest, ChromeURLPermissionInvalid) { +TEST_F(ExtensionManifestTest, ChromeURLPermissionInvalid) { LoadAndExpectWarning("permission_chrome_url_invalid.json", ErrorUtils::FormatErrorMessage( errors::kInvalidPermissionScheme, chrome::kChromeUINewTabURL)); } -TEST_F(ChromePermissionManifestTest, ChromeURLPermissionAllowedWithFlag) { +TEST_F(ExtensionManifestTest, ChromeURLPermissionAllowedWithFlag) { // Ignore the policy delegate for this test. PermissionsData::SetPolicyDelegate(NULL); CommandLine::ForCurrentProcess()->AppendSwitch( @@ -41,14 +39,13 @@ TEST_F(ChromePermissionManifestTest, ChromeURLPermissionAllowedWithFlag) { << error; } -TEST_F(ChromePermissionManifestTest, - ChromeResourcesPermissionValidOnlyForComponents) { +TEST_F(ExtensionManifestTest, ChromeResourcesPermissionValidOnlyForComponents) { LoadAndExpectWarning("permission_chrome_resources_url.json", ErrorUtils::FormatErrorMessage( errors::kInvalidPermissionScheme, "chrome://resources/")); std::string error; - LoadExtension(ManifestData("permission_chrome_resources_url.json"), + LoadExtension(Manifest("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 ef13f96..549b2aa 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "extensions/common/manifest_constants.h" #include "testing/gtest/include/gtest/gtest.h" namespace errors = extensions::manifest_errors; -class ContentSecurityPolicyManifestTest : public ChromeManifestTest { +class ContentSecurityPolicyManifestTest : public ExtensionManifestTest { }; 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 9d2a9bb..aeead3f 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "extensions/common/extension.h" #include "testing/gtest/include/gtest/gtest.h" -TEST_F(ChromeManifestTest, DefaultPathForExtent) { +TEST_F(ExtensionManifestTest, 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 3528ada..290a434 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class DevToolsPageManifestTest : public ExtensionManifestTest { }; 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 1e9a34e..73c1350 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" namespace extensions { -TEST_F(ChromeManifestTest, PlatformsKey) { +TEST_F(ExtensionManifestTest, PlatformsKey) { scoped_refptr<Extension> extension = LoadAndExpectSuccess("platforms_key.json"); EXPECT_EQ(0u, extension->install_warnings().size()); } -TEST_F(ChromeManifestTest, UnrecognizedKeyWarning) { +TEST_F(ExtensionManifestTest, 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 6c1b727..b376f47 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "base/command_line.h" #include "extensions/common/extension.h" @@ -13,7 +13,7 @@ namespace errors = extensions::manifest_errors; -TEST_F(ChromeManifestTest, ExperimentalPermission) { +TEST_F(ExtensionManifestTest, 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 a72b98c..8b9c685 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class HomepageURLManifestTest : public ExtensionManifestTest { }; 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 20c26bb..e827559 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class IconsManifestTest : public ExtensionManifestTest { }; 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 6807f8a..51c648b 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class InitValueManifestTest : public ExtensionManifestTest { }; 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 ead28c4..26abab5 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class IsolatedAppsManifestTest : public ExtensionManifestTest { }; 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 3922cc7..f79d79d 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class ExtensionManifestKioskModeTest : public ExtensionManifestTest { }; 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 d8e31eb..6912dac 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class AppLaunchManifestTest : public ExtensionManifestTest { }; 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 8d9007f..be7ba75 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest LauncherPageManifestTest; +typedef ExtensionManifestTest 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 b715831..cce186b 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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(ChromeManifestTest, ManifestVersionError) { +TEST_F(ExtensionManifestTest, ManifestVersionError) { scoped_ptr<base::DictionaryValue> manifest1(new base::DictionaryValue()); manifest1->SetString("name", "Miles"); manifest1->SetString("version", "0.55"); @@ -43,13 +43,13 @@ TEST_F(ChromeManifestTest, ManifestVersionError) { create_flags |= Extension::REQUIRE_MODERN_MANIFEST_VERSION; if (test_data[i].expect_error) { LoadAndExpectError( - ManifestData(test_data[i].manifest, + Manifest(test_data[i].manifest, test_data[i].test_name), errors::kInvalidManifestVersionOld, extensions::Manifest::UNPACKED, create_flags); } else { - LoadAndExpectSuccess(ManifestData(test_data[i].manifest, + LoadAndExpectSuccess(Manifest(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 67934e4..be0628d 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class ExtensionManifestOfflineEnabledTest : public ExtensionManifestTest { }; 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 e9fd914..2091280 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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(ChromeManifestTest, OldUnlimitedStoragePermission) { +TEST_F(ExtensionManifestTest, 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 03527cb..a51ce9c 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class OptionsPageManifestTest : public ExtensionManifestTest { }; 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 8a5ac9f..7c8b1b0 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class URLOverridesManifestTest : public ExtensionManifestTest { }; 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 6c168e0a..ddbe4b4 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class PlatformAppsManifestTest : public ExtensionManifestTest { }; 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(ManifestData(manifests[i].get(), ""), + LoadAndExpectError(Manifest(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(ManifestData(manifests[i].get(), "")); + LoadAndExpectSuccess(Manifest(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 874d7e8..e9207cc 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "testing/gtest/include/gtest/gtest.h" -TEST_F(ChromeManifestTest, PortsInPermissions) { +TEST_F(ExtensionManifestTest, 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 99c1a9d..c1b5fb8 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class RequirementsManifestTest : public ExtensionManifestTest { }; 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 c467e17..9220aed 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class SandboxedPagesManifestTest : public ExtensionManifestTest { }; 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 4e731c8..fc60bac 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "extensions/common/manifest_constants.h" #include "testing/gtest/include/gtest/gtest.h" namespace keys = extensions::manifest_keys; -TEST_F(ChromeManifestTest, StorageAPIManifestVersionAvailability) { +TEST_F(ExtensionManifestTest, StorageAPIManifestVersionAvailability) { base::DictionaryValue base_manifest; { base_manifest.SetString(keys::kName, "test"); @@ -24,7 +24,7 @@ TEST_F(ChromeManifestTest, StorageAPIManifestVersionAvailability) { // Extension with no manifest version cannot use storage API. { - ManifestData manifest(&base_manifest, "test"); + Manifest manifest(&base_manifest, "test"); LoadAndExpectWarning(manifest, kManifestVersionError); } @@ -34,7 +34,7 @@ TEST_F(ChromeManifestTest, StorageAPIManifestVersionAvailability) { manifest_with_version.SetInteger(keys::kManifestVersion, 1); manifest_with_version.MergeDictionary(&base_manifest); - ManifestData manifest(&manifest_with_version, "test"); + Manifest manifest(&manifest_with_version, "test"); LoadAndExpectWarning(manifest, kManifestVersionError); } @@ -44,7 +44,7 @@ TEST_F(ChromeManifestTest, StorageAPIManifestVersionAvailability) { manifest_with_version.SetInteger(keys::kManifestVersion, 2); manifest_with_version.MergeDictionary(&base_manifest); - ManifestData manifest(&manifest_with_version, "test"); + Manifest 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 264eb9d..def777f 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "extensions/common/manifest_constants.h" #include "testing/gtest/include/gtest/gtest.h" namespace extensions { -class UIManifestTest : public ChromeManifestTest { +class UIManifestTest : public ExtensionManifestTest { }; 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 0b3ef20..0f01502 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class UpdateURLManifestTest : public ExtensionManifestTest { }; 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 11174b0..98b8b5a 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "testing/gtest/include/gtest/gtest.h" -typedef ChromeManifestTest ValidAppManifestTest; +typedef ExtensionManifestTest 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(ManifestData(manifest.get(), "")); + LoadAndExpectSuccess(Manifest(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 ee6b8d5..f1df3ae 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class WebAccessibleResourcesManifestTest : public ExtensionManifestTest { }; 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 9fdd7de..1f97025 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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(ChromeManifestTest, AppWebUrls) { +TEST_F(ExtensionManifestTest, 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 1f85786..e7f4561 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class WebviewAccessibleResourcesManifestTest : public ExtensionManifestTest { }; TEST_F(WebviewAccessibleResourcesManifestTest, WebviewAccessibleResources) { diff --git a/chrome/common/extensions/manifest_unittest.cc b/chrome/common/extensions/manifest_unittest.cc index 6bf35e6..97150f1 100644 --- a/chrome/common/extensions/manifest_unittest.cc +++ b/chrome/common/extensions/manifest_unittest.cc @@ -23,10 +23,9 @@ namespace extensions { namespace errors = manifest_errors; namespace keys = manifest_keys; -// Not named "ManifestTest" because a test utility class has that name. -class ManifestUnitTest : public testing::Test { +class ManifestTest : public testing::Test { public: - ManifestUnitTest() : default_value_("test") {} + ManifestTest() : default_value_("test") {} protected: void AssertType(Manifest* manifest, Manifest::Type type) { @@ -60,7 +59,7 @@ class ManifestUnitTest : public testing::Test { }; // Verifies that extensions can access the correct keys. -TEST_F(ManifestUnitTest, Extension) { +TEST_F(ManifestTest, Extension) { scoped_ptr<base::DictionaryValue> manifest_value(new base::DictionaryValue()); manifest_value->SetString(keys::kName, "extension"); manifest_value->SetString(keys::kVersion, "1"); @@ -118,7 +117,7 @@ TEST_F(ManifestUnitTest, Extension) { } // Verifies that key restriction based on type works. -TEST_F(ManifestUnitTest, ExtensionTypes) { +TEST_F(ManifestTest, ExtensionTypes) { scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); value->SetString(keys::kName, "extension"); value->SetString(keys::kVersion, "1"); @@ -174,7 +173,7 @@ TEST_F(ManifestUnitTest, ExtensionTypes) { }; // Verifies that the getters filter restricted keys. -TEST_F(ManifestUnitTest, RestrictedKeys) { +TEST_F(ManifestTest, 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 e154769..61f6b5b 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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 ChromeManifestTest { +class SettingsOverridePermissionTest : public ExtensionManifestTest { protected: enum Flags { kHomepage = 1, @@ -56,7 +56,7 @@ class SettingsOverridePermissionTest : public ChromeManifestTest { ext_manifest.Set( manifest_keys::kSettingsOverride, settings_override.release()); - ManifestData manifest(&ext_manifest, "test"); + Manifest manifest(&ext_manifest, "test"); return LoadAndExpectSuccess(manifest); } }; diff --git a/extensions/test/data/manifest_tests/shared_module_export.json b/chrome/test/data/extensions/manifest_tests/shared_module_export.json index 49c0c11..49c0c11 100644 --- a/extensions/test/data/manifest_tests/shared_module_export.json +++ b/chrome/test/data/extensions/manifest_tests/shared_module_export.json diff --git a/extensions/test/data/manifest_tests/shared_module_export_and_import.json b/chrome/test/data/extensions/manifest_tests/shared_module_export_and_import.json index 3f59ac2..3f59ac2 100644 --- a/extensions/test/data/manifest_tests/shared_module_export_and_import.json +++ b/chrome/test/data/extensions/manifest_tests/shared_module_export_and_import.json diff --git a/extensions/test/data/manifest_tests/shared_module_export_foo.json b/chrome/test/data/extensions/manifest_tests/shared_module_export_foo.json index e0b583f..e0b583f 100644 --- a/extensions/test/data/manifest_tests/shared_module_export_foo.json +++ b/chrome/test/data/extensions/manifest_tests/shared_module_export_foo.json diff --git a/extensions/test/data/manifest_tests/shared_module_export_no_whitelist.json b/chrome/test/data/extensions/manifest_tests/shared_module_export_no_whitelist.json index aafb5f8..aafb5f8 100644 --- a/extensions/test/data/manifest_tests/shared_module_export_no_whitelist.json +++ b/chrome/test/data/extensions/manifest_tests/shared_module_export_no_whitelist.json diff --git a/extensions/test/data/manifest_tests/shared_module_export_not_dict.json b/chrome/test/data/extensions/manifest_tests/shared_module_export_not_dict.json index 2500644..2500644 100644 --- a/extensions/test/data/manifest_tests/shared_module_export_not_dict.json +++ b/chrome/test/data/extensions/manifest_tests/shared_module_export_not_dict.json diff --git a/extensions/test/data/manifest_tests/shared_module_export_resource_not_string.json b/chrome/test/data/extensions/manifest_tests/shared_module_export_resource_not_string.json index 2021553..2021553 100644 --- a/extensions/test/data/manifest_tests/shared_module_export_resource_not_string.json +++ b/chrome/test/data/extensions/manifest_tests/shared_module_export_resource_not_string.json diff --git a/extensions/test/data/manifest_tests/shared_module_export_resources_not_list.json b/chrome/test/data/extensions/manifest_tests/shared_module_export_resources_not_list.json index 76971072..76971072 100644 --- a/extensions/test/data/manifest_tests/shared_module_export_resources_not_list.json +++ b/chrome/test/data/extensions/manifest_tests/shared_module_export_resources_not_list.json diff --git a/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_id.json b/chrome/test/data/extensions/manifest_tests/shared_module_export_whitelist_item_not_id.json index 6c1bb1b..6c1bb1b 100644 --- a/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_id.json +++ b/chrome/test/data/extensions/manifest_tests/shared_module_export_whitelist_item_not_id.json diff --git a/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_string.json b/chrome/test/data/extensions/manifest_tests/shared_module_export_whitelist_item_not_string.json index 2e75502..2e75502 100644 --- a/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_string.json +++ b/chrome/test/data/extensions/manifest_tests/shared_module_export_whitelist_item_not_string.json diff --git a/extensions/test/data/manifest_tests/shared_module_export_whitelist_not_list.json b/chrome/test/data/extensions/manifest_tests/shared_module_export_whitelist_not_list.json index 06d3e18..06d3e18 100644 --- a/extensions/test/data/manifest_tests/shared_module_export_whitelist_not_list.json +++ b/chrome/test/data/extensions/manifest_tests/shared_module_export_whitelist_not_list.json diff --git a/extensions/test/data/manifest_tests/shared_module_import.json b/chrome/test/data/extensions/manifest_tests/shared_module_import.json index ca9e170..ca9e170 100644 --- a/extensions/test/data/manifest_tests/shared_module_import.json +++ b/chrome/test/data/extensions/manifest_tests/shared_module_import.json diff --git a/extensions/test/data/manifest_tests/shared_module_import_invalid_id.json b/chrome/test/data/extensions/manifest_tests/shared_module_import_invalid_id.json index aadd9ae..aadd9ae 100644 --- a/extensions/test/data/manifest_tests/shared_module_import_invalid_id.json +++ b/chrome/test/data/extensions/manifest_tests/shared_module_import_invalid_id.json diff --git a/extensions/test/data/manifest_tests/shared_module_import_invalid_version.json b/chrome/test/data/extensions/manifest_tests/shared_module_import_invalid_version.json index 77a921c..77a921c 100644 --- a/extensions/test/data/manifest_tests/shared_module_import_invalid_version.json +++ b/chrome/test/data/extensions/manifest_tests/shared_module_import_invalid_version.json diff --git a/extensions/test/data/manifest_tests/shared_module_import_not_list.json b/chrome/test/data/extensions/manifest_tests/shared_module_import_not_list.json index a989bd9..a989bd9 100644 --- a/extensions/test/data/manifest_tests/shared_module_import_not_list.json +++ b/chrome/test/data/extensions/manifest_tests/shared_module_import_not_list.json diff --git a/extensions/BUILD.gn b/extensions/BUILD.gn index 0b46037..52d5749 100644 --- a/extensions/BUILD.gn +++ b/extensions/BUILD.gn @@ -75,8 +75,6 @@ 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", @@ -208,7 +206,6 @@ 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 7cfd017..836d930 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/chrome_manifest_test.h", + "+chrome/common/extensions/manifest_tests/extension_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 87e29cc..77acf35 100644 --- a/extensions/common/manifest_handlers/externally_connectable_unittest.cc +++ b/extensions/common/manifest_handlers/externally_connectable_unittest.cc @@ -4,7 +4,8 @@ #include <algorithm> -#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" +#include "chrome/common/extensions/features/feature_channel.h" +#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" #include "extensions/common/error_utils.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_handlers/externally_connectable.h" @@ -18,11 +19,9 @@ namespace extensions { namespace errors = externally_connectable_errors; -// TODO(jamescook): Convert from ChromeManifestTest to ManifestTest. -class ExternallyConnectableTest : public ChromeManifestTest { +class ExternallyConnectableTest : public ExtensionManifestTest { public: - ExternallyConnectableTest() {} - virtual ~ExternallyConnectableTest() {} + ExternallyConnectableTest() : channel_(chrome::VersionInfo::CHANNEL_DEV) {} protected: ExternallyConnectableInfo* GetExternallyConnectableInfo( @@ -30,6 +29,9 @@ class ExternallyConnectableTest : public ChromeManifestTest { 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 f45d922..678dc6b 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/chrome_manifest_test.h" +#include "chrome/common/extensions/manifest_tests/extension_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,8 +11,7 @@ namespace extensions { namespace errors = manifest_errors; -// TODO(jamescook): Convert from ChromeManifestTest to ManifestTest. -class FileHandlersManifestTest : public ChromeManifestTest { +class FileHandlersManifestTest : public ExtensionManifestTest { }; 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 ef90a1a..9fad618 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 ManifestTest { +class SharedModuleManifestTest : public ExtensionManifestTest { }; TEST_F(SharedModuleManifestTest, ExportsAll) { - ManifestData manifest("shared_module_export.json"); + Manifest manifest("shared_module_export.json"); scoped_refptr<Extension> extension = LoadAndExpectSuccess(manifest); @@ -49,7 +49,7 @@ TEST_F(SharedModuleManifestTest, ExportsAll) { } TEST_F(SharedModuleManifestTest, ExportWhitelistAll) { - ManifestData manifest("shared_module_export_no_whitelist.json"); + Manifest 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) { - ManifestData manifest("shared_module_export_foo.json"); + Manifest manifest("shared_module_export_foo.json"); scoped_refptr<Extension> extension = LoadAndExpectSuccess(manifest); @@ -108,7 +108,7 @@ TEST_F(SharedModuleManifestTest, SharedModuleStaticFunctions) { } TEST_F(SharedModuleManifestTest, Import) { - ManifestData manifest("shared_module_import.json"); + Manifest manifest("shared_module_import.json"); scoped_refptr<Extension> extension = LoadAndExpectSuccess(manifest); diff --git a/extensions/common/test_util.cc b/extensions/common/test_util.cc index 4eacfa6..03b35b8 100644 --- a/extensions/common/test_util.cc +++ b/extensions/common/test_util.cc @@ -4,9 +4,12 @@ #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 { @@ -36,5 +39,21 @@ 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 862c469..46ac5d08 100644 --- a/extensions/common/test_util.h +++ b/extensions/common/test_util.h @@ -8,6 +8,11 @@ #include <string> #include "base/memory/ref_counted.h" +#include "base/memory/scoped_ptr.h" + +namespace base { +class DictionaryValue; +} // namespace base namespace extensions { class Extension; @@ -25,6 +30,12 @@ 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 c5a1e0c..364c2ba 100644 --- a/extensions/extensions.gyp +++ b/extensions/extensions.gyp @@ -934,8 +934,6 @@ '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', @@ -1096,7 +1094,6 @@ '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', |