OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
6 | 6 |
7 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 // distinguish between API and host permissions. | 214 // distinguish between API and host permissions. |
215 extension = LoadAndExpectSuccess("init_valid_permissions.json"); | 215 extension = LoadAndExpectSuccess("init_valid_permissions.json"); |
216 | 216 |
217 // Test with an options page. | 217 // Test with an options page. |
218 extension = LoadAndExpectSuccess("init_valid_options.json"); | 218 extension = LoadAndExpectSuccess("init_valid_options.json"); |
219 EXPECT_EQ("chrome-extension", extension->options_url().scheme()); | 219 EXPECT_EQ("chrome-extension", extension->options_url().scheme()); |
220 EXPECT_EQ("/options.html", extension->options_url().path()); | 220 EXPECT_EQ("/options.html", extension->options_url().path()); |
221 | 221 |
222 // Test that an empty list of page actions does not stop a browser action | 222 // Test that an empty list of page actions does not stop a browser action |
223 // from being loaded. | 223 // from being loaded. |
224 extension = LoadAndExpectSuccess("init_valid_empty_page_actions.json"); | 224 LoadAndExpectSuccess("init_valid_empty_page_actions.json"); |
225 | 225 |
226 // Test with a minimum_chrome_version. | 226 // Test with a minimum_chrome_version. |
227 extension = LoadAndExpectSuccess("init_valid_minimum_chrome.json"); | 227 LoadAndExpectSuccess("init_valid_minimum_chrome.json"); |
228 | 228 |
229 // Test a hosted app with a minimum_chrome_version. | 229 // Test a hosted app with a minimum_chrome_version. |
230 extension = LoadAndExpectSuccess("init_valid_app_minimum_chrome.json"); | 230 LoadAndExpectSuccess("init_valid_app_minimum_chrome.json"); |
231 | 231 |
232 // Test a hosted app with a requirements section. | 232 // Test a hosted app with a requirements section. |
233 extension = LoadAndExpectSuccess("init_valid_app_requirements.json"); | 233 LoadAndExpectSuccess("init_valid_app_requirements.json"); |
234 | 234 |
235 // Verify empty permission settings are considered valid. | 235 // Verify empty permission settings are considered valid. |
236 LoadAndExpectSuccess("init_valid_permissions_empty.json"); | 236 LoadAndExpectSuccess("init_valid_permissions_empty.json"); |
237 | 237 |
238 // We allow unknown API permissions, so this will be valid until we better | 238 // We allow unknown API permissions, so this will be valid until we better |
239 // distinguish between API and host permissions. | 239 // distinguish between API and host permissions. |
240 LoadAndExpectSuccess("init_valid_permissions_unknown.json"); | 240 LoadAndExpectSuccess("init_valid_permissions_unknown.json"); |
241 | |
242 // A minimal platform app. | |
243 LoadAndExpectSuccess("init_valid_platform_app.json"); | |
Aaron Boodman
2011/11/04 05:45:16
There's probably going to be more of these app man
| |
241 } | 244 } |
242 | 245 |
243 TEST_F(ExtensionManifestTest, InitFromValueValidNameInRTL) { | 246 TEST_F(ExtensionManifestTest, InitFromValueValidNameInRTL) { |
244 #if defined(TOOLKIT_GTK) | 247 #if defined(TOOLKIT_GTK) |
245 GtkTextDirection gtk_dir = gtk_widget_get_default_direction(); | 248 GtkTextDirection gtk_dir = gtk_widget_get_default_direction(); |
246 gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL); | 249 gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL); |
247 #else | 250 #else |
248 std::string locale = l10n_util::GetApplicationLocale(""); | 251 std::string locale = l10n_util::GetApplicationLocale(""); |
249 base::i18n::SetICUDefaultLocale("he"); | 252 base::i18n::SetICUDefaultLocale("he"); |
250 #endif | 253 #endif |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
385 extension = LoadAndExpectSuccess("launch_width.json"); | 388 extension = LoadAndExpectSuccess("launch_width.json"); |
386 EXPECT_EQ(640, extension->launch_width()); | 389 EXPECT_EQ(640, extension->launch_width()); |
387 | 390 |
388 extension = LoadAndExpectSuccess("launch_height.json"); | 391 extension = LoadAndExpectSuccess("launch_height.json"); |
389 EXPECT_EQ(480, extension->launch_height()); | 392 EXPECT_EQ(480, extension->launch_height()); |
390 | 393 |
391 LoadAndExpectError("launch_window.json", | 394 LoadAndExpectError("launch_window.json", |
392 errors::kInvalidLaunchContainer); | 395 errors::kInvalidLaunchContainer); |
393 LoadAndExpectError("launch_container_invalid_type.json", | 396 LoadAndExpectError("launch_container_invalid_type.json", |
394 errors::kInvalidLaunchContainer); | 397 errors::kInvalidLaunchContainer); |
398 LoadAndExpectError("launch_container_invalid_type_for_platform.json", | |
399 errors::kInvalidLaunchContainerForPlatform); | |
395 LoadAndExpectError("launch_container_invalid_value.json", | 400 LoadAndExpectError("launch_container_invalid_value.json", |
396 errors::kInvalidLaunchContainer); | 401 errors::kInvalidLaunchContainer); |
397 LoadAndExpectError("launch_container_without_launch_url.json", | 402 LoadAndExpectError("launch_container_without_launch_url.json", |
398 errors::kLaunchURLRequired); | 403 errors::kLaunchURLRequired); |
399 LoadAndExpectError("launch_width_invalid.json", | 404 LoadAndExpectError("launch_width_invalid.json", |
400 errors::kInvalidLaunchWidthContainer); | 405 errors::kInvalidLaunchWidthContainer); |
401 LoadAndExpectError("launch_width_negative.json", | 406 LoadAndExpectError("launch_width_negative.json", |
402 errors::kInvalidLaunchWidth); | 407 errors::kInvalidLaunchWidth); |
403 LoadAndExpectError("launch_height_invalid.json", | 408 LoadAndExpectError("launch_height_invalid.json", |
404 errors::kInvalidLaunchHeightContainer); | 409 errors::kInvalidLaunchHeightContainer); |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
927 scoped_refptr<Extension> extension_2( | 932 scoped_refptr<Extension> extension_2( |
928 LoadAndExpectSuccess("offline_disabled_packaged_app.json")); | 933 LoadAndExpectSuccess("offline_disabled_packaged_app.json")); |
929 EXPECT_FALSE(extension_2->offline_enabled()); | 934 EXPECT_FALSE(extension_2->offline_enabled()); |
930 scoped_refptr<Extension> extension_3( | 935 scoped_refptr<Extension> extension_3( |
931 LoadAndExpectSuccess("offline_default_packaged_app.json")); | 936 LoadAndExpectSuccess("offline_default_packaged_app.json")); |
932 EXPECT_FALSE(extension_3->offline_enabled()); | 937 EXPECT_FALSE(extension_3->offline_enabled()); |
933 scoped_refptr<Extension> extension_4( | 938 scoped_refptr<Extension> extension_4( |
934 LoadAndExpectSuccess("offline_enabled_hosted_app.json")); | 939 LoadAndExpectSuccess("offline_enabled_hosted_app.json")); |
935 EXPECT_TRUE(extension_4->offline_enabled()); | 940 EXPECT_TRUE(extension_4->offline_enabled()); |
936 } | 941 } |
OLD | NEW |