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

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

Issue 1184353002: Explicitly whitelist 'blob:' and 'filesystem:' in extensions' default CSP. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test. Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | extensions/common/manifest_handlers/csp_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 19 matching lines...) Expand all
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[] = "sandbox allow-scripts allow-forms allow-popups";
39 const char kDefaultCSP[] = 39 const char kDefaultCSP[] =
40 "script-src 'self' chrome-extension-resource:; object-src 'self';"; 40 "script-src 'self' blob: filesystem: chrome-extension-resource:; "
41 "object-src 'self' blob: filesystem:;";
41 const char kCustomSandboxedCSP[] = 42 const char kCustomSandboxedCSP[] =
42 "sandbox; script-src: https://www.google.com"; 43 "sandbox; script-src: https://www.google.com";
43 44
44 EXPECT_EQ( 45 EXPECT_EQ(
45 kSandboxedCSP, 46 kSandboxedCSP,
46 CSPInfo::GetResourceContentSecurityPolicy(extension1.get(), "/test")); 47 CSPInfo::GetResourceContentSecurityPolicy(extension1.get(), "/test"));
47 EXPECT_EQ( 48 EXPECT_EQ(
48 kDefaultCSP, 49 kDefaultCSP,
49 CSPInfo::GetResourceContentSecurityPolicy(extension1.get(), "/none")); 50 CSPInfo::GetResourceContentSecurityPolicy(extension1.get(), "/none"));
50 EXPECT_EQ( 51 EXPECT_EQ(
(...skipping 25 matching lines...) Expand all
76 Testcase("sandboxed_pages_invalid_4.json", 77 Testcase("sandboxed_pages_invalid_4.json",
77 errors::kInvalidSandboxedPagesCSP), 78 errors::kInvalidSandboxedPagesCSP),
78 Testcase("sandboxed_pages_invalid_5.json", 79 Testcase("sandboxed_pages_invalid_5.json",
79 errors::kInvalidSandboxedPagesCSP) 80 errors::kInvalidSandboxedPagesCSP)
80 }; 81 };
81 RunTestcases(testcases, arraysize(testcases), 82 RunTestcases(testcases, arraysize(testcases),
82 EXPECT_TYPE_ERROR); 83 EXPECT_TYPE_ERROR);
83 } 84 }
84 85
85 } // namespace extensions 86 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | extensions/common/manifest_handlers/csp_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698