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/chrome_manifest_test.h" |
10 #include "extensions/common/error_utils.h" | 10 #include "extensions/common/error_utils.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 const char* api_name = kPlatformAppExperimentalApis[i]; | 122 const char* api_name = kPlatformAppExperimentalApis[i]; |
123 | 123 |
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 warn 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 LoadAndExpectWarning( |
135 errors::kExperimentalFlagRequired); | 135 ManifestData(manifests[i].get(), ""), |
| 136 "'experimental' requires the 'experimental-extension-apis' " |
| 137 "command line switch to be enabled."); |
136 } | 138 } |
137 | 139 |
138 // Now try again with the experimental flag set. | 140 // Now try again with the experimental flag set. |
139 CommandLine::ForCurrentProcess()->AppendSwitch( | 141 CommandLine::ForCurrentProcess()->AppendSwitch( |
140 switches::kEnableExperimentalExtensionApis); | 142 switches::kEnableExperimentalExtensionApis); |
141 for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { | 143 for (size_t i = 0; i < arraysize(kPlatformAppExperimentalApis); ++i) { |
142 LoadAndExpectSuccess(ManifestData(manifests[i].get(), "")); | 144 LoadAndExpectSuccess(ManifestData(manifests[i].get(), "")); |
143 } | 145 } |
144 } | 146 } |
145 | 147 |
146 } // namespace extensions | 148 } // namespace extensions |
OLD | NEW |