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

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

Issue 747403002: Ignore insecure parts of CSP in extensions and allow extension to load (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test expectations Created 5 years, 12 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
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' chrome-extension-resource:; object-src 'self';";
41 const char kCustomSandboxedCSP[] = 41 const char kCustomSandboxedCSP[] =
42 "sandbox; script-src: https://www.google.com"; 42 "sandbox; script-src: https://www.google.com";
43 43
44 EXPECT_EQ( 44 EXPECT_EQ(
45 kSandboxedCSP, 45 kSandboxedCSP,
46 CSPInfo::GetResourceContentSecurityPolicy(extension1.get(), "/test")); 46 CSPInfo::GetResourceContentSecurityPolicy(extension1.get(), "/test"));
47 EXPECT_EQ( 47 EXPECT_EQ(
48 kDefaultCSP, 48 kDefaultCSP,
49 CSPInfo::GetResourceContentSecurityPolicy(extension1.get(), "/none")); 49 CSPInfo::GetResourceContentSecurityPolicy(extension1.get(), "/none"));
50 EXPECT_EQ( 50 EXPECT_EQ(
(...skipping 25 matching lines...) Expand all
76 Testcase("sandboxed_pages_invalid_4.json", 76 Testcase("sandboxed_pages_invalid_4.json",
77 errors::kInvalidSandboxedPagesCSP), 77 errors::kInvalidSandboxedPagesCSP),
78 Testcase("sandboxed_pages_invalid_5.json", 78 Testcase("sandboxed_pages_invalid_5.json",
79 errors::kInvalidSandboxedPagesCSP) 79 errors::kInvalidSandboxedPagesCSP)
80 }; 80 };
81 RunTestcases(testcases, arraysize(testcases), 81 RunTestcases(testcases, arraysize(testcases),
82 EXPECT_TYPE_ERROR); 82 EXPECT_TYPE_ERROR);
83 } 83 }
84 84
85 } // namespace extensions 85 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc ('k') | extensions/common/csp_validator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698