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