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

Side by Side Diff: chrome/common/extensions/manifest_tests/extension_manifests_contentsecuritypolicy_unittest.cc

Issue 747403002: Ignore insecure parts of CSP in extensions and allow extension to load (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test expectations Created 5 years, 12 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
« no previous file with comments | « no previous file | chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/chrome_manifest_test.h" 5 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h"
6 #include "extensions/common/error_utils.h"
6 #include "extensions/common/manifest_constants.h" 7 #include "extensions/common/manifest_constants.h"
7 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
8 9
9 namespace errors = extensions::manifest_errors; 10 namespace errors = extensions::manifest_errors;
11 using extensions::ErrorUtils;
10 12
11 class ContentSecurityPolicyManifestTest : public ChromeManifestTest { 13 class ContentSecurityPolicyManifestTest : public ChromeManifestTest {
12 }; 14 };
13 15
14 TEST_F(ContentSecurityPolicyManifestTest, InsecureContentSecurityPolicy) { 16 TEST_F(ContentSecurityPolicyManifestTest, InsecureContentSecurityPolicy) {
15 Testcase testcases[] = { 17 Testcase testcases[] = {
16 Testcase("insecure_contentsecuritypolicy_1.json", 18 Testcase(
17 errors::kInsecureContentSecurityPolicy), 19 "insecure_contentsecuritypolicy_1.json",
18 Testcase("insecure_contentsecuritypolicy_2.json", 20 ErrorUtils::FormatErrorMessage(errors::kInvalidCSPInsecureValue,
19 errors::kInsecureContentSecurityPolicy), 21 "http://example.com", "script-src")),
20 Testcase("insecure_contentsecuritypolicy_3.json", 22 Testcase("insecure_contentsecuritypolicy_2.json",
21 errors::kInsecureContentSecurityPolicy), 23 ErrorUtils::FormatErrorMessage(errors::kInvalidCSPInsecureValue,
22 }; 24 "'unsafe-inline'", "script-src")),
23 RunTestcases(testcases, arraysize(testcases), EXPECT_TYPE_ERROR); 25 Testcase("insecure_contentsecuritypolicy_3.json",
26 ErrorUtils::FormatErrorMessage(
27 errors::kInvalidCSPMissingSecureSrc, "object-src"))};
28 RunTestcases(testcases, arraysize(testcases), EXPECT_TYPE_WARNING);
24 } 29 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698