Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(774)

Side by Side Diff: chrome/common/extensions/api/content_scripts/content_scripts_manifest_unittest.cc

Issue 11724002: Move ContentScripts out of Extension (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_browser_action
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" 5 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
6 6
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "chrome/common/extensions/api/content_scripts/content_scripts_handler.h "
8 #include "chrome/common/extensions/extension.h" 9 #include "chrome/common/extensions/extension.h"
9 #include "chrome/common/extensions/extension_manifest_constants.h" 10 #include "chrome/common/extensions/extension_manifest_constants.h"
11 #include "chrome/common/extensions/manifest_handler.h"
10 #include "extensions/common/error_utils.h" 12 #include "extensions/common/error_utils.h"
11 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
12 14
13 namespace errors = extension_manifest_errors; 15 namespace errors = extension_manifest_errors;
14 16
15 TEST_F(ExtensionManifestTest, ContentScriptMatchPattern) { 17 namespace extensions {
18
19 class ContentScriptsManifestTest : public ExtensionManifestTest {
20 protected:
21 virtual void SetUp() OVERRIDE {
22 ExtensionManifestTest::SetUp();
23 ManifestHandler::Register(extension_manifest_keys::kContentScripts,
24 new ContentScriptsHandler);
25 }
26 };
27
28 TEST_F(ContentScriptsManifestTest, ContentScriptMatchPattern) {
16 Testcase testcases[] = { 29 Testcase testcases[] = {
17 // chrome:// urls are not allowed. 30 // chrome:// urls are not allowed.
18 Testcase("content_script_chrome_url_invalid.json", 31 Testcase("content_script_chrome_url_invalid.json",
19 extensions::ErrorUtils::FormatErrorMessage( 32 ErrorUtils::FormatErrorMessage(
20 errors::kInvalidMatch, 33 errors::kInvalidMatch,
21 base::IntToString(0), 34 base::IntToString(0),
22 base::IntToString(0), 35 base::IntToString(0),
23 URLPattern::GetParseResultString( 36 URLPattern::GetParseResultString(
24 URLPattern::PARSE_ERROR_INVALID_SCHEME))), 37 URLPattern::PARSE_ERROR_INVALID_SCHEME))),
25 38
26 // Match paterns must be strings. 39 // Match paterns must be strings.
27 Testcase("content_script_match_pattern_not_string.json", 40 Testcase("content_script_match_pattern_not_string.json",
28 extensions::ErrorUtils::FormatErrorMessage(errors::kInvalidMatch, 41 ErrorUtils::FormatErrorMessage(errors::kInvalidMatch,
29 base::IntToString(0), 42 base::IntToString(0),
30 base::IntToString(0), 43 base::IntToString(0),
31 errors::kExpectString)) 44 errors::kExpectString))
32 }; 45 };
33 RunTestcases(testcases, arraysize(testcases), 46 RunTestcases(testcases, arraysize(testcases),
34 EXPECT_TYPE_ERROR); 47 EXPECT_TYPE_ERROR);
35 48
36 LoadAndExpectSuccess("ports_in_content_scripts.json"); 49 LoadAndExpectSuccess("ports_in_content_scripts.json");
37 } 50 }
51
52 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698