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

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

Issue 10909239: Rename PACKAGED_APP references to LEGACY_PACKAGED_APP (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Comments Created 8 years, 2 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
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 using extensions::csp_validator::ContentSecurityPolicyIsSandboxed; 10 using extensions::csp_validator::ContentSecurityPolicyIsSandboxed;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 "default-src *; script-src 'self'; img-src 'self'", 56 "default-src *; script-src 'self'; img-src 'self'",
57 Extension::TYPE_EXTENSION)); 57 Extension::TYPE_EXTENSION));
58 EXPECT_TRUE(ContentSecurityPolicyIsSecure( 58 EXPECT_TRUE(ContentSecurityPolicyIsSecure(
59 "default-src *; script-src 'self'; object-src 'self'", 59 "default-src *; script-src 'self'; object-src 'self'",
60 Extension::TYPE_EXTENSION)); 60 Extension::TYPE_EXTENSION));
61 EXPECT_TRUE(ContentSecurityPolicyIsSecure( 61 EXPECT_TRUE(ContentSecurityPolicyIsSecure(
62 "script-src 'self'; object-src 'self'", Extension::TYPE_EXTENSION)); 62 "script-src 'self'; object-src 'self'", Extension::TYPE_EXTENSION));
63 EXPECT_TRUE(ContentSecurityPolicyIsSecure( 63 EXPECT_TRUE(ContentSecurityPolicyIsSecure(
64 "default-src 'unsafe-eval'", Extension::TYPE_EXTENSION)); 64 "default-src 'unsafe-eval'", Extension::TYPE_EXTENSION));
65 EXPECT_TRUE(ContentSecurityPolicyIsSecure( 65 EXPECT_TRUE(ContentSecurityPolicyIsSecure(
66 "default-src 'unsafe-eval'", Extension::TYPE_PACKAGED_APP)); 66 "default-src 'unsafe-eval'", Extension::TYPE_LEGACY_PACKAGED_APP));
67 67
68 EXPECT_FALSE(ContentSecurityPolicyIsSecure( 68 EXPECT_FALSE(ContentSecurityPolicyIsSecure(
69 "default-src 'unsafe-eval'", Extension::TYPE_PLATFORM_APP)); 69 "default-src 'unsafe-eval'", Extension::TYPE_PLATFORM_APP));
70 EXPECT_FALSE(ContentSecurityPolicyIsSecure( 70 EXPECT_FALSE(ContentSecurityPolicyIsSecure(
71 "default-src 'unsafe-inline'", Extension::TYPE_EXTENSION)); 71 "default-src 'unsafe-inline'", Extension::TYPE_EXTENSION));
72 EXPECT_FALSE(ContentSecurityPolicyIsSecure( 72 EXPECT_FALSE(ContentSecurityPolicyIsSecure(
73 "default-src 'unsafe-inline' 'none'", Extension::TYPE_EXTENSION)); 73 "default-src 'unsafe-inline' 'none'", Extension::TYPE_EXTENSION));
74 EXPECT_FALSE(ContentSecurityPolicyIsSecure( 74 EXPECT_FALSE(ContentSecurityPolicyIsSecure(
75 "default-src 'self' http://google.com", Extension::TYPE_EXTENSION)); 75 "default-src 'self' http://google.com", Extension::TYPE_EXTENSION));
76 EXPECT_TRUE(ContentSecurityPolicyIsSecure( 76 EXPECT_TRUE(ContentSecurityPolicyIsSecure(
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // Extensions allow navigation and popups, platform apps don't. 148 // Extensions allow navigation and popups, platform apps don't.
149 EXPECT_TRUE(ContentSecurityPolicyIsSandboxed( 149 EXPECT_TRUE(ContentSecurityPolicyIsSandboxed(
150 "sandbox allow-top-navigation", Extension::TYPE_EXTENSION)); 150 "sandbox allow-top-navigation", Extension::TYPE_EXTENSION));
151 EXPECT_FALSE(ContentSecurityPolicyIsSandboxed( 151 EXPECT_FALSE(ContentSecurityPolicyIsSandboxed(
152 "sandbox allow-top-navigation", Extension::TYPE_PLATFORM_APP)); 152 "sandbox allow-top-navigation", Extension::TYPE_PLATFORM_APP));
153 EXPECT_TRUE(ContentSecurityPolicyIsSandboxed( 153 EXPECT_TRUE(ContentSecurityPolicyIsSandboxed(
154 "sandbox allow-popups", Extension::TYPE_EXTENSION)); 154 "sandbox allow-popups", Extension::TYPE_EXTENSION));
155 EXPECT_FALSE(ContentSecurityPolicyIsSandboxed( 155 EXPECT_FALSE(ContentSecurityPolicyIsSandboxed(
156 "sandbox allow-popups", Extension::TYPE_PLATFORM_APP)); 156 "sandbox allow-popups", Extension::TYPE_PLATFORM_APP));
157 } 157 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698