OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/strings/string_number_conversions.h" | 6 #include "base/strings/string_number_conversions.h" |
7 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" | 7 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" |
8 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" | 8 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
9 #include "extensions/common/error_utils.h" | 9 #include "extensions/common/error_utils.h" |
10 #include "extensions/common/extension.h" | 10 #include "extensions/common/extension.h" |
11 #include "extensions/common/manifest_constants.h" | 11 #include "extensions/common/manifest_constants.h" |
12 #include "extensions/common/switches.h" | 12 #include "extensions/common/switches.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace extensions { | 15 namespace extensions { |
16 | 16 |
17 namespace errors = manifest_errors; | 17 namespace errors = manifest_errors; |
18 | 18 |
19 class ContentScriptsManifestTest : public ChromeManifestTest { | 19 class ContentScriptsManifestTest : public ExtensionManifestTest { |
20 }; | 20 }; |
21 | 21 |
22 TEST_F(ContentScriptsManifestTest, MatchPattern) { | 22 TEST_F(ContentScriptsManifestTest, MatchPattern) { |
23 Testcase testcases[] = { | 23 Testcase testcases[] = { |
24 // chrome:// urls are not allowed. | 24 // chrome:// urls are not allowed. |
25 Testcase("content_script_chrome_url_invalid.json", | 25 Testcase("content_script_chrome_url_invalid.json", |
26 ErrorUtils::FormatErrorMessage( | 26 ErrorUtils::FormatErrorMessage( |
27 errors::kInvalidMatch, | 27 errors::kInvalidMatch, |
28 base::IntToString(0), | 28 base::IntToString(0), |
29 base::IntToString(0), | 29 base::IntToString(0), |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 ASSERT_EQ(1u, user_scripts1.size()); | 77 ASSERT_EQ(1u, user_scripts1.size()); |
78 int id = user_scripts1[0].id(); | 78 int id = user_scripts1[0].id(); |
79 const UserScriptList& user_scripts2 = | 79 const UserScriptList& user_scripts2 = |
80 ContentScriptsInfo::GetContentScripts(extension2.get()); | 80 ContentScriptsInfo::GetContentScripts(extension2.get()); |
81 ASSERT_EQ(1u, user_scripts2.size()); | 81 ASSERT_EQ(1u, user_scripts2.size()); |
82 // The id of the content script should be one higher than the previous. | 82 // The id of the content script should be one higher than the previous. |
83 EXPECT_EQ(id + 1, user_scripts2[0].id()); | 83 EXPECT_EQ(id + 1, user_scripts2[0].id()); |
84 } | 84 } |
85 | 85 |
86 } // namespace extensions | 86 } // namespace extensions |
OLD | NEW |