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" | |
10 #include "chrome/common/extensions/csp_handler.h" | 9 #include "chrome/common/extensions/csp_handler.h" |
11 #include "chrome/common/extensions/extension_manifest_constants.h" | 10 #include "chrome/common/extensions/extension_manifest_constants.h" |
12 #include "chrome/common/extensions/incognito_handler.h" | 11 #include "chrome/common/extensions/incognito_handler.h" |
13 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" | 12 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" |
14 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" | 13 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
16 | 15 |
17 namespace errors = extension_manifest_errors; | 16 namespace errors = extension_manifest_errors; |
18 | 17 |
19 namespace extensions { | 18 namespace extensions { |
20 | 19 |
21 class PlatformAppsManifestTest : public ExtensionManifestTest { | 20 class PlatformAppsManifestTest : public ExtensionManifestTest { |
22 protected: | |
23 virtual void SetUp() OVERRIDE { | |
24 testing::Test::SetUp(); | |
25 (new BackgroundManifestHandler)->Register(); | |
26 (new CSPHandler(true))->Register(); // platform app. | |
27 (new IncognitoHandler)->Register(); | |
28 (new AppIsolationHandler)->Register(); | |
29 } | |
30 }; | 21 }; |
31 | 22 |
32 TEST_F(PlatformAppsManifestTest, PlatformApps) { | 23 TEST_F(PlatformAppsManifestTest, PlatformApps) { |
33 scoped_refptr<Extension> extension = | 24 scoped_refptr<Extension> extension = |
34 LoadAndExpectSuccess("init_valid_platform_app.json"); | 25 LoadAndExpectSuccess("init_valid_platform_app.json"); |
35 EXPECT_TRUE(AppIsolationInfo::HasIsolatedStorage(extension)); | 26 EXPECT_TRUE(AppIsolationInfo::HasIsolatedStorage(extension)); |
36 EXPECT_TRUE(IncognitoInfo::IsSplitMode(extension)); | 27 EXPECT_TRUE(IncognitoInfo::IsSplitMode(extension)); |
37 | 28 |
38 extension = | 29 extension = |
39 LoadAndExpectSuccess("init_valid_platform_app_no_manifest_version.json"); | 30 LoadAndExpectSuccess("init_valid_platform_app_no_manifest_version.json"); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 135 |
145 // Now try again with the experimental flag set. | 136 // Now try again with the experimental flag set. |
146 CommandLine::ForCurrentProcess()->AppendSwitch( | 137 CommandLine::ForCurrentProcess()->AppendSwitch( |
147 switches::kEnableExperimentalExtensionApis); | 138 switches::kEnableExperimentalExtensionApis); |
148 for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { | 139 for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { |
149 LoadAndExpectSuccess(Manifest(manifests[i].get(), "")); | 140 LoadAndExpectSuccess(Manifest(manifests[i].get(), "")); |
150 } | 141 } |
151 } | 142 } |
152 | 143 |
153 } // namespace extensions | 144 } // namespace extensions |
OLD | NEW |