Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
|
Yoyo Zhou
2013/01/04 00:13:30
This is also a content scripts test - put it in th
Devlin
2013/01/11 20:30:02
Done.
| |
| 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 "chrome/common/extensions/api/content_scripts/content_scripts_handler.h " | |
| 7 #include "chrome/common/extensions/extension.h" | 8 #include "chrome/common/extensions/extension.h" |
| 9 #include "chrome/common/extensions/extension_manifest_constants.h" | |
| 10 #include "chrome/common/extensions/manifest_handler.h" | |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 12 |
| 10 TEST_F(ExtensionManifestTest, ExcludeMatchPatterns) { | 13 namespace extensions { |
| 14 | |
| 15 class ExcludeMatchesManifestTest : public ExtensionManifestTest { | |
| 16 protected: | |
| 17 virtual void SetUp() OVERRIDE { | |
| 18 ExtensionManifestTest::SetUp(); | |
| 19 ManifestHandler::Register(extension_manifest_keys::kContentScripts, | |
| 20 new ContentScriptsHandler); | |
| 21 } | |
| 22 }; | |
| 23 | |
| 24 TEST_F(ExcludeMatchesManifestTest, ExcludeMatchPatterns) { | |
| 11 Testcase testcases[] = { | 25 Testcase testcases[] = { |
| 12 Testcase("exclude_matches.json"), | 26 Testcase("exclude_matches.json"), |
| 13 Testcase("exclude_matches_empty.json") | 27 Testcase("exclude_matches_empty.json") |
| 14 }; | 28 }; |
| 15 RunTestcases(testcases, arraysize(testcases), | 29 RunTestcases(testcases, arraysize(testcases), |
| 16 EXPECT_TYPE_SUCCESS); | 30 EXPECT_TYPE_SUCCESS); |
| 17 | 31 |
| 18 Testcase testcases2[] = { | 32 Testcase testcases2[] = { |
| 19 Testcase("exclude_matches_not_list.json", | 33 Testcase("exclude_matches_not_list.json", |
| 20 "Invalid value for 'content_scripts[0].exclude_matches'."), | 34 "Invalid value for 'content_scripts[0].exclude_matches'."), |
| 21 Testcase("exclude_matches_invalid_host.json", | 35 Testcase("exclude_matches_invalid_host.json", |
| 22 "Invalid value for 'content_scripts[0].exclude_matches[0]': " | 36 "Invalid value for 'content_scripts[0].exclude_matches[0]': " |
| 23 "Invalid host wildcard.") | 37 "Invalid host wildcard.") |
| 24 }; | 38 }; |
| 25 RunTestcases(testcases2, arraysize(testcases2), | 39 RunTestcases(testcases2, arraysize(testcases2), |
| 26 EXPECT_TYPE_ERROR); | 40 EXPECT_TYPE_ERROR); |
| 27 } | 41 } |
| 42 | |
| 43 } // namespace extensions | |
| OLD | NEW |