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