| 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 17 matching lines...) Expand all Loading... |
| 28 LoadAndExpectSuccess("sandboxed_pages_valid_3.json")); | 28 LoadAndExpectSuccess("sandboxed_pages_valid_3.json")); |
| 29 | 29 |
| 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[] = |
| 39 "sandbox allow-scripts allow-forms allow-popups allow-modals"; |
| 39 const char kDefaultCSP[] = | 40 const char kDefaultCSP[] = |
| 40 "script-src 'self' blob: filesystem: chrome-extension-resource:; " | 41 "script-src 'self' blob: filesystem: chrome-extension-resource:; " |
| 41 "object-src 'self' blob: filesystem:;"; | 42 "object-src 'self' blob: filesystem:;"; |
| 42 const char kCustomSandboxedCSP[] = | 43 const char kCustomSandboxedCSP[] = |
| 43 "sandbox; script-src: https://www.google.com"; | 44 "sandbox; script-src: https://www.google.com"; |
| 44 | 45 |
| 45 EXPECT_EQ( | 46 EXPECT_EQ( |
| 46 kSandboxedCSP, | 47 kSandboxedCSP, |
| 47 CSPInfo::GetResourceContentSecurityPolicy(extension1.get(), "/test")); | 48 CSPInfo::GetResourceContentSecurityPolicy(extension1.get(), "/test")); |
| 48 EXPECT_EQ( | 49 EXPECT_EQ( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 77 Testcase("sandboxed_pages_invalid_4.json", | 78 Testcase("sandboxed_pages_invalid_4.json", |
| 78 errors::kInvalidSandboxedPagesCSP), | 79 errors::kInvalidSandboxedPagesCSP), |
| 79 Testcase("sandboxed_pages_invalid_5.json", | 80 Testcase("sandboxed_pages_invalid_5.json", |
| 80 errors::kInvalidSandboxedPagesCSP) | 81 errors::kInvalidSandboxedPagesCSP) |
| 81 }; | 82 }; |
| 82 RunTestcases(testcases, arraysize(testcases), | 83 RunTestcases(testcases, arraysize(testcases), |
| 83 EXPECT_TYPE_ERROR); | 84 EXPECT_TYPE_ERROR); |
| 84 } | 85 } |
| 85 | 86 |
| 86 } // namespace extensions | 87 } // namespace extensions |
| OLD | NEW |