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/extensions/manifest_handlers/app_isolation_info.h" | 8 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" |
9 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" | 9 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
10 #include "extensions/common/error_utils.h" | 10 #include "extensions/common/error_utils.h" |
11 #include "extensions/common/manifest_constants.h" | 11 #include "extensions/common/manifest_constants.h" |
12 #include "extensions/common/manifest_handlers/csp_info.h" | 12 #include "extensions/common/manifest_handlers/csp_info.h" |
13 #include "extensions/common/manifest_handlers/incognito_info.h" | 13 #include "extensions/common/manifest_handlers/incognito_info.h" |
14 #include "extensions/common/switches.h" | 14 #include "extensions/common/switches.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 | 16 |
17 namespace extensions { | 17 namespace extensions { |
18 | 18 |
19 namespace errors = manifest_errors; | 19 namespace errors = manifest_errors; |
20 | 20 |
21 class PlatformAppsManifestTest : public ChromeManifestTest { | 21 class PlatformAppsManifestTest : public ExtensionManifestTest { |
22 }; | 22 }; |
23 | 23 |
24 TEST_F(PlatformAppsManifestTest, PlatformApps) { | 24 TEST_F(PlatformAppsManifestTest, PlatformApps) { |
25 scoped_refptr<Extension> extension = | 25 scoped_refptr<Extension> extension = |
26 LoadAndExpectSuccess("init_valid_platform_app.json"); | 26 LoadAndExpectSuccess("init_valid_platform_app.json"); |
27 EXPECT_TRUE(AppIsolationInfo::HasIsolatedStorage(extension.get())); | 27 EXPECT_TRUE(AppIsolationInfo::HasIsolatedStorage(extension.get())); |
28 EXPECT_FALSE(IncognitoInfo::IsSplitMode(extension.get())); | 28 EXPECT_FALSE(IncognitoInfo::IsSplitMode(extension.get())); |
29 | 29 |
30 extension = | 30 extension = |
31 LoadAndExpectSuccess("init_valid_platform_app_no_manifest_version.json"); | 31 LoadAndExpectSuccess("init_valid_platform_app_no_manifest_version.json"); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // DictionaryValue will take ownership of this ListValue. | 124 // DictionaryValue will take ownership of this ListValue. |
125 base::ListValue *permissions = new base::ListValue(); | 125 base::ListValue *permissions = new base::ListValue(); |
126 permissions->Append(new base::StringValue("experimental")); | 126 permissions->Append(new base::StringValue("experimental")); |
127 permissions->Append(new base::StringValue(api_name)); | 127 permissions->Append(new base::StringValue(api_name)); |
128 manifest->Set("permissions", permissions); | 128 manifest->Set("permissions", permissions); |
129 manifests.push_back(make_linked_ptr(manifest->DeepCopy())); | 129 manifests.push_back(make_linked_ptr(manifest->DeepCopy())); |
130 } | 130 } |
131 | 131 |
132 // First try to load without any flags. This should fail for every API. | 132 // First try to load without any flags. This should fail for every API. |
133 for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { | 133 for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { |
134 LoadAndExpectError(ManifestData(manifests[i].get(), ""), | 134 LoadAndExpectError(Manifest(manifests[i].get(), ""), |
135 errors::kExperimentalFlagRequired); | 135 errors::kExperimentalFlagRequired); |
136 } | 136 } |
137 | 137 |
138 // Now try again with the experimental flag set. | 138 // Now try again with the experimental flag set. |
139 CommandLine::ForCurrentProcess()->AppendSwitch( | 139 CommandLine::ForCurrentProcess()->AppendSwitch( |
140 switches::kEnableExperimentalExtensionApis); | 140 switches::kEnableExperimentalExtensionApis); |
141 for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { | 141 for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { |
142 LoadAndExpectSuccess(ManifestData(manifests[i].get(), "")); | 142 LoadAndExpectSuccess(Manifest(manifests[i].get(), "")); |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 } // namespace extensions | 146 } // namespace extensions |
OLD | NEW |