Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(719)

Unified Diff: chrome/common/extensions/manifest_tests/extension_manifests_sandboxed_unittest.cc

Issue 10458063: Add sanbdoxed_pages to allow extension/app pages to be served in a sandboxed, unique origin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/manifest_tests/extension_manifests_sandboxed_unittest.cc
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_sandboxed_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_sandboxed_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..41cd663c77f10be8d71e19ad177259e197b9c0fc
--- /dev/null
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_sandboxed_unittest.cc
@@ -0,0 +1,38 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
+
+#include "chrome/common/extensions/extension_manifest_constants.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+using extensions::Extension;
+
+namespace errors = extension_manifest_errors;
+
+TEST_F(ExtensionManifestTest, SandboxedResources) {
+ // Sandboxed resources specified.
+ scoped_refptr<Extension> extension1(
+ LoadAndExpectSuccess("sandboxed_resources_valid_1.json"));
+
+ // No sandboxed resources.
+ scoped_refptr<Extension> extension2(
+ LoadAndExpectSuccess("sandboxed_resources_valid_2.json"));
+
+ EXPECT_TRUE(extension1->IsResourceSandboxed("/test"));
+ EXPECT_FALSE(extension1->IsResourceSandboxed("/none"));
+
+ EXPECT_FALSE(extension2->IsResourceSandboxed("/test"));
+
+ Testcase testcases[] = {
+ Testcase("sandboxed_resources_invalid_1.json",
+ errors::kInvalidSandboxedResourcesList),
+ Testcase("sandboxed_resources_invalid_2.json",
+ errors::kInvalidSandboxedResource)
+ };
+ RunTestcases(testcases, arraysize(testcases),
+ EXPECT_TYPE_ERROR);
+}
+
+

Powered by Google App Engine
This is Rietveld 408576698