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_handler.h" | 5 #include "chrome/common/extensions/csp_handler.h" |
6 #include "chrome/common/extensions/extension_manifest_constants.h" | 6 #include "chrome/common/extensions/extension_manifest_constants.h" |
7 #include "chrome/common/extensions/manifest_handler.h" | 7 #include "chrome/common/extensions/manifest_handler.h" |
8 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" | 8 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 using extensions::Extension; | 11 using extensions::Extension; |
12 | 12 |
13 namespace errors = extension_manifest_errors; | 13 namespace errors = extension_manifest_errors; |
14 | 14 |
15 class SandboxedPagesManifestTest : public ExtensionManifestTest { | 15 class SandboxedPagesManifestTest : public ExtensionManifestTest { |
16 virtual void SetUp() OVERRIDE { | 16 virtual void SetUp() OVERRIDE { |
17 ExtensionManifestTest::SetUp(); | 17 ExtensionManifestTest::SetUp(); |
18 extensions::ManifestHandler::Register( | 18 (new extensions::CSPHandler(false))->Register(); // Not platform app. |
19 extension_manifest_keys::kContentSecurityPolicy, | |
20 make_linked_ptr(new extensions::CSPHandler(false))); // not platform | |
21 // app. | |
22 } | 19 } |
23 }; | 20 }; |
24 | 21 |
25 TEST_F(SandboxedPagesManifestTest, SandboxedPages) { | 22 TEST_F(SandboxedPagesManifestTest, SandboxedPages) { |
26 // Sandboxed pages specified, no custom CSP value. | 23 // Sandboxed pages specified, no custom CSP value. |
27 scoped_refptr<Extension> extension1( | 24 scoped_refptr<Extension> extension1( |
28 LoadAndExpectSuccess("sandboxed_pages_valid_1.json")); | 25 LoadAndExpectSuccess("sandboxed_pages_valid_1.json")); |
29 | 26 |
30 // No sandboxed pages. | 27 // No sandboxed pages. |
31 scoped_refptr<Extension> extension2( | 28 scoped_refptr<Extension> extension2( |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 Testcase("sandboxed_pages_invalid_3.json", | 68 Testcase("sandboxed_pages_invalid_3.json", |
72 errors::kInvalidSandboxedPagesCSP), | 69 errors::kInvalidSandboxedPagesCSP), |
73 Testcase("sandboxed_pages_invalid_4.json", | 70 Testcase("sandboxed_pages_invalid_4.json", |
74 errors::kInvalidSandboxedPagesCSP), | 71 errors::kInvalidSandboxedPagesCSP), |
75 Testcase("sandboxed_pages_invalid_5.json", | 72 Testcase("sandboxed_pages_invalid_5.json", |
76 errors::kInvalidSandboxedPagesCSP) | 73 errors::kInvalidSandboxedPagesCSP) |
77 }; | 74 }; |
78 RunTestcases(testcases, arraysize(testcases), | 75 RunTestcases(testcases, arraysize(testcases), |
79 EXPECT_TYPE_ERROR); | 76 EXPECT_TYPE_ERROR); |
80 } | 77 } |
81 | |
82 | |
OLD | NEW |