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" | 8 #include "chrome/common/chrome_switches.h" |
| 9 #include "chrome/common/extensions/background_info.h" |
9 #include "chrome/common/extensions/csp_handler.h" | 10 #include "chrome/common/extensions/csp_handler.h" |
10 #include "chrome/common/extensions/extension_manifest_constants.h" | 11 #include "chrome/common/extensions/extension_manifest_constants.h" |
11 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" | 12 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 | 14 |
14 namespace errors = extension_manifest_errors; | 15 namespace errors = extension_manifest_errors; |
15 | 16 |
| 17 namespace extensions { |
| 18 |
16 class PlatformAppsManifestTest : public ExtensionManifestTest { | 19 class PlatformAppsManifestTest : public ExtensionManifestTest { |
17 virtual void SetUp() OVERRIDE { | 20 virtual void SetUp() OVERRIDE { |
18 ExtensionManifestTest::SetUp(); | 21 (new BackgroundManifestHandler)->Register(); |
19 extensions::ManifestHandler::Register( | 22 (new CSPHandler(true))->Register(); // platform app. |
20 extension_manifest_keys::kPlatformAppContentSecurityPolicy, | |
21 make_linked_ptr(new extensions::CSPHandler(true))); // platform app. | |
22 } | 23 } |
23 }; | 24 }; |
24 | 25 |
25 TEST_F(PlatformAppsManifestTest, PlatformApps) { | 26 TEST_F(PlatformAppsManifestTest, PlatformApps) { |
26 scoped_refptr<extensions::Extension> extension = | 27 scoped_refptr<extensions::Extension> extension = |
27 LoadAndExpectSuccess("init_valid_platform_app.json"); | 28 LoadAndExpectSuccess("init_valid_platform_app.json"); |
28 EXPECT_TRUE(extension->is_storage_isolated()); | 29 EXPECT_TRUE(extension->is_storage_isolated()); |
29 EXPECT_TRUE(extension->incognito_split_mode()); | 30 EXPECT_TRUE(extension->incognito_split_mode()); |
30 | 31 |
31 extension = | 32 extension = |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 errors::kExperimentalFlagRequired); | 135 errors::kExperimentalFlagRequired); |
135 } | 136 } |
136 | 137 |
137 // Now try again with the experimental flag set. | 138 // Now try again with the experimental flag set. |
138 CommandLine::ForCurrentProcess()->AppendSwitch( | 139 CommandLine::ForCurrentProcess()->AppendSwitch( |
139 switches::kEnableExperimentalExtensionApis); | 140 switches::kEnableExperimentalExtensionApis); |
140 for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { | 141 for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { |
141 LoadAndExpectSuccess(Manifest(manifests[i].get(), "")); | 142 LoadAndExpectSuccess(Manifest(manifests[i].get(), "")); |
142 } | 143 } |
143 } | 144 } |
| 145 |
| 146 } // namespace extensions |
OLD | NEW |