| OLD | NEW |
| 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 "base/macros.h" |
| 5 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" | 6 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" |
| 6 #include "extensions/common/error_utils.h" | 7 #include "extensions/common/error_utils.h" |
| 7 #include "extensions/common/manifest_constants.h" | 8 #include "extensions/common/manifest_constants.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 10 |
| 10 namespace errors = extensions::manifest_errors; | 11 namespace errors = extensions::manifest_errors; |
| 11 using extensions::ErrorUtils; | 12 using extensions::ErrorUtils; |
| 12 | 13 |
| 13 class ContentSecurityPolicyManifestTest : public ChromeManifestTest { | 14 class ContentSecurityPolicyManifestTest : public ChromeManifestTest { |
| 14 }; | 15 }; |
| 15 | 16 |
| 16 TEST_F(ContentSecurityPolicyManifestTest, InsecureContentSecurityPolicy) { | 17 TEST_F(ContentSecurityPolicyManifestTest, InsecureContentSecurityPolicy) { |
| 17 Testcase testcases[] = { | 18 Testcase testcases[] = { |
| 18 Testcase( | 19 Testcase( |
| 19 "insecure_contentsecuritypolicy_1.json", | 20 "insecure_contentsecuritypolicy_1.json", |
| 20 ErrorUtils::FormatErrorMessage(errors::kInvalidCSPInsecureValue, | 21 ErrorUtils::FormatErrorMessage(errors::kInvalidCSPInsecureValue, |
| 21 "http://example.com", "script-src")), | 22 "http://example.com", "script-src")), |
| 22 Testcase("insecure_contentsecuritypolicy_2.json", | 23 Testcase("insecure_contentsecuritypolicy_2.json", |
| 23 ErrorUtils::FormatErrorMessage(errors::kInvalidCSPInsecureValue, | 24 ErrorUtils::FormatErrorMessage(errors::kInvalidCSPInsecureValue, |
| 24 "'unsafe-inline'", "script-src")), | 25 "'unsafe-inline'", "script-src")), |
| 25 Testcase("insecure_contentsecuritypolicy_3.json", | 26 Testcase("insecure_contentsecuritypolicy_3.json", |
| 26 ErrorUtils::FormatErrorMessage( | 27 ErrorUtils::FormatErrorMessage( |
| 27 errors::kInvalidCSPMissingSecureSrc, "object-src"))}; | 28 errors::kInvalidCSPMissingSecureSrc, "object-src"))}; |
| 28 RunTestcases(testcases, arraysize(testcases), EXPECT_TYPE_WARNING); | 29 RunTestcases(testcases, arraysize(testcases), EXPECT_TYPE_WARNING); |
| 29 } | 30 } |
| OLD | NEW |