Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(968)

Side by Side Diff: chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc

Issue 10217017: Allow features to refer to subkeys in _manifest_features.json. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix theme test Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/common/extensions/manifest_tests/extension_manifest_test.h" 5 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/json/json_file_value_serializer.h" 8 #include "base/json/json_file_value_serializer.h"
9 #include "base/scoped_temp_dir.h" 9 #include "base/scoped_temp_dir.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
(...skipping 10 matching lines...) Expand all
21 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePlatformApps); 21 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePlatformApps);
22 22
23 LoadAndExpectSuccess("init_valid_platform_app.json"); 23 LoadAndExpectSuccess("init_valid_platform_app.json");
24 24
25 LoadAndExpectError( 25 LoadAndExpectError(
26 "init_invalid_platform_app_1.json", 26 "init_invalid_platform_app_1.json",
27 extension_manifest_errors::kLaunchNotAllowedForPlatformApps); 27 extension_manifest_errors::kLaunchNotAllowedForPlatformApps);
28 LoadAndExpectError( 28 LoadAndExpectError(
29 "init_invalid_platform_app_2.json", 29 "init_invalid_platform_app_2.json",
30 extension_manifest_errors::kBackgroundRequiredForPlatformApps); 30 extension_manifest_errors::kBackgroundRequiredForPlatformApps);
31 LoadAndExpectError( 31
32 "init_invalid_platform_app_3.json", 32 scoped_refptr<Extension> extension =
33 "Feature 'platform_app' is not accessible. " 33 LoadAndExpectSuccess("init_invalid_platform_app_3.json");
34 "'platform_app' requires manifest version of at least 2."); 34 ASSERT_TRUE(extension);
35 ASSERT_EQ(1u, extension->install_warnings().size());
36 EXPECT_EQ("'platform_app' requires manifest version of at least 2.",
37 extension->install_warnings()[0]);
35 } 38 }
36 39
37 TEST_F(ExtensionManifestTest, CertainApisRequirePlatformApps) { 40 TEST_F(ExtensionManifestTest, CertainApisRequirePlatformApps) {
38 // Put APIs here that should be restricted to platform apps, but that haven't 41 // Put APIs here that should be restricted to platform apps, but that haven't
39 // yet graduated from experimental. 42 // yet graduated from experimental.
40 const char* kPlatformAppExperimentalApis[] = { 43 const char* kPlatformAppExperimentalApis[] = {
41 "dns", 44 "dns",
42 "serial", 45 "serial",
43 "socket", 46 "socket",
44 }; 47 };
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 95
93 // Finally, we should succeed with both experimental and platform-app flags 96 // Finally, we should succeed with both experimental and platform-app flags
94 // set. 97 // set.
95 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePlatformApps); 98 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePlatformApps);
96 for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { 99 for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) {
97 const char* api_name = kPlatformAppExperimentalApis[i]; 100 const char* api_name = kPlatformAppExperimentalApis[i];
98 FilePath file_path = temp_dir.path().AppendASCII(api_name); 101 FilePath file_path = temp_dir.path().AppendASCII(api_name);
99 LoadAndExpectSuccess(file_path.MaybeAsASCII().c_str()); 102 LoadAndExpectSuccess(file_path.MaybeAsASCII().c_str());
100 } 103 }
101 } 104 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698