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

Side by Side Diff: chrome/common/extensions/csp_validator_unittest.cc

Issue 9909019: Add schema chrome-extension-resource:// for extension resources (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Make some test flaky for OSX Created 8 years, 7 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 | « chrome/common/extensions/csp_validator.cc ('k') | chrome/common/extensions/extension.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/csp_validator.h" 5 #include "chrome/common/extensions/csp_validator.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 using extensions::csp_validator::ContentSecurityPolicyIsLegal; 8 using extensions::csp_validator::ContentSecurityPolicyIsLegal;
9 using extensions::csp_validator::ContentSecurityPolicyIsSecure; 9 using extensions::csp_validator::ContentSecurityPolicyIsSecure;
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 EXPECT_FALSE(ContentSecurityPolicyIsSecure( 53 EXPECT_FALSE(ContentSecurityPolicyIsSecure(
54 "default-src 'unsafe-inline' 'none'")); 54 "default-src 'unsafe-inline' 'none'"));
55 EXPECT_FALSE(ContentSecurityPolicyIsSecure( 55 EXPECT_FALSE(ContentSecurityPolicyIsSecure(
56 "default-src 'self' http://google.com")); 56 "default-src 'self' http://google.com"));
57 EXPECT_TRUE(ContentSecurityPolicyIsSecure( 57 EXPECT_TRUE(ContentSecurityPolicyIsSecure(
58 "default-src 'self' https://google.com")); 58 "default-src 'self' https://google.com"));
59 EXPECT_TRUE(ContentSecurityPolicyIsSecure( 59 EXPECT_TRUE(ContentSecurityPolicyIsSecure(
60 "default-src 'self' chrome://resources")); 60 "default-src 'self' chrome://resources"));
61 EXPECT_TRUE(ContentSecurityPolicyIsSecure( 61 EXPECT_TRUE(ContentSecurityPolicyIsSecure(
62 "default-src 'self' chrome-extension://aabbcc")); 62 "default-src 'self' chrome-extension://aabbcc"));
63 EXPECT_TRUE(ContentSecurityPolicyIsSecure(
64 "default-src 'self' chrome-extension-resource://aabbcc"));
63 EXPECT_FALSE(ContentSecurityPolicyIsSecure( 65 EXPECT_FALSE(ContentSecurityPolicyIsSecure(
64 "default-src 'self' https:")); 66 "default-src 'self' https:"));
65 EXPECT_FALSE(ContentSecurityPolicyIsSecure( 67 EXPECT_FALSE(ContentSecurityPolicyIsSecure(
66 "default-src 'self' http:")); 68 "default-src 'self' http:"));
67 EXPECT_FALSE(ContentSecurityPolicyIsSecure( 69 EXPECT_FALSE(ContentSecurityPolicyIsSecure(
68 "default-src 'self' https://*")); 70 "default-src 'self' https://*"));
69 EXPECT_FALSE(ContentSecurityPolicyIsSecure( 71 EXPECT_FALSE(ContentSecurityPolicyIsSecure(
70 "default-src 'self' *")); 72 "default-src 'self' *"));
71 EXPECT_FALSE(ContentSecurityPolicyIsSecure( 73 EXPECT_FALSE(ContentSecurityPolicyIsSecure(
72 "default-src 'self' google.com")); 74 "default-src 'self' google.com"));
73 EXPECT_TRUE(ContentSecurityPolicyIsSecure( 75 EXPECT_TRUE(ContentSecurityPolicyIsSecure(
74 "default-src 'self' https://*.google.com")); 76 "default-src 'self' https://*.google.com"));
75 } 77 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/csp_validator.cc ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698