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