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 "chrome/common/extensions/csp_validator.h" | 5 #include "extensions/common/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; |
11 using extensions::Manifest; | 11 using extensions::Manifest; |
12 | 12 |
13 TEST(ExtensionCSPValidator, IsLegal) { | 13 TEST(ExtensionCSPValidator, IsLegal) { |
14 EXPECT_TRUE(ContentSecurityPolicyIsLegal("foo")); | 14 EXPECT_TRUE(ContentSecurityPolicyIsLegal("foo")); |
15 EXPECT_TRUE(ContentSecurityPolicyIsLegal( | 15 EXPECT_TRUE(ContentSecurityPolicyIsLegal( |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 "sandbox allow-top-navigation", Manifest::TYPE_EXTENSION)); | 171 "sandbox allow-top-navigation", Manifest::TYPE_EXTENSION)); |
172 EXPECT_FALSE(ContentSecurityPolicyIsSandboxed( | 172 EXPECT_FALSE(ContentSecurityPolicyIsSandboxed( |
173 "sandbox allow-top-navigation", Manifest::TYPE_PLATFORM_APP)); | 173 "sandbox allow-top-navigation", Manifest::TYPE_PLATFORM_APP)); |
174 | 174 |
175 // Popups are OK. | 175 // Popups are OK. |
176 EXPECT_TRUE(ContentSecurityPolicyIsSandboxed( | 176 EXPECT_TRUE(ContentSecurityPolicyIsSandboxed( |
177 "sandbox allow-popups", Manifest::TYPE_EXTENSION)); | 177 "sandbox allow-popups", Manifest::TYPE_EXTENSION)); |
178 EXPECT_TRUE(ContentSecurityPolicyIsSandboxed( | 178 EXPECT_TRUE(ContentSecurityPolicyIsSandboxed( |
179 "sandbox allow-popups", Manifest::TYPE_PLATFORM_APP)); | 179 "sandbox allow-popups", Manifest::TYPE_PLATFORM_APP)); |
180 } | 180 } |
OLD | NEW |