Chromium Code Reviews| Index: chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc |
| diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc |
| index 1e5442ca024f99613ce9c18b570c93d51451f338..e595cc1ace9af5deca2b0aa805937092a2455bdb 100644 |
| --- a/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc |
| +++ b/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc |
| @@ -64,7 +64,23 @@ TEST_F(PlatformAppsManifestTest, PlatformApps) { |
| warning_testcases, arraysize(warning_testcases), EXPECT_TYPE_WARNING); |
| } |
| -TEST_F(PlatformAppsManifestTest, PlatformAppContentSecurityPolicy) { |
| +namespace { |
| + |
| +class WhitelistedPlatformAppsManifestTest : public PlatformAppsManifestTest { |
| + public: |
| + static void SetUpTestCase() { |
| + // The whitelisted extension ID is cached, so set it here during test setup. |
| + // This is the ID corresponding to the base 64 encoded key in the |
| + // init_platform_app_csp.json manifest. |
| + std::string test_id = "ahplfneplbnjcflhdgkkjeiglkkfeelb"; |
| + base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| + switches::kWhitelistedExtensionID, test_id); |
|
not at google - send to devlin
2015/03/31 22:21:51
This is why I wrote ScopedCommandLineSwitch:
http
jackhou1
2015/03/31 22:55:38
Unfortunately ScopedCommandLineSwitch doesn't real
not at google - send to devlin
2015/04/01 17:08:21
It's not so much the cache that I want to reset, r
jackhou1
2015/04/02 01:28:57
Looks like this requires a bit of a refactor, mayb
|
| + } |
| +}; |
| + |
| +} // namespace |
| + |
| +TEST_F(WhitelistedPlatformAppsManifestTest, PlatformAppContentSecurityPolicy) { |
| // Normal platform apps can't specify a CSP value. |
| Testcase warning_testcases[] = { |
| Testcase( |
| @@ -79,11 +95,7 @@ TEST_F(PlatformAppsManifestTest, PlatformAppContentSecurityPolicy) { |
| RunTestcases( |
| warning_testcases, arraysize(warning_testcases), EXPECT_TYPE_WARNING); |
| - // Whitelisted ones can (this is the ID corresponding to the base 64 encoded |
| - // key in the init_platform_app_csp.json manifest.) |
| - std::string test_id = "ahplfneplbnjcflhdgkkjeiglkkfeelb"; |
| - base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| - switches::kWhitelistedExtensionID, test_id); |
| + // Whitelisted ones can. |
| scoped_refptr<Extension> extension = |
| LoadAndExpectSuccess("init_platform_app_csp.json"); |
| EXPECT_EQ(0U, extension->install_warnings().size()) |