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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 RunTestcases( | 48 RunTestcases( |
49 warning_testcases, arraysize(warning_testcases), EXPECT_TYPE_WARNING); | 49 warning_testcases, arraysize(warning_testcases), EXPECT_TYPE_WARNING); |
50 } | 50 } |
51 | 51 |
52 TEST_F(ExtensionManifestTest, CertainApisRequirePlatformApps) { | 52 TEST_F(ExtensionManifestTest, CertainApisRequirePlatformApps) { |
53 // Put APIs here that should be restricted to platform apps, but that haven't | 53 // Put APIs here that should be restricted to platform apps, but that haven't |
54 // yet graduated from experimental. | 54 // yet graduated from experimental. |
55 const char* kPlatformAppExperimentalApis[] = { | 55 const char* kPlatformAppExperimentalApis[] = { |
56 "dns", | 56 "dns", |
57 "serial", | 57 "serial", |
58 "socket", | |
59 }; | 58 }; |
60 // TODO(miket): When the first platform-app API leaves experimental, write | 59 // TODO(miket): When the first platform-app API leaves experimental, write |
61 // similar code that tests without the experimental flag. | 60 // similar code that tests without the experimental flag. |
62 | 61 |
63 // This manifest is a skeleton used to build more specific manifests for | 62 // This manifest is a skeleton used to build more specific manifests for |
64 // testing. The requirements are that (1) it be a valid platform app, and (2) | 63 // testing. The requirements are that (1) it be a valid platform app, and (2) |
65 // it contain no permissions dictionary. | 64 // it contain no permissions dictionary. |
66 std::string error; | 65 std::string error; |
67 scoped_ptr<DictionaryValue> manifest( | 66 scoped_ptr<DictionaryValue> manifest( |
68 LoadManifestFile("init_valid_platform_app.json", &error)); | 67 LoadManifestFile("init_valid_platform_app.json", &error)); |
(...skipping 28 matching lines...) Expand all Loading... |
97 | 96 |
98 // Now try again with the experimental flag set. | 97 // Now try again with the experimental flag set. |
99 CommandLine::ForCurrentProcess()->AppendSwitch( | 98 CommandLine::ForCurrentProcess()->AppendSwitch( |
100 switches::kEnableExperimentalExtensionApis); | 99 switches::kEnableExperimentalExtensionApis); |
101 for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { | 100 for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { |
102 const char* api_name = kPlatformAppExperimentalApis[i]; | 101 const char* api_name = kPlatformAppExperimentalApis[i]; |
103 FilePath file_path = temp_dir.path().AppendASCII(api_name); | 102 FilePath file_path = temp_dir.path().AppendASCII(api_name); |
104 LoadAndExpectSuccess(file_path.MaybeAsASCII().c_str()); | 103 LoadAndExpectSuccess(file_path.MaybeAsASCII().c_str()); |
105 } | 104 } |
106 } | 105 } |
OLD | NEW |