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 "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 12 matching lines...) Expand all Loading... |
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 LoadAndExpectError( |
32 "init_invalid_platform_app_3.json", | 32 "init_invalid_platform_app_3.json", |
33 "Feature 'platform_app' is not accessible. " | 33 "'platform_app' requires manifest version of at least 2."); |
34 "'platform_app' requires manifest version of at least 2."); | |
35 } | 34 } |
36 | 35 |
37 TEST_F(ExtensionManifestTest, CertainApisRequirePlatformApps) { | 36 TEST_F(ExtensionManifestTest, CertainApisRequirePlatformApps) { |
38 // Put APIs here that should be restricted to platform apps, but that haven't | 37 // Put APIs here that should be restricted to platform apps, but that haven't |
39 // yet graduated from experimental. | 38 // yet graduated from experimental. |
40 const char* kPlatformAppExperimentalApis[] = { | 39 const char* kPlatformAppExperimentalApis[] = { |
41 "dns", | 40 "dns", |
42 "serial", | 41 "serial", |
43 "socket", | 42 "socket", |
44 }; | 43 }; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 91 |
93 // Finally, we should succeed with both experimental and platform-app flags | 92 // Finally, we should succeed with both experimental and platform-app flags |
94 // set. | 93 // set. |
95 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePlatformApps); | 94 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePlatformApps); |
96 for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { | 95 for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { |
97 const char* api_name = kPlatformAppExperimentalApis[i]; | 96 const char* api_name = kPlatformAppExperimentalApis[i]; |
98 FilePath file_path = temp_dir.path().AppendASCII(api_name); | 97 FilePath file_path = temp_dir.path().AppendASCII(api_name); |
99 LoadAndExpectSuccess(file_path.MaybeAsASCII().c_str()); | 98 LoadAndExpectSuccess(file_path.MaybeAsASCII().c_str()); |
100 } | 99 } |
101 } | 100 } |
OLD | NEW |