| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/json/json_file_value_serializer.h" | 6 #include "base/json/json_file_value_serializer.h" |
| 7 #include "base/memory/linked_ptr.h" | 7 #include "base/memory/linked_ptr.h" |
| 8 #include "chrome/common/chrome_switches.h" | |
| 9 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" | 8 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" |
| 10 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" | 9 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
| 11 #include "extensions/common/error_utils.h" | 10 #include "extensions/common/error_utils.h" |
| 12 #include "extensions/common/manifest_constants.h" | 11 #include "extensions/common/manifest_constants.h" |
| 13 #include "extensions/common/manifest_handlers/csp_info.h" | 12 #include "extensions/common/manifest_handlers/csp_info.h" |
| 14 #include "extensions/common/manifest_handlers/incognito_info.h" | 13 #include "extensions/common/manifest_handlers/incognito_info.h" |
| 15 #include "extensions/common/switches.h" | 14 #include "extensions/common/switches.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 16 |
| 18 namespace extensions { | 17 namespace extensions { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 "'app.content_security_policy' is not allowed for specified extension " | 76 "'app.content_security_policy' is not allowed for specified extension " |
| 78 "ID.") | 77 "ID.") |
| 79 }; | 78 }; |
| 80 RunTestcases( | 79 RunTestcases( |
| 81 warning_testcases, arraysize(warning_testcases), EXPECT_TYPE_WARNING); | 80 warning_testcases, arraysize(warning_testcases), EXPECT_TYPE_WARNING); |
| 82 | 81 |
| 83 // Whitelisted ones can (this is the ID corresponding to the base 64 encoded | 82 // Whitelisted ones can (this is the ID corresponding to the base 64 encoded |
| 84 // key in the init_platform_app_csp.json manifest.) | 83 // key in the init_platform_app_csp.json manifest.) |
| 85 std::string test_id = "ahplfneplbnjcflhdgkkjeiglkkfeelb"; | 84 std::string test_id = "ahplfneplbnjcflhdgkkjeiglkkfeelb"; |
| 86 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 85 CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 87 ::switches::kWhitelistedExtensionID, test_id); | 86 switches::kWhitelistedExtensionID, test_id); |
| 88 scoped_refptr<Extension> extension = | 87 scoped_refptr<Extension> extension = |
| 89 LoadAndExpectSuccess("init_platform_app_csp.json"); | 88 LoadAndExpectSuccess("init_platform_app_csp.json"); |
| 90 EXPECT_EQ(0U, extension->install_warnings().size()) | 89 EXPECT_EQ(0U, extension->install_warnings().size()) |
| 91 << "Unexpected warning " << extension->install_warnings()[0].message; | 90 << "Unexpected warning " << extension->install_warnings()[0].message; |
| 92 EXPECT_TRUE(extension->is_platform_app()); | 91 EXPECT_TRUE(extension->is_platform_app()); |
| 93 EXPECT_EQ("default-src 'self' https://www.google.com", | 92 EXPECT_EQ("default-src 'self' https://www.google.com", |
| 94 CSPInfo::GetResourceContentSecurityPolicy(extension.get(), | 93 CSPInfo::GetResourceContentSecurityPolicy(extension.get(), |
| 95 std::string())); | 94 std::string())); |
| 96 | 95 |
| 97 // But even whitelisted ones must specify a secure policy. | 96 // But even whitelisted ones must specify a secure policy. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 137 |
| 139 // Now try again with the experimental flag set. | 138 // Now try again with the experimental flag set. |
| 140 CommandLine::ForCurrentProcess()->AppendSwitch( | 139 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 141 switches::kEnableExperimentalExtensionApis); | 140 switches::kEnableExperimentalExtensionApis); |
| 142 for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { | 141 for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { |
| 143 LoadAndExpectSuccess(Manifest(manifests[i].get(), "")); | 142 LoadAndExpectSuccess(Manifest(manifests[i].get(), "")); |
| 144 } | 143 } |
| 145 } | 144 } |
| 146 | 145 |
| 147 } // namespace extensions | 146 } // namespace extensions |
| OLD | NEW |