| 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/manifest_tests/chrome_manifest_test.h" | 5 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" |
| 6 #include "extensions/common/manifest_constants.h" | 6 #include "extensions/common/manifest_constants.h" |
| 7 #include "extensions/common/manifest_handlers/csp_info.h" | 7 #include "extensions/common/manifest_handlers/csp_info.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace extensions { | 10 namespace extensions { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // Sandboxed pages specified with wildcard, no custom CSP value. | 30 // Sandboxed pages specified with wildcard, no custom CSP value. |
| 31 scoped_refptr<Extension> extension4( | 31 scoped_refptr<Extension> extension4( |
| 32 LoadAndExpectSuccess("sandboxed_pages_valid_4.json")); | 32 LoadAndExpectSuccess("sandboxed_pages_valid_4.json")); |
| 33 | 33 |
| 34 // Sandboxed pages specified with filename wildcard, no custom CSP value. | 34 // Sandboxed pages specified with filename wildcard, no custom CSP value. |
| 35 scoped_refptr<Extension> extension5( | 35 scoped_refptr<Extension> extension5( |
| 36 LoadAndExpectSuccess("sandboxed_pages_valid_5.json")); | 36 LoadAndExpectSuccess("sandboxed_pages_valid_5.json")); |
| 37 | 37 |
| 38 const char kSandboxedCSP[] = "sandbox allow-scripts allow-forms allow-popups"; | 38 const char kSandboxedCSP[] = "sandbox allow-scripts allow-forms allow-popups"; |
| 39 const char kDefaultCSP[] = | 39 const char kDefaultCSP[] = |
| 40 "script-src 'self' chrome-extension-resource:; object-src 'self';"; | 40 "script-src 'self' blob: filesystem: chrome-extension-resource:; " |
| 41 "object-src 'self' blob: filesystem:;"; |
| 41 const char kCustomSandboxedCSP[] = | 42 const char kCustomSandboxedCSP[] = |
| 42 "sandbox; script-src: https://www.google.com"; | 43 "sandbox; script-src: https://www.google.com"; |
| 43 | 44 |
| 44 EXPECT_EQ( | 45 EXPECT_EQ( |
| 45 kSandboxedCSP, | 46 kSandboxedCSP, |
| 46 CSPInfo::GetResourceContentSecurityPolicy(extension1.get(), "/test")); | 47 CSPInfo::GetResourceContentSecurityPolicy(extension1.get(), "/test")); |
| 47 EXPECT_EQ( | 48 EXPECT_EQ( |
| 48 kDefaultCSP, | 49 kDefaultCSP, |
| 49 CSPInfo::GetResourceContentSecurityPolicy(extension1.get(), "/none")); | 50 CSPInfo::GetResourceContentSecurityPolicy(extension1.get(), "/none")); |
| 50 EXPECT_EQ( | 51 EXPECT_EQ( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 76 Testcase("sandboxed_pages_invalid_4.json", | 77 Testcase("sandboxed_pages_invalid_4.json", |
| 77 errors::kInvalidSandboxedPagesCSP), | 78 errors::kInvalidSandboxedPagesCSP), |
| 78 Testcase("sandboxed_pages_invalid_5.json", | 79 Testcase("sandboxed_pages_invalid_5.json", |
| 79 errors::kInvalidSandboxedPagesCSP) | 80 errors::kInvalidSandboxedPagesCSP) |
| 80 }; | 81 }; |
| 81 RunTestcases(testcases, arraysize(testcases), | 82 RunTestcases(testcases, arraysize(testcases), |
| 82 EXPECT_TYPE_ERROR); | 83 EXPECT_TYPE_ERROR); |
| 83 } | 84 } |
| 84 | 85 |
| 85 } // namespace extensions | 86 } // namespace extensions |
| OLD | NEW |