| Index: chrome/common/extensions/manifest_handlers/content_scripts_manifest_unittest.cc
|
| diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_contentscript_unittest.cc b/chrome/common/extensions/manifest_handlers/content_scripts_manifest_unittest.cc
|
| similarity index 59%
|
| rename from chrome/common/extensions/manifest_tests/extension_manifests_contentscript_unittest.cc
|
| rename to chrome/common/extensions/manifest_handlers/content_scripts_manifest_unittest.cc
|
| index 84708932a569bab4bef17330e7861ac9da68ddad..679357c0c5f07458a8ffc1f5a43db3401dc27732 100644
|
| --- a/chrome/common/extensions/manifest_tests/extension_manifests_contentscript_unittest.cc
|
| +++ b/chrome/common/extensions/manifest_handlers/content_scripts_manifest_unittest.cc
|
| @@ -1,4 +1,4 @@
|
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| @@ -7,17 +7,28 @@
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/extensions/extension.h"
|
| #include "chrome/common/extensions/extension_manifest_constants.h"
|
| +#include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h"
|
| #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
|
| #include "extensions/common/error_utils.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| namespace errors = extension_manifest_errors;
|
|
|
| -TEST_F(ExtensionManifestTest, ContentScriptMatchPattern) {
|
| +namespace extensions {
|
| +
|
| +class ContentScriptsManifestTest : public ExtensionManifestTest {
|
| + protected:
|
| + virtual void SetUp() OVERRIDE {
|
| + ExtensionManifestTest::SetUp();
|
| + (new ContentScriptsHandler)->Register();
|
| + }
|
| +};
|
| +
|
| +TEST_F(ContentScriptsManifestTest, ContentScriptMatchPattern) {
|
| Testcase testcases[] = {
|
| // chrome:// urls are not allowed.
|
| Testcase("content_script_chrome_url_invalid.json",
|
| - extensions::ErrorUtils::FormatErrorMessage(
|
| + ErrorUtils::FormatErrorMessage(
|
| errors::kInvalidMatch,
|
| base::IntToString(0),
|
| base::IntToString(0),
|
| @@ -26,10 +37,10 @@ TEST_F(ExtensionManifestTest, ContentScriptMatchPattern) {
|
|
|
| // Match paterns must be strings.
|
| Testcase("content_script_match_pattern_not_string.json",
|
| - extensions::ErrorUtils::FormatErrorMessage(errors::kInvalidMatch,
|
| - base::IntToString(0),
|
| - base::IntToString(0),
|
| - errors::kExpectString))
|
| + ErrorUtils::FormatErrorMessage(errors::kInvalidMatch,
|
| + base::IntToString(0),
|
| + base::IntToString(0),
|
| + errors::kExpectString))
|
| };
|
| RunTestcases(testcases, arraysize(testcases),
|
| EXPECT_TYPE_ERROR);
|
| @@ -37,7 +48,7 @@ TEST_F(ExtensionManifestTest, ContentScriptMatchPattern) {
|
| LoadAndExpectSuccess("ports_in_content_scripts.json");
|
| }
|
|
|
| -TEST_F(ExtensionManifestTest, ContentScriptsOnChromeUrlsWithFlag) {
|
| +TEST_F(ContentScriptsManifestTest, ContentScriptsOnChromeUrlsWithFlag) {
|
| CommandLine::ForCurrentProcess()->AppendSwitch(
|
| switches::kExtensionsOnChromeURLs);
|
| std::string error;
|
| @@ -45,5 +56,8 @@ TEST_F(ExtensionManifestTest, ContentScriptsOnChromeUrlsWithFlag) {
|
| LoadAndExpectSuccess("content_script_chrome_url_invalid.json");
|
| EXPECT_EQ("", error);
|
| const GURL newtab_url("chrome://newtab/");
|
| - EXPECT_TRUE(extension->HasContentScriptAtURL(newtab_url));
|
| + EXPECT_TRUE(ContentScriptsInfo::ExtensionHasScriptAtURL(extension,
|
| + newtab_url));
|
| }
|
| +
|
| +} // namespace extensions
|
|
|