Commit 2bc03869 authored by James Cook's avatar James Cook

Revert "Refactor ExtensionManifestTest to allow usage in src/extensions"

This reverts commit bd1cc624.

Original CL:
Refactor ExtensionManifestTest to allow usage in src/extensions
https://codereview.chromium.org/572813002

Reason:
Broke the official Win builders due to differences in how they report their
version channel.
http://master.chrome.corp.google.com:8011/builders/win%20trunk/builds/26150

BUG=414917
TEST=unit_tests
TBR=rockot@chromium.org

Review URL: https://codereview.chromium.org/578653005

Cr-Commit-Position: refs/heads/master@{#295172}
parent 23fdae2a
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/manifest_handlers/mime_types_handler.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 "chrome/common/extensions/manifest_url_handler.h"
#include "extensions/common/error_utils.h" #include "extensions/common/error_utils.h"
#include "extensions/common/extension_builder.h" #include "extensions/common/extension_builder.h"
...@@ -22,7 +22,7 @@ using extensions::ListBuilder; ...@@ -22,7 +22,7 @@ using extensions::ListBuilder;
namespace { namespace {
class StreamsPrivateManifestTest : public ChromeManifestTest { class StreamsPrivateManifestTest : public ExtensionManifestTest {
}; };
TEST_F(StreamsPrivateManifestTest, ValidMimeTypesHandlerMIMETypes) { TEST_F(StreamsPrivateManifestTest, ValidMimeTypesHandlerMIMETypes) {
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
'../extensions/common/file_util_unittest.cc', '../extensions/common/file_util_unittest.cc',
'../extensions/common/manifest_handlers/externally_connectable_unittest.cc', '../extensions/common/manifest_handlers/externally_connectable_unittest.cc',
'../extensions/common/manifest_handlers/file_handler_manifest_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 # histograms.xml is analyzed by AboutFlagsHistogramTest, so this
# dependency is needed to make commit bots run unit_tests on # dependency is needed to make commit bots run unit_tests on
# histograms.xml changes. # histograms.xml changes.
...@@ -1279,8 +1280,7 @@ ...@@ -1279,8 +1280,7 @@
'common/extensions/manifest_handlers/exclude_matches_manifest_unittest.cc', 'common/extensions/manifest_handlers/exclude_matches_manifest_unittest.cc',
'common/extensions/manifest_handlers/settings_overrides_handler_unittest.cc', 'common/extensions/manifest_handlers/settings_overrides_handler_unittest.cc',
'common/extensions/manifest_handlers/ui_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/extension_manifest_test.cc',
'common/extensions/manifest_tests/chrome_manifest_test.h',
'common/extensions/manifest_tests/extension_manifests_about_unittest.cc', 'common/extensions/manifest_tests/extension_manifests_about_unittest.cc',
'common/extensions/manifest_tests/extension_manifests_background_unittest.cc', 'common/extensions/manifest_tests/extension_manifests_background_unittest.cc',
'common/extensions/manifest_tests/extension_manifests_chromepermission_unittest.cc', 'common/extensions/manifest_tests/extension_manifests_chromepermission_unittest.cc',
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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/command_line.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
...@@ -17,7 +17,7 @@ namespace extensions { ...@@ -17,7 +17,7 @@ namespace extensions {
namespace errors = manifest_errors; namespace errors = manifest_errors;
class CommandsManifestTest : public ChromeManifestTest { class CommandsManifestTest : public ExtensionManifestTest {
}; };
TEST_F(CommandsManifestTest, CommandManifestSimple) { TEST_F(CommandsManifestTest, CommandManifestSimple) {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/common/extensions/api/extension_action/action_info.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/error_utils.h" #include "extensions/common/error_utils.h"
#include "extensions/common/extension_builder.h" #include "extensions/common/extension_builder.h"
#include "extensions/common/extension_icon_set.h" #include "extensions/common/extension_icon_set.h"
...@@ -17,7 +17,7 @@ namespace errors = manifest_errors; ...@@ -17,7 +17,7 @@ namespace errors = manifest_errors;
namespace { namespace {
class BrowserActionManifestTest : public ChromeManifestTest { class BrowserActionManifestTest : public ExtensionManifestTest {
}; };
TEST_F(BrowserActionManifestTest, TEST_F(BrowserActionManifestTest,
...@@ -105,7 +105,7 @@ TEST_F(BrowserActionManifestTest, ...@@ -105,7 +105,7 @@ TEST_F(BrowserActionManifestTest,
base::string16 error = ErrorUtils::FormatErrorMessageUTF16( base::string16 error = ErrorUtils::FormatErrorMessageUTF16(
errors::kInvalidIconPath, "19"); errors::kInvalidIconPath, "19");
LoadAndExpectError(ManifestData(manifest_value.get(), "Invalid default icon"), LoadAndExpectError(Manifest(manifest_value.get(), "Invalid default icon"),
errors::kInvalidIconPath); errors::kInvalidIconPath);
} }
......
...@@ -2,10 +2,8 @@ ...@@ -2,10 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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/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/constants.h"
#include "extensions/common/error_utils.h" #include "extensions/common/error_utils.h"
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
...@@ -17,12 +15,10 @@ namespace extensions { ...@@ -17,12 +15,10 @@ namespace extensions {
namespace errors = manifest_errors; namespace errors = manifest_errors;
namespace keys = manifest_keys; namespace keys = manifest_keys;
class PageActionManifestTest : public ChromeManifestTest { class PageActionManifestTest : public ExtensionManifestTest {
protected: protected:
virtual base::FilePath GetTestDataDir() OVERRIDE { virtual const char* test_data_dir() OVERRIDE {
base::FilePath path; return "page_action";
PathService::Get(chrome::DIR_TEST_DATA, &path);
return path.AppendASCII("extensions").AppendASCII("page_action");
} }
scoped_ptr<ActionInfo> LoadAction(const std::string& manifest_filename); scoped_ptr<ActionInfo> LoadAction(const std::string& manifest_filename);
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "chrome/common/extensions/api/file_browser_handlers/file_browser_handler.h" #include "chrome/common/extensions/api/file_browser_handlers/file_browser_handler.h"
#include "chrome/common/extensions/extension_constants.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/error_utils.h"
#include "extensions/common/extension_builder.h" #include "extensions/common/extension_builder.h"
#include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_constants.h"
...@@ -21,7 +21,7 @@ using extensions::ListBuilder; ...@@ -21,7 +21,7 @@ using extensions::ListBuilder;
namespace { namespace {
class FileBrowserHandlerManifestTest : public ChromeManifestTest { class FileBrowserHandlerManifestTest : public ExtensionManifestTest {
}; };
TEST_F(FileBrowserHandlerManifestTest, InvalidFileBrowserHandlers) { TEST_F(FileBrowserHandlerManifestTest, InvalidFileBrowserHandlers) {
......
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/common/extensions/api/i18n/default_locale_handler.h" #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 "extensions/common/manifest_constants.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace extensions { namespace extensions {
class DefaultLocaleManifestTest : public ChromeManifestTest { class DefaultLocaleManifestTest : public ExtensionManifestTest {
}; };
TEST_F(DefaultLocaleManifestTest, DefaultLocale) { TEST_F(DefaultLocaleManifestTest, DefaultLocale) {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "base/test/values_test_util.h" #include "base/test/values_test_util.h"
#include "chrome/common/extensions/api/identity/oauth2_manifest_handler.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 "extensions/common/manifest_constants.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -25,7 +25,7 @@ const char kAutoApproveNotAllowedWarning[] = ...@@ -25,7 +25,7 @@ const char kAutoApproveNotAllowedWarning[] =
} // namespace } // namespace
class OAuth2ManifestTest : public ChromeManifestTest { class OAuth2ManifestTest : public ExtensionManifestTest {
protected: protected:
enum AutoApproveValue { enum AutoApproveValue {
AUTO_APPROVE_NOT_SET, AUTO_APPROVE_NOT_SET,
...@@ -107,7 +107,7 @@ TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) { ...@@ -107,7 +107,7 @@ TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) {
ext_manifest.SetString(keys::kKey, kExtensionKey); ext_manifest.SetString(keys::kKey, kExtensionKey);
ext_manifest.SetBoolean(keys::kOAuth2AutoApprove, true); ext_manifest.SetBoolean(keys::kOAuth2AutoApprove, true);
ManifestData manifest(&ext_manifest, "test"); Manifest manifest(&ext_manifest, "test");
scoped_refptr<extensions::Extension> extension = scoped_refptr<extensions::Extension> extension =
LoadAndExpectSuccess(manifest); LoadAndExpectSuccess(manifest);
EXPECT_TRUE(extension->install_warnings().empty()); EXPECT_TRUE(extension->install_warnings().empty());
...@@ -124,7 +124,7 @@ TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) { ...@@ -124,7 +124,7 @@ TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) {
app_manifest.SetString(keys::kLaunchLocalPath, "launch.html"); app_manifest.SetString(keys::kLaunchLocalPath, "launch.html");
app_manifest.MergeDictionary(&base_manifest); app_manifest.MergeDictionary(&base_manifest);
ManifestData manifest(&app_manifest, "test"); Manifest manifest(&app_manifest, "test");
scoped_refptr<extensions::Extension> extension = scoped_refptr<extensions::Extension> extension =
LoadAndExpectSuccess(manifest); LoadAndExpectSuccess(manifest);
EXPECT_TRUE(extension->install_warnings().empty()); EXPECT_TRUE(extension->install_warnings().empty());
...@@ -141,7 +141,7 @@ TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) { ...@@ -141,7 +141,7 @@ TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) {
app_manifest.SetString(keys::kLaunchWebURL, "http://www.google.com"); app_manifest.SetString(keys::kLaunchWebURL, "http://www.google.com");
app_manifest.MergeDictionary(&base_manifest); app_manifest.MergeDictionary(&base_manifest);
ManifestData manifest(&app_manifest, "test"); Manifest manifest(&app_manifest, "test");
scoped_refptr<extensions::Extension> extension = scoped_refptr<extensions::Extension> extension =
LoadAndExpectSuccess(manifest); LoadAndExpectSuccess(manifest);
EXPECT_EQ(1U, extension->install_warnings().size()); EXPECT_EQ(1U, extension->install_warnings().size());
...@@ -159,7 +159,7 @@ TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) { ...@@ -159,7 +159,7 @@ TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) {
TEST_F(OAuth2ManifestTest, AutoApproveNotSetExtensionNotOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveNotSetExtensionNotOnWhitelist) {
base::DictionaryValue* ext_manifest = base::DictionaryValue* ext_manifest =
CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_DEFAULT); CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_DEFAULT);
ManifestData manifest(ext_manifest, "test"); Manifest manifest(ext_manifest, "test");
scoped_refptr<extensions::Extension> extension = scoped_refptr<extensions::Extension> extension =
LoadAndExpectSuccess(manifest); LoadAndExpectSuccess(manifest);
EXPECT_TRUE(extension->install_warnings().empty()); EXPECT_TRUE(extension->install_warnings().empty());
...@@ -169,7 +169,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveNotSetExtensionNotOnWhitelist) { ...@@ -169,7 +169,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveNotSetExtensionNotOnWhitelist) {
TEST_F(OAuth2ManifestTest, AutoApproveFalseExtensionNotOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveFalseExtensionNotOnWhitelist) {
base::DictionaryValue* ext_manifest = base::DictionaryValue* ext_manifest =
CreateManifest(AUTO_APPROVE_FALSE, false, CLIENT_ID_DEFAULT); CreateManifest(AUTO_APPROVE_FALSE, false, CLIENT_ID_DEFAULT);
ManifestData manifest(ext_manifest, "test"); Manifest manifest(ext_manifest, "test");
scoped_refptr<extensions::Extension> extension = scoped_refptr<extensions::Extension> extension =
LoadAndExpectSuccess(manifest); LoadAndExpectSuccess(manifest);
EXPECT_EQ(1U, extension->install_warnings().size()); EXPECT_EQ(1U, extension->install_warnings().size());
...@@ -182,7 +182,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveFalseExtensionNotOnWhitelist) { ...@@ -182,7 +182,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveFalseExtensionNotOnWhitelist) {
TEST_F(OAuth2ManifestTest, AutoApproveTrueExtensionNotOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveTrueExtensionNotOnWhitelist) {
base::DictionaryValue* ext_manifest = base::DictionaryValue* ext_manifest =
CreateManifest(AUTO_APPROVE_TRUE, false, CLIENT_ID_DEFAULT); CreateManifest(AUTO_APPROVE_TRUE, false, CLIENT_ID_DEFAULT);
ManifestData manifest(ext_manifest, "test"); Manifest manifest(ext_manifest, "test");
scoped_refptr<extensions::Extension> extension = scoped_refptr<extensions::Extension> extension =
LoadAndExpectSuccess(manifest); LoadAndExpectSuccess(manifest);
EXPECT_EQ(1U, extension->install_warnings().size()); EXPECT_EQ(1U, extension->install_warnings().size());
...@@ -195,7 +195,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveTrueExtensionNotOnWhitelist) { ...@@ -195,7 +195,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveTrueExtensionNotOnWhitelist) {
TEST_F(OAuth2ManifestTest, AutoApproveInvalidExtensionNotOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveInvalidExtensionNotOnWhitelist) {
base::DictionaryValue* ext_manifest = base::DictionaryValue* ext_manifest =
CreateManifest(AUTO_APPROVE_INVALID, false, CLIENT_ID_DEFAULT); CreateManifest(AUTO_APPROVE_INVALID, false, CLIENT_ID_DEFAULT);
ManifestData manifest(ext_manifest, "test"); Manifest manifest(ext_manifest, "test");
scoped_refptr<extensions::Extension> extension = scoped_refptr<extensions::Extension> extension =
LoadAndExpectSuccess(manifest); LoadAndExpectSuccess(manifest);
EXPECT_EQ(1U, extension->install_warnings().size()); EXPECT_EQ(1U, extension->install_warnings().size());
...@@ -208,7 +208,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveInvalidExtensionNotOnWhitelist) { ...@@ -208,7 +208,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveInvalidExtensionNotOnWhitelist) {
TEST_F(OAuth2ManifestTest, AutoApproveNotSetExtensionOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveNotSetExtensionOnWhitelist) {
base::DictionaryValue* ext_manifest = base::DictionaryValue* ext_manifest =
CreateManifest(AUTO_APPROVE_NOT_SET, true, CLIENT_ID_DEFAULT); CreateManifest(AUTO_APPROVE_NOT_SET, true, CLIENT_ID_DEFAULT);
ManifestData manifest(ext_manifest, "test"); Manifest manifest(ext_manifest, "test");
scoped_refptr<extensions::Extension> extension = scoped_refptr<extensions::Extension> extension =
LoadAndExpectSuccess(manifest); LoadAndExpectSuccess(manifest);
EXPECT_TRUE(extension->install_warnings().empty()); EXPECT_TRUE(extension->install_warnings().empty());
...@@ -218,7 +218,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveNotSetExtensionOnWhitelist) { ...@@ -218,7 +218,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveNotSetExtensionOnWhitelist) {
TEST_F(OAuth2ManifestTest, AutoApproveFalseExtensionOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveFalseExtensionOnWhitelist) {
base::DictionaryValue* ext_manifest = base::DictionaryValue* ext_manifest =
CreateManifest(AUTO_APPROVE_FALSE, true, CLIENT_ID_DEFAULT); CreateManifest(AUTO_APPROVE_FALSE, true, CLIENT_ID_DEFAULT);
ManifestData manifest(ext_manifest, "test"); Manifest manifest(ext_manifest, "test");
scoped_refptr<extensions::Extension> extension = scoped_refptr<extensions::Extension> extension =
LoadAndExpectSuccess(manifest); LoadAndExpectSuccess(manifest);
EXPECT_TRUE(extension->install_warnings().empty()); EXPECT_TRUE(extension->install_warnings().empty());
...@@ -228,7 +228,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveFalseExtensionOnWhitelist) { ...@@ -228,7 +228,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveFalseExtensionOnWhitelist) {
TEST_F(OAuth2ManifestTest, AutoApproveTrueExtensionOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveTrueExtensionOnWhitelist) {
base::DictionaryValue* ext_manifest = base::DictionaryValue* ext_manifest =
CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_DEFAULT); CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_DEFAULT);
ManifestData manifest(ext_manifest, "test"); Manifest manifest(ext_manifest, "test");
scoped_refptr<extensions::Extension> extension = scoped_refptr<extensions::Extension> extension =
LoadAndExpectSuccess(manifest); LoadAndExpectSuccess(manifest);
EXPECT_TRUE(extension->install_warnings().empty()); EXPECT_TRUE(extension->install_warnings().empty());
...@@ -238,7 +238,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveTrueExtensionOnWhitelist) { ...@@ -238,7 +238,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveTrueExtensionOnWhitelist) {
TEST_F(OAuth2ManifestTest, AutoApproveInvalidExtensionOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveInvalidExtensionOnWhitelist) {
base::DictionaryValue* ext_manifest = base::DictionaryValue* ext_manifest =
CreateManifest(AUTO_APPROVE_INVALID, true, CLIENT_ID_DEFAULT); CreateManifest(AUTO_APPROVE_INVALID, true, CLIENT_ID_DEFAULT);
ManifestData manifest(ext_manifest, "test"); Manifest manifest(ext_manifest, "test");
std::string error; std::string error;
scoped_refptr<extensions::Extension> extension = scoped_refptr<extensions::Extension> extension =
LoadExtension(manifest, &error); LoadExtension(manifest, &error);
...@@ -251,7 +251,7 @@ TEST_F(OAuth2ManifestTest, InvalidClientId) { ...@@ -251,7 +251,7 @@ TEST_F(OAuth2ManifestTest, InvalidClientId) {
{ {
base::DictionaryValue* ext_manifest = base::DictionaryValue* ext_manifest =
CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_NOT_SET); CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_NOT_SET);
ManifestData manifest(ext_manifest, "test"); Manifest manifest(ext_manifest, "test");
std::string error; std::string error;
LoadAndExpectError(manifest, errors::kInvalidOAuth2ClientId); LoadAndExpectError(manifest, errors::kInvalidOAuth2ClientId);
} }
...@@ -259,7 +259,7 @@ TEST_F(OAuth2ManifestTest, InvalidClientId) { ...@@ -259,7 +259,7 @@ TEST_F(OAuth2ManifestTest, InvalidClientId) {
{ {
base::DictionaryValue* ext_manifest = base::DictionaryValue* ext_manifest =
CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_EMPTY); CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_EMPTY);
ManifestData manifest(ext_manifest, "test"); Manifest manifest(ext_manifest, "test");
std::string error; std::string error;
LoadAndExpectError(manifest, errors::kInvalidOAuth2ClientId); LoadAndExpectError(manifest, errors::kInvalidOAuth2ClientId);
} }
...@@ -270,7 +270,7 @@ TEST_F(OAuth2ManifestTest, ComponentInvalidClientId) { ...@@ -270,7 +270,7 @@ TEST_F(OAuth2ManifestTest, ComponentInvalidClientId) {
{ {
base::DictionaryValue* ext_manifest = base::DictionaryValue* ext_manifest =
CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_NOT_SET); CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_NOT_SET);
ManifestData manifest(ext_manifest, "test"); Manifest manifest(ext_manifest, "test");
std::string error; std::string error;
LoadAndExpectError(manifest, LoadAndExpectError(manifest,
errors::kInvalidOAuth2ClientId, errors::kInvalidOAuth2ClientId,
...@@ -280,7 +280,7 @@ TEST_F(OAuth2ManifestTest, ComponentInvalidClientId) { ...@@ -280,7 +280,7 @@ TEST_F(OAuth2ManifestTest, ComponentInvalidClientId) {
{ {
base::DictionaryValue* ext_manifest = base::DictionaryValue* ext_manifest =
CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_EMPTY); CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_EMPTY);
ManifestData manifest(ext_manifest, "test"); Manifest manifest(ext_manifest, "test");
std::string error; std::string error;
LoadAndExpectError(manifest, LoadAndExpectError(manifest,
errors::kInvalidOAuth2ClientId, errors::kInvalidOAuth2ClientId,
...@@ -292,7 +292,7 @@ TEST_F(OAuth2ManifestTest, ComponentWithChromeClientId) { ...@@ -292,7 +292,7 @@ TEST_F(OAuth2ManifestTest, ComponentWithChromeClientId) {
{ {
base::DictionaryValue* ext_manifest = base::DictionaryValue* ext_manifest =
CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_NOT_SET); CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_NOT_SET);
ManifestData manifest(ext_manifest, "test"); Manifest manifest(ext_manifest, "test");
scoped_refptr<extensions::Extension> extension = scoped_refptr<extensions::Extension> extension =
LoadAndExpectSuccess(manifest, extensions::Manifest::COMPONENT); LoadAndExpectSuccess(manifest, extensions::Manifest::COMPONENT);
EXPECT_TRUE(OAuth2Info::GetOAuth2Info(extension.get()).client_id.empty()); EXPECT_TRUE(OAuth2Info::GetOAuth2Info(extension.get()).client_id.empty());
...@@ -302,7 +302,7 @@ TEST_F(OAuth2ManifestTest, ComponentWithChromeClientId) { ...@@ -302,7 +302,7 @@ TEST_F(OAuth2ManifestTest, ComponentWithChromeClientId) {
{ {
base::DictionaryValue* ext_manifest = base::DictionaryValue* ext_manifest =
CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_EMPTY); CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_EMPTY);
ManifestData manifest(ext_manifest, "test"); Manifest manifest(ext_manifest, "test");
scoped_refptr<extensions::Extension> extension = scoped_refptr<extensions::Extension> extension =
LoadAndExpectSuccess(manifest, extensions::Manifest::COMPONENT); LoadAndExpectSuccess(manifest, extensions::Manifest::COMPONENT);
EXPECT_TRUE(OAuth2Info::GetOAuth2Info(extension.get()).client_id.empty()); EXPECT_TRUE(OAuth2Info::GetOAuth2Info(extension.get()).client_id.empty());
...@@ -313,7 +313,7 @@ TEST_F(OAuth2ManifestTest, ComponentWithChromeClientId) { ...@@ -313,7 +313,7 @@ TEST_F(OAuth2ManifestTest, ComponentWithChromeClientId) {
TEST_F(OAuth2ManifestTest, ComponentWithStandardClientId) { TEST_F(OAuth2ManifestTest, ComponentWithStandardClientId) {
base::DictionaryValue* ext_manifest = base::DictionaryValue* ext_manifest =
CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_DEFAULT); CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_DEFAULT);
ManifestData manifest(ext_manifest, "test"); Manifest manifest(ext_manifest, "test");
scoped_refptr<extensions::Extension> extension = scoped_refptr<extensions::Extension> extension =
LoadAndExpectSuccess(manifest, extensions::Manifest::COMPONENT); LoadAndExpectSuccess(manifest, extensions::Manifest::COMPONENT);
EXPECT_EQ("client1", OAuth2Info::GetOAuth2Info(extension.get()).client_id); EXPECT_EQ("client1", OAuth2Info::GetOAuth2Info(extension.get()).client_id);
......
...@@ -3,9 +3,8 @@ ...@@ -3,9 +3,8 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/strings/utf_string_conversions.h" #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_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 "chrome/grit/generated_resources.h"
#include "extensions/common/error_utils.h" #include "extensions/common/error_utils.h"
#include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_constants.h"
...@@ -15,7 +14,7 @@ ...@@ -15,7 +14,7 @@
namespace extensions { namespace extensions {
class AutomationManifestTest : public ChromeManifestTest { class AutomationManifestTest : public ExtensionManifestTest {
public: public:
AutomationManifestTest() : channel_(chrome::VersionInfo::CHANNEL_UNKNOWN) {} AutomationManifestTest() : channel_(chrome::VersionInfo::CHANNEL_UNKNOWN) {}
...@@ -157,7 +156,7 @@ TEST_F(AutomationManifestTest, EmptyMatches) { ...@@ -157,7 +156,7 @@ TEST_F(AutomationManifestTest, EmptyMatches) {
TEST_F(AutomationManifestTest, NoValidMatches) { TEST_F(AutomationManifestTest, NoValidMatches) {
std::string error; std::string error;
scoped_refptr<Extension> extension = scoped_refptr<Extension> extension =
LoadExtension(ManifestData("automation_no_valid_matches.json"), &error); LoadExtension(Manifest("automation_no_valid_matches.json"), &error);
ASSERT_TRUE(extension.get()); ASSERT_TRUE(extension.get());
EXPECT_EQ("", error); EXPECT_EQ("", error);
EXPECT_EQ(2u, extension->install_warnings().size()); EXPECT_EQ(2u, extension->install_warnings().size());
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "chrome/common/extensions/manifest_handlers/content_scripts_handler.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/error_utils.h"
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
#include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_constants.h"
...@@ -16,7 +16,7 @@ namespace extensions { ...@@ -16,7 +16,7 @@ namespace extensions {
namespace errors = manifest_errors; namespace errors = manifest_errors;
class ContentScriptsManifestTest : public ChromeManifestTest { class ContentScriptsManifestTest : public ExtensionManifestTest {
}; };
TEST_F(ContentScriptsManifestTest, MatchPattern) { TEST_F(ContentScriptsManifestTest, MatchPattern) {
......
...@@ -2,13 +2,14 @@ ...@@ -2,13 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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/extension.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace extensions { namespace extensions {
class ExcludeMatchesManifestTest : public ChromeManifestTest { class ExcludeMatchesManifestTest : public ExtensionManifestTest {
}; };
TEST_F(ExcludeMatchesManifestTest, ExcludeMatchPatterns) { TEST_F(ExcludeMatchesManifestTest, ExcludeMatchPatterns) {
......
// 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");
}
// 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_
...@@ -2,36 +2,29 @@ ...@@ -2,36 +2,29 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef EXTENSIONS_COMMON_MANIFEST_TEST_H_ #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_MANIFEST_TEST_H_
#define EXTENSIONS_COMMON_MANIFEST_TEST_H_ #define CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_MANIFEST_TEST_H_
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/values.h" #include "base/values.h"
#include "chrome/common/extensions/features/feature_channel.h"
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
#include "extensions/common/manifest.h" #include "extensions/common/manifest.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace base { class ExtensionManifestTest : public testing::Test {
class FilePath;
}
namespace extensions {
// Base class for tests that parse a manifest file.
class ManifestTest : public testing::Test {
public: public:
ManifestTest(); ExtensionManifestTest();
virtual ~ManifestTest();
protected: protected:
// Helper class that simplifies creating methods that take either a filename // Helper class that simplifies creating methods that take either a filename
// to a manifest or the manifest itself. // to a manifest or the manifest itself.
class ManifestData { class Manifest {
public: public:
explicit ManifestData(const char* name); explicit Manifest(const char* name);
ManifestData(base::DictionaryValue* manifest, const char* name); Manifest(base::DictionaryValue* manifest, const char* name);
explicit ManifestData(scoped_ptr<base::DictionaryValue> manifest); explicit Manifest(scoped_ptr<base::DictionaryValue> manifest);
// C++98 requires the copy constructor for a type to be visible if you // 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 // take a const-ref of a temporary for that type. Since Manifest
// contains a scoped_ptr, its implicit copy constructor is declared // contains a scoped_ptr, its implicit copy constructor is declared
...@@ -41,13 +34,13 @@ class ManifestTest : public testing::Test { ...@@ -41,13 +34,13 @@ class ManifestTest : public testing::Test {
// //
// To get around this spec pedantry, we declare the copy constructor // To get around this spec pedantry, we declare the copy constructor
// explicitly. It will never get invoked. // explicitly. It will never get invoked.
ManifestData(const ManifestData& m); Manifest(const Manifest& m);
~ManifestData(); ~Manifest();
const std::string& name() const { return name_; }; 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; std::string* error) const;
private: private:
...@@ -56,23 +49,22 @@ class ManifestTest : public testing::Test { ...@@ -56,23 +49,22 @@ class ManifestTest : public testing::Test {
mutable scoped_ptr<base::DictionaryValue> manifest_holder_; mutable scoped_ptr<base::DictionaryValue> manifest_holder_;
}; };
// Returns the path in which to find test manifest data files, for example // The subdirectory in which to find test data files.
// extensions/test/data/manifest_tests. virtual char const* test_data_dir();
virtual base::FilePath GetTestDataDir();
scoped_ptr<base::DictionaryValue> LoadManifest( scoped_ptr<base::DictionaryValue> LoadManifest(
char const* manifest_name, char const* manifest_name,
std::string* error); std::string* error);
scoped_refptr<extensions::Extension> LoadExtension( scoped_refptr<extensions::Extension> LoadExtension(
const ManifestData& manifest, const Manifest& manifest,
std::string* error, std::string* error,
extensions::Manifest::Location location = extensions::Manifest::Location location =
extensions::Manifest::INTERNAL, extensions::Manifest::INTERNAL,
int flags = extensions::Extension::NO_FLAGS); int flags = extensions::Extension::NO_FLAGS);
scoped_refptr<extensions::Extension> LoadAndExpectSuccess( scoped_refptr<extensions::Extension> LoadAndExpectSuccess(
const ManifestData& manifest, const Manifest& manifest,
extensions::Manifest::Location location = extensions::Manifest::Location location =
extensions::Manifest::INTERNAL, extensions::Manifest::INTERNAL,
int flags = extensions::Extension::NO_FLAGS); int flags = extensions::Extension::NO_FLAGS);
...@@ -83,8 +75,13 @@ class ManifestTest : public testing::Test { ...@@ -83,8 +75,13 @@ class ManifestTest : public testing::Test {
extensions::Manifest::INTERNAL, extensions::Manifest::INTERNAL,
int flags = extensions::Extension::NO_FLAGS); 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( scoped_refptr<extensions::Extension> LoadAndExpectWarning(
const ManifestData& manifest, const Manifest& manifest,
const std::string& expected_error, const std::string& expected_error,
extensions::Manifest::Location location = extensions::Manifest::Location location =
extensions::Manifest::INTERNAL, extensions::Manifest::INTERNAL,
...@@ -108,12 +105,17 @@ class ManifestTest : public testing::Test { ...@@ -108,12 +105,17 @@ class ManifestTest : public testing::Test {
extensions::Manifest::INTERNAL, extensions::Manifest::INTERNAL,
int flags = extensions::Extension::NO_FLAGS); int flags = extensions::Extension::NO_FLAGS);
void LoadAndExpectError(const ManifestData& manifest, void LoadAndExpectError(const Manifest& manifest,
const std::string& expected_error, const std::string& expected_error,
extensions::Manifest::Location location = extensions::Manifest::Location location =
extensions::Manifest::INTERNAL, extensions::Manifest::INTERNAL,
int flags = extensions::Extension::NO_FLAGS); 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, void AddPattern(extensions::URLPatternSet* extent,
const std::string& pattern); const std::string& pattern);
...@@ -151,10 +153,13 @@ class ManifestTest : public testing::Test { ...@@ -151,10 +153,13 @@ class ManifestTest : public testing::Test {
bool enable_apps_; bool enable_apps_;
private: // Force the manifest tests to run as though they are on trunk, since several
DISALLOW_COPY_AND_ASSIGN(ManifestTest); // 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 // CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_MANIFEST_TEST_H_
#endif // EXTENSIONS_COMMON_MANIFEST_TEST_H_
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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 "chrome/common/extensions/manifest_url_handler.h"
#include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_constants.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace errors = extensions::manifest_errors; namespace errors = extensions::manifest_errors;
class AboutPageManifestTest : public ChromeManifestTest {}; class AboutPageManifestTest : public ExtensionManifestTest {};
TEST_F(AboutPageManifestTest, AboutPageInSharedModules) { TEST_F(AboutPageManifestTest, AboutPageInSharedModules) {
scoped_refptr<extensions::Extension> extension; scoped_refptr<extensions::Extension> extension;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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/command_line.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
...@@ -20,7 +20,7 @@ namespace extensions { ...@@ -20,7 +20,7 @@ namespace extensions {
namespace errors = manifest_errors; namespace errors = manifest_errors;
namespace keys = manifest_keys; namespace keys = manifest_keys;
class ExtensionManifestBackgroundTest : public ChromeManifestTest { class ExtensionManifestBackgroundTest : public ExtensionManifestTest {
}; };
TEST_F(ExtensionManifestBackgroundTest, BackgroundPermission) { TEST_F(ExtensionManifestBackgroundTest, BackgroundPermission) {
...@@ -35,7 +35,7 @@ TEST_F(ExtensionManifestBackgroundTest, BackgroundScripts) { ...@@ -35,7 +35,7 @@ TEST_F(ExtensionManifestBackgroundTest, BackgroundScripts) {
ASSERT_TRUE(manifest.get()); ASSERT_TRUE(manifest.get());
scoped_refptr<Extension> extension( scoped_refptr<Extension> extension(
LoadAndExpectSuccess(ManifestData(manifest.get(), ""))); LoadAndExpectSuccess(Manifest(manifest.get(), "")));
ASSERT_TRUE(extension.get()); ASSERT_TRUE(extension.get());
const std::vector<std::string>& background_scripts = const std::vector<std::string>& background_scripts =
BackgroundInfo::GetBackgroundScripts(extension.get()); BackgroundInfo::GetBackgroundScripts(extension.get());
...@@ -49,7 +49,7 @@ TEST_F(ExtensionManifestBackgroundTest, BackgroundScripts) { ...@@ -49,7 +49,7 @@ TEST_F(ExtensionManifestBackgroundTest, BackgroundScripts) {
BackgroundInfo::GetBackgroundURL(extension.get()).path()); BackgroundInfo::GetBackgroundURL(extension.get()).path());
manifest->SetString("background_page", "monkey.html"); manifest->SetString("background_page", "monkey.html");
LoadAndExpectError(ManifestData(manifest.get(), ""), LoadAndExpectError(Manifest(manifest.get(), ""),
errors::kInvalidBackgroundCombination); errors::kInvalidBackgroundCombination);
} }
...@@ -65,14 +65,14 @@ TEST_F(ExtensionManifestBackgroundTest, BackgroundPage) { ...@@ -65,14 +65,14 @@ TEST_F(ExtensionManifestBackgroundTest, BackgroundPage) {
scoped_ptr<base::DictionaryValue> manifest( scoped_ptr<base::DictionaryValue> manifest(
LoadManifest("background_page_legacy.json", &error)); LoadManifest("background_page_legacy.json", &error));
ASSERT_TRUE(manifest.get()); ASSERT_TRUE(manifest.get());
extension = LoadAndExpectSuccess(ManifestData(manifest.get(), "")); extension = LoadAndExpectSuccess(Manifest(manifest.get(), ""));
ASSERT_TRUE(extension.get()); ASSERT_TRUE(extension.get());
EXPECT_EQ("/foo.html", EXPECT_EQ("/foo.html",
BackgroundInfo::GetBackgroundURL(extension.get()).path()); BackgroundInfo::GetBackgroundURL(extension.get()).path());
manifest->SetInteger(keys::kManifestVersion, 2); manifest->SetInteger(keys::kManifestVersion, 2);
LoadAndExpectWarning( LoadAndExpectWarning(
ManifestData(manifest.get(), ""), Manifest(manifest.get(), ""),
"'background_page' requires manifest version of 1 or lower."); "'background_page' requires manifest version of 1 or lower.");
} }
...@@ -97,14 +97,14 @@ TEST_F(ExtensionManifestBackgroundTest, BackgroundPageWebRequest) { ...@@ -97,14 +97,14 @@ TEST_F(ExtensionManifestBackgroundTest, BackgroundPageWebRequest) {
manifest->SetBoolean(keys::kBackgroundPersistent, false); manifest->SetBoolean(keys::kBackgroundPersistent, false);
manifest->SetInteger(keys::kManifestVersion, 2); manifest->SetInteger(keys::kManifestVersion, 2);
scoped_refptr<Extension> extension( scoped_refptr<Extension> extension(
LoadAndExpectSuccess(ManifestData(manifest.get(), ""))); LoadAndExpectSuccess(Manifest(manifest.get(), "")));
ASSERT_TRUE(extension.get()); ASSERT_TRUE(extension.get());
EXPECT_TRUE(BackgroundInfo::HasLazyBackgroundPage(extension.get())); EXPECT_TRUE(BackgroundInfo::HasLazyBackgroundPage(extension.get()));
base::ListValue* permissions = new base::ListValue(); base::ListValue* permissions = new base::ListValue();
permissions->Append(new base::StringValue("webRequest")); permissions->Append(new base::StringValue("webRequest"));
manifest->Set(keys::kPermissions, permissions); manifest->Set(keys::kPermissions, permissions);
LoadAndExpectError(ManifestData(manifest.get(), ""), LoadAndExpectError(Manifest(manifest.get(), ""),
errors::kWebRequestConflictsWithLazyBackground); errors::kWebRequestConflictsWithLazyBackground);
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/command_line.h" #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 "chrome/common/url_constants.h"
#include "extensions/common/error_utils.h" #include "extensions/common/error_utils.h"
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
...@@ -17,16 +17,14 @@ namespace extensions { ...@@ -17,16 +17,14 @@ namespace extensions {
namespace errors = manifest_errors; namespace errors = manifest_errors;
typedef ChromeManifestTest ChromePermissionManifestTest; TEST_F(ExtensionManifestTest, ChromeURLPermissionInvalid) {
TEST_F(ChromePermissionManifestTest, ChromeURLPermissionInvalid) {
LoadAndExpectWarning("permission_chrome_url_invalid.json", LoadAndExpectWarning("permission_chrome_url_invalid.json",
ErrorUtils::FormatErrorMessage( ErrorUtils::FormatErrorMessage(
errors::kInvalidPermissionScheme, errors::kInvalidPermissionScheme,
chrome::kChromeUINewTabURL)); chrome::kChromeUINewTabURL));
} }
TEST_F(ChromePermissionManifestTest, ChromeURLPermissionAllowedWithFlag) { TEST_F(ExtensionManifestTest, ChromeURLPermissionAllowedWithFlag) {
// Ignore the policy delegate for this test. // Ignore the policy delegate for this test.
PermissionsData::SetPolicyDelegate(NULL); PermissionsData::SetPolicyDelegate(NULL);
CommandLine::ForCurrentProcess()->AppendSwitch( CommandLine::ForCurrentProcess()->AppendSwitch(
...@@ -41,14 +39,13 @@ TEST_F(ChromePermissionManifestTest, ChromeURLPermissionAllowedWithFlag) { ...@@ -41,14 +39,13 @@ TEST_F(ChromePermissionManifestTest, ChromeURLPermissionAllowedWithFlag) {
<< error; << error;
} }
TEST_F(ChromePermissionManifestTest, TEST_F(ExtensionManifestTest, ChromeResourcesPermissionValidOnlyForComponents) {
ChromeResourcesPermissionValidOnlyForComponents) {
LoadAndExpectWarning("permission_chrome_resources_url.json", LoadAndExpectWarning("permission_chrome_resources_url.json",
ErrorUtils::FormatErrorMessage( ErrorUtils::FormatErrorMessage(
errors::kInvalidPermissionScheme, errors::kInvalidPermissionScheme,
"chrome://resources/")); "chrome://resources/"));
std::string error; std::string error;
LoadExtension(ManifestData("permission_chrome_resources_url.json"), LoadExtension(Manifest("permission_chrome_resources_url.json"),
&error, &error,
extensions::Manifest::COMPONENT, extensions::Manifest::COMPONENT,
Extension::NO_FLAGS); Extension::NO_FLAGS);
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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_constants.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace errors = extensions::manifest_errors; namespace errors = extensions::manifest_errors;
class ContentSecurityPolicyManifestTest : public ChromeManifestTest { class ContentSecurityPolicyManifestTest : public ExtensionManifestTest {
}; };
TEST_F(ContentSecurityPolicyManifestTest, InsecureContentSecurityPolicy) { TEST_F(ContentSecurityPolicyManifestTest, InsecureContentSecurityPolicy) {
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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/extension.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
TEST_F(ChromeManifestTest, DefaultPathForExtent) { TEST_F(ExtensionManifestTest, DefaultPathForExtent) {
scoped_refptr<extensions::Extension> extension( scoped_refptr<extensions::Extension> extension(
LoadAndExpectSuccess("default_path_for_extent.json")); LoadAndExpectSuccess("default_path_for_extent.json"));
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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 "chrome/common/extensions/manifest_url_handler.h"
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
#include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_constants.h"
#include "extensions/common/permissions/permissions_data.h" #include "extensions/common/permissions/permissions_data.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
class DevToolsPageManifestTest : public ChromeManifestTest { class DevToolsPageManifestTest : public ExtensionManifestTest {
}; };
TEST_F(DevToolsPageManifestTest, DevToolsExtensions) { TEST_F(DevToolsPageManifestTest, DevToolsExtensions) {
......
...@@ -2,17 +2,17 @@ ...@@ -2,17 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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 { namespace extensions {
TEST_F(ChromeManifestTest, PlatformsKey) { TEST_F(ExtensionManifestTest, PlatformsKey) {
scoped_refptr<Extension> extension = scoped_refptr<Extension> extension =
LoadAndExpectSuccess("platforms_key.json"); LoadAndExpectSuccess("platforms_key.json");
EXPECT_EQ(0u, extension->install_warnings().size()); EXPECT_EQ(0u, extension->install_warnings().size());
} }
TEST_F(ChromeManifestTest, UnrecognizedKeyWarning) { TEST_F(ExtensionManifestTest, UnrecognizedKeyWarning) {
scoped_refptr<Extension> extension = scoped_refptr<Extension> extension =
LoadAndExpectWarning("unrecognized_key.json", LoadAndExpectWarning("unrecognized_key.json",
"Unrecognized manifest key 'unrecognized_key_1'."); "Unrecognized manifest key 'unrecognized_key_1'.");
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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/command_line.h"
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
namespace errors = extensions::manifest_errors; namespace errors = extensions::manifest_errors;
TEST_F(ChromeManifestTest, ExperimentalPermission) { TEST_F(ExtensionManifestTest, ExperimentalPermission) {
LoadAndExpectError("experimental.json", errors::kExperimentalFlagRequired); LoadAndExpectError("experimental.json", errors::kExperimentalFlagRequired);
LoadAndExpectSuccess("experimental.json", extensions::Manifest::COMPONENT); LoadAndExpectSuccess("experimental.json", extensions::Manifest::COMPONENT);
LoadAndExpectSuccess("experimental.json", extensions::Manifest::INTERNAL, LoadAndExpectSuccess("experimental.json", extensions::Manifest::INTERNAL,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/strings/string_util.h" #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 "chrome/common/extensions/manifest_url_handler.h"
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
#include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_constants.h"
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
namespace errors = extensions::manifest_errors; namespace errors = extensions::manifest_errors;
class HomepageURLManifestTest : public ChromeManifestTest { class HomepageURLManifestTest : public ExtensionManifestTest {
}; };
TEST_F(HomepageURLManifestTest, ParseHomepageURLs) { TEST_F(HomepageURLManifestTest, ParseHomepageURLs) {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/memory/linked_ptr.h" #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/constants.h"
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
#include "extensions/common/extension_icon_set.h" #include "extensions/common/extension_icon_set.h"
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
namespace extensions { namespace extensions {
class IconsManifestTest : public ChromeManifestTest { class IconsManifestTest : public ExtensionManifestTest {
}; };
TEST_F(IconsManifestTest, NormalizeIconPaths) { TEST_F(IconsManifestTest, NormalizeIconPaths) {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "base/path_service.h" #include "base/path_service.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/common/chrome_paths.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 "components/crx_file/id_util.h"
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
#include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_constants.h"
...@@ -28,7 +28,7 @@ const char kWhitelistID[] = "lmadimbbgapmngbiclpjjngmdickadpl"; ...@@ -28,7 +28,7 @@ const char kWhitelistID[] = "lmadimbbgapmngbiclpjjngmdickadpl";
namespace errors = manifest_errors; namespace errors = manifest_errors;
namespace keys = manifest_keys; namespace keys = manifest_keys;
class InitValueManifestTest : public ChromeManifestTest { class InitValueManifestTest : public ExtensionManifestTest {
}; };
TEST_F(InitValueManifestTest, InitFromValueInvalid) { TEST_F(InitValueManifestTest, InitFromValueInvalid) {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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/command_line.h"
#include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h"
...@@ -15,7 +15,7 @@ namespace extensions { ...@@ -15,7 +15,7 @@ namespace extensions {
namespace errors = manifest_errors; namespace errors = manifest_errors;
class IsolatedAppsManifestTest : public ChromeManifestTest { class IsolatedAppsManifestTest : public ExtensionManifestTest {
}; };
TEST_F(IsolatedAppsManifestTest, IsolatedApps) { TEST_F(IsolatedAppsManifestTest, IsolatedApps) {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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/extension.h"
#include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handlers/kiosk_mode_info.h" #include "extensions/common/manifest_handlers/kiosk_mode_info.h"
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
namespace extensions { namespace extensions {
class ExtensionManifestKioskModeTest : public ChromeManifestTest { class ExtensionManifestKioskModeTest : public ExtensionManifestTest {
}; };
TEST_F(ExtensionManifestKioskModeTest, InvalidKioskEnabled) { TEST_F(ExtensionManifestKioskModeTest, InvalidKioskEnabled) {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/manifest_handlers/app_launch_info.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/error_utils.h"
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
#include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_constants.h"
...@@ -16,7 +16,7 @@ namespace extensions { ...@@ -16,7 +16,7 @@ namespace extensions {
namespace errors = manifest_errors; namespace errors = manifest_errors;
namespace keys = manifest_keys; namespace keys = manifest_keys;
class AppLaunchManifestTest : public ChromeManifestTest { class AppLaunchManifestTest : public ExtensionManifestTest {
}; };
TEST_F(AppLaunchManifestTest, AppLaunchContainer) { TEST_F(AppLaunchManifestTest, AppLaunchContainer) {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/command_line.h" #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/constants.h"
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
#include "extensions/common/manifest_handlers/launcher_page_info.h" #include "extensions/common/manifest_handlers/launcher_page_info.h"
...@@ -19,7 +19,7 @@ const char kWhitelistID[] = "lmadimbbgapmngbiclpjjngmdickadpl"; ...@@ -19,7 +19,7 @@ const char kWhitelistID[] = "lmadimbbgapmngbiclpjjngmdickadpl";
} // namespace } // namespace
typedef ChromeManifestTest LauncherPageManifestTest; typedef ExtensionManifestTest LauncherPageManifestTest;
TEST_F(LauncherPageManifestTest, ValidLauncherPage) { TEST_F(LauncherPageManifestTest, ValidLauncherPage) {
CommandLine::ForCurrentProcess()->AppendSwitchASCII( CommandLine::ForCurrentProcess()->AppendSwitchASCII(
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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_constants.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -12,7 +12,7 @@ using extensions::Extension; ...@@ -12,7 +12,7 @@ using extensions::Extension;
namespace errors = extensions::manifest_errors; namespace errors = extensions::manifest_errors;
TEST_F(ChromeManifestTest, ManifestVersionError) { TEST_F(ExtensionManifestTest, ManifestVersionError) {
scoped_ptr<base::DictionaryValue> manifest1(new base::DictionaryValue()); scoped_ptr<base::DictionaryValue> manifest1(new base::DictionaryValue());
manifest1->SetString("name", "Miles"); manifest1->SetString("name", "Miles");
manifest1->SetString("version", "0.55"); manifest1->SetString("version", "0.55");
...@@ -43,13 +43,13 @@ TEST_F(ChromeManifestTest, ManifestVersionError) { ...@@ -43,13 +43,13 @@ TEST_F(ChromeManifestTest, ManifestVersionError) {
create_flags |= Extension::REQUIRE_MODERN_MANIFEST_VERSION; create_flags |= Extension::REQUIRE_MODERN_MANIFEST_VERSION;
if (test_data[i].expect_error) { if (test_data[i].expect_error) {
LoadAndExpectError( LoadAndExpectError(
ManifestData(test_data[i].manifest, Manifest(test_data[i].manifest,
test_data[i].test_name), test_data[i].test_name),
errors::kInvalidManifestVersionOld, errors::kInvalidManifestVersionOld,
extensions::Manifest::UNPACKED, extensions::Manifest::UNPACKED,
create_flags); create_flags);
} else { } else {
LoadAndExpectSuccess(ManifestData(test_data[i].manifest, LoadAndExpectSuccess(Manifest(test_data[i].manifest,
test_data[i].test_name), test_data[i].test_name),
extensions::Manifest::UNPACKED, extensions::Manifest::UNPACKED,
create_flags); create_flags);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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/extension.h"
#include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handlers/offline_enabled_info.h" #include "extensions/common/manifest_handlers/offline_enabled_info.h"
...@@ -12,7 +12,7 @@ namespace extensions { ...@@ -12,7 +12,7 @@ namespace extensions {
namespace errors = manifest_errors; namespace errors = manifest_errors;
class ExtensionManifestOfflineEnabledTest : public ChromeManifestTest { class ExtensionManifestOfflineEnabledTest : public ExtensionManifestTest {
}; };
TEST_F(ExtensionManifestOfflineEnabledTest, OfflineEnabled) { TEST_F(ExtensionManifestOfflineEnabledTest, OfflineEnabled) {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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/extension.h"
#include "extensions/common/permissions/permissions_data.h" #include "extensions/common/permissions/permissions_data.h"
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// Tests that the old permission name "unlimited_storage" still works for // Tests that the old permission name "unlimited_storage" still works for
// backwards compatibility (we renamed it to "unlimitedStorage"). // backwards compatibility (we renamed it to "unlimitedStorage").
TEST_F(ChromeManifestTest, OldUnlimitedStoragePermission) { TEST_F(ExtensionManifestTest, OldUnlimitedStoragePermission) {
scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess( scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(
"old_unlimited_storage.json", extensions::Manifest::INTERNAL, "old_unlimited_storage.json", extensions::Manifest::INTERNAL,
extensions::Extension::NO_FLAGS); extensions::Extension::NO_FLAGS);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/strings/stringprintf.h" #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/error_utils.h"
#include "extensions/common/feature_switch.h" #include "extensions/common/feature_switch.h"
#include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_constants.h"
...@@ -14,7 +14,7 @@ using namespace extensions; ...@@ -14,7 +14,7 @@ using namespace extensions;
namespace errors = extensions::manifest_errors; namespace errors = extensions::manifest_errors;
class OptionsPageManifestTest : public ChromeManifestTest { class OptionsPageManifestTest : public ExtensionManifestTest {
}; };
TEST_F(OptionsPageManifestTest, OptionsPageInApps) { TEST_F(OptionsPageManifestTest, OptionsPageInApps) {
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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 "chrome/common/extensions/manifest_url_handler.h"
#include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_constants.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace errors = extensions::manifest_errors; namespace errors = extensions::manifest_errors;
class URLOverridesManifestTest : public ChromeManifestTest { class URLOverridesManifestTest : public ExtensionManifestTest {
}; };
TEST_F(URLOverridesManifestTest, Override) { TEST_F(URLOverridesManifestTest, Override) {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "base/json/json_file_value_serializer.h" #include "base/json/json_file_value_serializer.h"
#include "base/memory/linked_ptr.h" #include "base/memory/linked_ptr.h"
#include "chrome/common/extensions/manifest_handlers/app_isolation_info.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/error_utils.h"
#include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handlers/csp_info.h" #include "extensions/common/manifest_handlers/csp_info.h"
...@@ -18,7 +18,7 @@ namespace extensions { ...@@ -18,7 +18,7 @@ namespace extensions {
namespace errors = manifest_errors; namespace errors = manifest_errors;
class PlatformAppsManifestTest : public ChromeManifestTest { class PlatformAppsManifestTest : public ExtensionManifestTest {
}; };
TEST_F(PlatformAppsManifestTest, PlatformApps) { TEST_F(PlatformAppsManifestTest, PlatformApps) {
...@@ -131,7 +131,7 @@ TEST_F(PlatformAppsManifestTest, CertainApisRequirePlatformApps) { ...@@ -131,7 +131,7 @@ TEST_F(PlatformAppsManifestTest, CertainApisRequirePlatformApps) {
// First try to load without any flags. This should fail for every API. // First try to load without any flags. This should fail for every API.
for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) {
LoadAndExpectError(ManifestData(manifests[i].get(), ""), LoadAndExpectError(Manifest(manifests[i].get(), ""),
errors::kExperimentalFlagRequired); errors::kExperimentalFlagRequired);
} }
...@@ -139,7 +139,7 @@ TEST_F(PlatformAppsManifestTest, CertainApisRequirePlatformApps) { ...@@ -139,7 +139,7 @@ TEST_F(PlatformAppsManifestTest, CertainApisRequirePlatformApps) {
CommandLine::ForCurrentProcess()->AppendSwitch( CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableExperimentalExtensionApis); switches::kEnableExperimentalExtensionApis);
for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) {
LoadAndExpectSuccess(ManifestData(manifests[i].get(), "")); LoadAndExpectSuccess(Manifest(manifests[i].get(), ""));
} }
} }
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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" #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. // Loading as a user would shoud not trigger an error.
LoadAndExpectSuccess("ports_in_permissions.json"); LoadAndExpectSuccess("ports_in_permissions.json");
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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/error_utils.h"
#include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handlers/requirements_info.h" #include "extensions/common/manifest_handlers/requirements_info.h"
...@@ -12,7 +12,7 @@ namespace extensions { ...@@ -12,7 +12,7 @@ namespace extensions {
namespace errors = manifest_errors; namespace errors = manifest_errors;
class RequirementsManifestTest : public ChromeManifestTest { class RequirementsManifestTest : public ExtensionManifestTest {
}; };
TEST_F(RequirementsManifestTest, RequirementsInvalid) { TEST_F(RequirementsManifestTest, RequirementsInvalid) {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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_constants.h"
#include "extensions/common/manifest_handlers/csp_info.h" #include "extensions/common/manifest_handlers/csp_info.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -11,7 +11,7 @@ namespace extensions { ...@@ -11,7 +11,7 @@ namespace extensions {
namespace errors = manifest_errors; namespace errors = manifest_errors;
class SandboxedPagesManifestTest : public ChromeManifestTest { class SandboxedPagesManifestTest : public ExtensionManifestTest {
}; };
TEST_F(SandboxedPagesManifestTest, SandboxedPages) { TEST_F(SandboxedPagesManifestTest, SandboxedPages) {
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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_constants.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace keys = extensions::manifest_keys; namespace keys = extensions::manifest_keys;
TEST_F(ChromeManifestTest, StorageAPIManifestVersionAvailability) { TEST_F(ExtensionManifestTest, StorageAPIManifestVersionAvailability) {
base::DictionaryValue base_manifest; base::DictionaryValue base_manifest;
{ {
base_manifest.SetString(keys::kName, "test"); base_manifest.SetString(keys::kName, "test");
...@@ -24,7 +24,7 @@ TEST_F(ChromeManifestTest, StorageAPIManifestVersionAvailability) { ...@@ -24,7 +24,7 @@ TEST_F(ChromeManifestTest, StorageAPIManifestVersionAvailability) {
// Extension with no manifest version cannot use storage API. // Extension with no manifest version cannot use storage API.
{ {
ManifestData manifest(&base_manifest, "test"); Manifest manifest(&base_manifest, "test");
LoadAndExpectWarning(manifest, kManifestVersionError); LoadAndExpectWarning(manifest, kManifestVersionError);
} }
...@@ -34,7 +34,7 @@ TEST_F(ChromeManifestTest, StorageAPIManifestVersionAvailability) { ...@@ -34,7 +34,7 @@ TEST_F(ChromeManifestTest, StorageAPIManifestVersionAvailability) {
manifest_with_version.SetInteger(keys::kManifestVersion, 1); manifest_with_version.SetInteger(keys::kManifestVersion, 1);
manifest_with_version.MergeDictionary(&base_manifest); manifest_with_version.MergeDictionary(&base_manifest);
ManifestData manifest(&manifest_with_version, "test"); Manifest manifest(&manifest_with_version, "test");
LoadAndExpectWarning(manifest, kManifestVersionError); LoadAndExpectWarning(manifest, kManifestVersionError);
} }
...@@ -44,7 +44,7 @@ TEST_F(ChromeManifestTest, StorageAPIManifestVersionAvailability) { ...@@ -44,7 +44,7 @@ TEST_F(ChromeManifestTest, StorageAPIManifestVersionAvailability) {
manifest_with_version.SetInteger(keys::kManifestVersion, 2); manifest_with_version.SetInteger(keys::kManifestVersion, 2);
manifest_with_version.MergeDictionary(&base_manifest); manifest_with_version.MergeDictionary(&base_manifest);
ManifestData manifest(&manifest_with_version, "test"); Manifest manifest(&manifest_with_version, "test");
scoped_refptr<extensions::Extension> extension = scoped_refptr<extensions::Extension> extension =
LoadAndExpectSuccess(manifest); LoadAndExpectSuccess(manifest);
EXPECT_TRUE(extension->install_warnings().empty()); EXPECT_TRUE(extension->install_warnings().empty());
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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_constants.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace extensions { namespace extensions {
class UIManifestTest : public ChromeManifestTest { class UIManifestTest : public ExtensionManifestTest {
}; };
TEST_F(UIManifestTest, DisallowMultipleUISurfaces) { TEST_F(UIManifestTest, DisallowMultipleUISurfaces) {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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 "chrome/common/extensions/manifest_url_handler.h"
#include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_constants.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -11,7 +11,7 @@ using extensions::Extension; ...@@ -11,7 +11,7 @@ using extensions::Extension;
namespace errors = extensions::manifest_errors; namespace errors = extensions::manifest_errors;
class UpdateURLManifestTest : public ChromeManifestTest { class UpdateURLManifestTest : public ExtensionManifestTest {
}; };
TEST_F(UpdateURLManifestTest, UpdateUrls) { TEST_F(UpdateURLManifestTest, UpdateUrls) {
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/values.h" #include "base/values.h"
#include "chrome/common/extensions/manifest_handlers/app_launch_info.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" #include "testing/gtest/include/gtest/gtest.h"
typedef ChromeManifestTest ValidAppManifestTest; typedef ExtensionManifestTest ValidAppManifestTest;
TEST_F(ValidAppManifestTest, ValidApp) { TEST_F(ValidAppManifestTest, ValidApp) {
scoped_refptr<extensions::Extension> extension( scoped_refptr<extensions::Extension> extension(
...@@ -30,5 +30,5 @@ TEST_F(ValidAppManifestTest, AllowUnrecognizedPermissions) { ...@@ -30,5 +30,5 @@ TEST_F(ValidAppManifestTest, AllowUnrecognizedPermissions) {
base::ListValue* permissions = NULL; base::ListValue* permissions = NULL;
ASSERT_TRUE(manifest->GetList("permissions", &permissions)); ASSERT_TRUE(manifest->GetList("permissions", &permissions));
permissions->Append(new base::StringValue("not-a-valid-permission")); permissions->Append(new base::StringValue("not-a-valid-permission"));
LoadAndExpectSuccess(ManifestData(manifest.get(), "")); LoadAndExpectSuccess(Manifest(manifest.get(), ""));
} }
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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 "extensions/common/manifest_handlers/web_accessible_resources_info.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
using extensions::Extension; using extensions::Extension;
using extensions::WebAccessibleResourcesInfo; using extensions::WebAccessibleResourcesInfo;
class WebAccessibleResourcesManifestTest : public ChromeManifestTest { class WebAccessibleResourcesManifestTest : public ExtensionManifestTest {
}; };
TEST_F(WebAccessibleResourcesManifestTest, WebAccessibleResources) { TEST_F(WebAccessibleResourcesManifestTest, WebAccessibleResources) {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
...@@ -15,7 +15,7 @@ using extensions::Extension; ...@@ -15,7 +15,7 @@ using extensions::Extension;
namespace errors = extensions::manifest_errors; namespace errors = extensions::manifest_errors;
TEST_F(ChromeManifestTest, AppWebUrls) { TEST_F(ExtensionManifestTest, AppWebUrls) {
Testcase testcases[] = { Testcase testcases[] = {
Testcase("web_urls_wrong_type.json", errors::kInvalidWebURLs), Testcase("web_urls_wrong_type.json", errors::kInvalidWebURLs),
Testcase("web_urls_invalid_1.json", Testcase("web_urls_invalid_1.json",
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/strings/string_number_conversions.h" #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/error_utils.h"
#include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handlers/webview_info.h" #include "extensions/common/manifest_handlers/webview_info.h"
...@@ -13,7 +13,7 @@ using extensions::Extension; ...@@ -13,7 +13,7 @@ using extensions::Extension;
using extensions::WebviewInfo; using extensions::WebviewInfo;
namespace errors = extensions::manifest_errors; namespace errors = extensions::manifest_errors;
class WebviewAccessibleResourcesManifestTest : public ChromeManifestTest { class WebviewAccessibleResourcesManifestTest : public ExtensionManifestTest {
}; };
TEST_F(WebviewAccessibleResourcesManifestTest, WebviewAccessibleResources) { TEST_F(WebviewAccessibleResourcesManifestTest, WebviewAccessibleResources) {
......
...@@ -23,10 +23,9 @@ namespace extensions { ...@@ -23,10 +23,9 @@ namespace extensions {
namespace errors = manifest_errors; namespace errors = manifest_errors;
namespace keys = manifest_keys; namespace keys = manifest_keys;
// Not named "ManifestTest" because a test utility class has that name. class ManifestTest : public testing::Test {
class ManifestUnitTest : public testing::Test {
public: public:
ManifestUnitTest() : default_value_("test") {} ManifestTest() : default_value_("test") {}
protected: protected:
void AssertType(Manifest* manifest, Manifest::Type type) { void AssertType(Manifest* manifest, Manifest::Type type) {
...@@ -60,7 +59,7 @@ class ManifestUnitTest : public testing::Test { ...@@ -60,7 +59,7 @@ class ManifestUnitTest : public testing::Test {
}; };
// Verifies that extensions can access the correct keys. // 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()); scoped_ptr<base::DictionaryValue> manifest_value(new base::DictionaryValue());
manifest_value->SetString(keys::kName, "extension"); manifest_value->SetString(keys::kName, "extension");
manifest_value->SetString(keys::kVersion, "1"); manifest_value->SetString(keys::kVersion, "1");
...@@ -118,7 +117,7 @@ TEST_F(ManifestUnitTest, Extension) { ...@@ -118,7 +117,7 @@ TEST_F(ManifestUnitTest, Extension) {
} }
// Verifies that key restriction based on type works. // Verifies that key restriction based on type works.
TEST_F(ManifestUnitTest, ExtensionTypes) { TEST_F(ManifestTest, ExtensionTypes) {
scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
value->SetString(keys::kName, "extension"); value->SetString(keys::kName, "extension");
value->SetString(keys::kVersion, "1"); value->SetString(keys::kVersion, "1");
...@@ -174,7 +173,7 @@ TEST_F(ManifestUnitTest, ExtensionTypes) { ...@@ -174,7 +173,7 @@ TEST_F(ManifestUnitTest, ExtensionTypes) {
}; };
// Verifies that the getters filter restricted keys. // Verifies that the getters filter restricted keys.
TEST_F(ManifestUnitTest, RestrictedKeys) { TEST_F(ManifestTest, RestrictedKeys) {
scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
value->SetString(keys::kName, "extension"); value->SetString(keys::kName, "extension");
value->SetString(keys::kVersion, "1"); value->SetString(keys::kVersion, "1");
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/values.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/manifest_constants.h"
#include "extensions/common/permissions/permission_set.h" #include "extensions/common/permissions/permission_set.h"
#include "extensions/common/permissions/permissions_data.h" #include "extensions/common/permissions/permissions_data.h"
...@@ -18,7 +18,7 @@ namespace extensions { ...@@ -18,7 +18,7 @@ namespace extensions {
namespace { namespace {
class SettingsOverridePermissionTest : public ChromeManifestTest { class SettingsOverridePermissionTest : public ExtensionManifestTest {
protected: protected:
enum Flags { enum Flags {
kHomepage = 1, kHomepage = 1,
...@@ -56,7 +56,7 @@ class SettingsOverridePermissionTest : public ChromeManifestTest { ...@@ -56,7 +56,7 @@ class SettingsOverridePermissionTest : public ChromeManifestTest {
ext_manifest.Set( ext_manifest.Set(
manifest_keys::kSettingsOverride, settings_override.release()); manifest_keys::kSettingsOverride, settings_override.release());
ManifestData manifest(&ext_manifest, "test"); Manifest manifest(&ext_manifest, "test");
return LoadAndExpectSuccess(manifest); return LoadAndExpectSuccess(manifest);
} }
}; };
......
...@@ -75,8 +75,6 @@ source_set("test_support") { ...@@ -75,8 +75,6 @@ source_set("test_support") {
"browser/test_runtime_api_delegate.h", "browser/test_runtime_api_delegate.h",
"common/extension_builder.cc", "common/extension_builder.cc",
"common/extension_builder.h", "common/extension_builder.h",
"common/manifest_test.cc",
"common/manifest_test.h",
"common/test_util.cc", "common/test_util.cc",
"common/test_util.h", "common/test_util.h",
"common/value_builder.cc", "common/value_builder.cc",
...@@ -208,7 +206,6 @@ test("unittests") { ...@@ -208,7 +206,6 @@ test("unittests") {
"common/extension_resource_unittest.cc", "common/extension_resource_unittest.cc",
"common/extension_set_unittest.cc", "common/extension_set_unittest.cc",
"common/manifest_handler_unittest.cc", "common/manifest_handler_unittest.cc",
"common/manifest_handlers/shared_module_manifest_unittest.cc",
"common/message_bundle_unittest.cc", "common/message_bundle_unittest.cc",
"common/one_shot_event_unittest.cc", "common/one_shot_event_unittest.cc",
"common/permissions/manifest_permission_set_unittest.cc", "common/permissions/manifest_permission_set_unittest.cc",
......
...@@ -39,7 +39,7 @@ specific_include_rules = { ...@@ -39,7 +39,7 @@ specific_include_rules = {
"+chrome/browser/ui/browser.h", "+chrome/browser/ui/browser.h",
"+chrome/common/chrome_paths.h", "+chrome/common/chrome_paths.h",
"+chrome/common/extensions/features/feature_channel.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/testing_profile.h",
"+chrome/test/base/ui_test_utils.h", "+chrome/test/base/ui_test_utils.h",
], ],
......
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
#include <algorithm> #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/error_utils.h"
#include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handlers/externally_connectable.h" #include "extensions/common/manifest_handlers/externally_connectable.h"
...@@ -18,11 +19,9 @@ namespace extensions { ...@@ -18,11 +19,9 @@ namespace extensions {
namespace errors = externally_connectable_errors; namespace errors = externally_connectable_errors;
// TODO(jamescook): Convert from ChromeManifestTest to ManifestTest. class ExternallyConnectableTest : public ExtensionManifestTest {
class ExternallyConnectableTest : public ChromeManifestTest {
public: public:
ExternallyConnectableTest() {} ExternallyConnectableTest() : channel_(chrome::VersionInfo::CHANNEL_DEV) {}
virtual ~ExternallyConnectableTest() {}
protected: protected:
ExternallyConnectableInfo* GetExternallyConnectableInfo( ExternallyConnectableInfo* GetExternallyConnectableInfo(
...@@ -30,6 +29,9 @@ class ExternallyConnectableTest : public ChromeManifestTest { ...@@ -30,6 +29,9 @@ class ExternallyConnectableTest : public ChromeManifestTest {
return static_cast<ExternallyConnectableInfo*>( return static_cast<ExternallyConnectableInfo*>(
extension->GetManifestData(manifest_keys::kExternallyConnectable)); extension->GetManifestData(manifest_keys::kExternallyConnectable));
} }
private:
ScopedCurrentChannel channel_;
}; };
TEST_F(ExternallyConnectableTest, IDsAndMatches) { TEST_F(ExternallyConnectableTest, IDsAndMatches) {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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_constants.h"
#include "extensions/common/manifest_handlers/file_handler_info.h" #include "extensions/common/manifest_handlers/file_handler_info.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -11,8 +11,7 @@ namespace extensions { ...@@ -11,8 +11,7 @@ namespace extensions {
namespace errors = manifest_errors; namespace errors = manifest_errors;
// TODO(jamescook): Convert from ChromeManifestTest to ManifestTest. class FileHandlersManifestTest : public ExtensionManifestTest {
class FileHandlersManifestTest : public ChromeManifestTest {
}; };
TEST_F(FileHandlersManifestTest, InvalidFileHandlers) { TEST_F(FileHandlersManifestTest, InvalidFileHandlers) {
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/version.h" #include "base/version.h"
#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
#include "extensions/common/manifest_handlers/shared_module_info.h" #include "extensions/common/manifest_handlers/shared_module_info.h"
#include "extensions/common/manifest_test.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace { namespace {
...@@ -23,11 +23,11 @@ const char* kNoImport = "cccccccccccccccccccccccccccccccc"; ...@@ -23,11 +23,11 @@ const char* kNoImport = "cccccccccccccccccccccccccccccccc";
namespace extensions { namespace extensions {
class SharedModuleManifestTest : public ManifestTest { class SharedModuleManifestTest : public ExtensionManifestTest {
}; };
TEST_F(SharedModuleManifestTest, ExportsAll) { TEST_F(SharedModuleManifestTest, ExportsAll) {
ManifestData manifest("shared_module_export.json"); Manifest manifest("shared_module_export.json");
scoped_refptr<Extension> extension = LoadAndExpectSuccess(manifest); scoped_refptr<Extension> extension = LoadAndExpectSuccess(manifest);
...@@ -49,7 +49,7 @@ TEST_F(SharedModuleManifestTest, ExportsAll) { ...@@ -49,7 +49,7 @@ TEST_F(SharedModuleManifestTest, ExportsAll) {
} }
TEST_F(SharedModuleManifestTest, ExportWhitelistAll) { 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); scoped_refptr<Extension> extension = LoadAndExpectSuccess(manifest);
...@@ -62,7 +62,7 @@ TEST_F(SharedModuleManifestTest, ExportWhitelistAll) { ...@@ -62,7 +62,7 @@ TEST_F(SharedModuleManifestTest, ExportWhitelistAll) {
} }
TEST_F(SharedModuleManifestTest, ExportFoo) { TEST_F(SharedModuleManifestTest, ExportFoo) {
ManifestData manifest("shared_module_export_foo.json"); Manifest manifest("shared_module_export_foo.json");
scoped_refptr<Extension> extension = LoadAndExpectSuccess(manifest); scoped_refptr<Extension> extension = LoadAndExpectSuccess(manifest);
...@@ -108,7 +108,7 @@ TEST_F(SharedModuleManifestTest, SharedModuleStaticFunctions) { ...@@ -108,7 +108,7 @@ TEST_F(SharedModuleManifestTest, SharedModuleStaticFunctions) {
} }
TEST_F(SharedModuleManifestTest, Import) { TEST_F(SharedModuleManifestTest, Import) {
ManifestData manifest("shared_module_import.json"); Manifest manifest("shared_module_import.json");
scoped_refptr<Extension> extension = LoadAndExpectSuccess(manifest); scoped_refptr<Extension> extension = LoadAndExpectSuccess(manifest);
......
...@@ -4,9 +4,12 @@ ...@@ -4,9 +4,12 @@
#include "extensions/common/test_util.h" #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.h"
#include "extensions/common/extension_builder.h" #include "extensions/common/extension_builder.h"
#include "extensions/common/value_builder.h" #include "extensions/common/value_builder.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace extensions { namespace extensions {
namespace test_util { namespace test_util {
...@@ -36,5 +39,21 @@ scoped_refptr<Extension> CreateExtensionWithID(const std::string& id) { ...@@ -36,5 +39,21 @@ scoped_refptr<Extension> CreateExtensionWithID(const std::string& id) {
.Build(); .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 test_util
} // namespace extensions } // namespace extensions
...@@ -8,6 +8,11 @@ ...@@ -8,6 +8,11 @@
#include <string> #include <string>
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
namespace base {
class DictionaryValue;
} // namespace base
namespace extensions { namespace extensions {
class Extension; class Extension;
...@@ -25,6 +30,12 @@ scoped_refptr<Extension> CreateEmptyExtension(); ...@@ -25,6 +30,12 @@ scoped_refptr<Extension> CreateEmptyExtension();
// Return a very simple extension with a given |id|. // Return a very simple extension with a given |id|.
scoped_refptr<Extension> CreateExtensionWithID(const std::string& 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 test_util
} // namespace extensions } // namespace extensions
......
...@@ -934,8 +934,6 @@ ...@@ -934,8 +934,6 @@
'browser/test_runtime_api_delegate.h', 'browser/test_runtime_api_delegate.h',
'common/extension_builder.cc', 'common/extension_builder.cc',
'common/extension_builder.h', 'common/extension_builder.h',
'common/manifest_test.cc',
'common/manifest_test.h',
'common/test_util.cc', 'common/test_util.cc',
'common/test_util.h', 'common/test_util.h',
'common/value_builder.cc', 'common/value_builder.cc',
...@@ -1096,7 +1094,6 @@ ...@@ -1096,7 +1094,6 @@
'common/features/complex_feature_unittest.cc', 'common/features/complex_feature_unittest.cc',
'common/features/simple_feature_unittest.cc', 'common/features/simple_feature_unittest.cc',
'common/manifest_handler_unittest.cc', 'common/manifest_handler_unittest.cc',
'common/manifest_handlers/shared_module_manifest_unittest.cc',
'common/message_bundle_unittest.cc', 'common/message_bundle_unittest.cc',
'common/one_shot_event_unittest.cc', 'common/one_shot_event_unittest.cc',
'common/permissions/api_permission_set_unittest.cc', 'common/permissions/api_permission_set_unittest.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment