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

Side by Side Diff: chrome/common/extensions/manifest_tests/extension_manifests_sandboxed_unittest.cc

Issue 1495233004: [Extensions] Add allow-modals to the default sandbox CSP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2564
Patch Set: Created 5 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | extensions/common/manifest_handlers/sandboxed_page_info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | extensions/common/manifest_handlers/sandboxed_page_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698