| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 235 |
| 236 // Verify empty permission settings are considered valid. | 236 // Verify empty permission settings are considered valid. |
| 237 LoadAndExpectSuccess("init_valid_permissions_empty.json"); | 237 LoadAndExpectSuccess("init_valid_permissions_empty.json"); |
| 238 | 238 |
| 239 // We allow unknown API permissions, so this will be valid until we better | 239 // We allow unknown API permissions, so this will be valid until we better |
| 240 // distinguish between API and host permissions. | 240 // distinguish between API and host permissions. |
| 241 LoadAndExpectSuccess("init_valid_permissions_unknown.json"); | 241 LoadAndExpectSuccess("init_valid_permissions_unknown.json"); |
| 242 } | 242 } |
| 243 | 243 |
| 244 TEST_F(ExtensionManifestTest, PlatformApps) { | 244 TEST_F(ExtensionManifestTest, PlatformApps) { |
| 245 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePlatformApps); |
| 246 |
| 245 // A minimal platform app. | 247 // A minimal platform app. |
| 246 LoadAndExpectSuccess("init_valid_platform_app.json"); | 248 LoadAndExpectSuccess("init_valid_platform_app.json"); |
| 247 } | 249 } |
| 248 | 250 |
| 249 TEST_F(ExtensionManifestTest, InitFromValueValidNameInRTL) { | 251 TEST_F(ExtensionManifestTest, InitFromValueValidNameInRTL) { |
| 250 #if defined(TOOLKIT_GTK) | 252 #if defined(TOOLKIT_GTK) |
| 251 GtkTextDirection gtk_dir = gtk_widget_get_default_direction(); | 253 GtkTextDirection gtk_dir = gtk_widget_get_default_direction(); |
| 252 gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL); | 254 gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL); |
| 253 #else | 255 #else |
| 254 std::string locale = l10n_util::GetApplicationLocale(""); | 256 std::string locale = l10n_util::GetApplicationLocale(""); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 | 373 |
| 372 scoped_refptr<Extension> extension( | 374 scoped_refptr<Extension> extension( |
| 373 LoadAndExpectSuccess("web_urls_default.json")); | 375 LoadAndExpectSuccess("web_urls_default.json")); |
| 374 ASSERT_EQ(1u, extension->web_extent().patterns().size()); | 376 ASSERT_EQ(1u, extension->web_extent().patterns().size()); |
| 375 EXPECT_EQ("*://www.google.com/*", | 377 EXPECT_EQ("*://www.google.com/*", |
| 376 extension->web_extent().patterns().begin()->GetAsString()); | 378 extension->web_extent().patterns().begin()->GetAsString()); |
| 377 } | 379 } |
| 378 | 380 |
| 379 TEST_F(ExtensionManifestTest, AppLaunchContainer) { | 381 TEST_F(ExtensionManifestTest, AppLaunchContainer) { |
| 380 scoped_refptr<Extension> extension; | 382 scoped_refptr<Extension> extension; |
| 381 CommandLine::ForCurrentProcess()->AppendSwitch( | 383 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePlatformApps); |
| 382 switches::kEnablePlatformApps); | |
| 383 | 384 |
| 384 extension = LoadAndExpectSuccess("launch_tab.json"); | 385 extension = LoadAndExpectSuccess("launch_tab.json"); |
| 385 EXPECT_EQ(extension_misc::LAUNCH_TAB, extension->launch_container()); | 386 EXPECT_EQ(extension_misc::LAUNCH_TAB, extension->launch_container()); |
| 386 | 387 |
| 387 extension = LoadAndExpectSuccess("launch_panel.json"); | 388 extension = LoadAndExpectSuccess("launch_panel.json"); |
| 388 EXPECT_EQ(extension_misc::LAUNCH_PANEL, extension->launch_container()); | 389 EXPECT_EQ(extension_misc::LAUNCH_PANEL, extension->launch_container()); |
| 389 | 390 |
| 390 extension = LoadAndExpectSuccess("launch_default.json"); | 391 extension = LoadAndExpectSuccess("launch_default.json"); |
| 391 EXPECT_EQ(extension_misc::LAUNCH_TAB, extension->launch_container()); | 392 EXPECT_EQ(extension_misc::LAUNCH_TAB, extension->launch_container()); |
| 392 | 393 |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 | 991 |
| 991 // This guy is identical to the previous but doesn't ask for any | 992 // This guy is identical to the previous but doesn't ask for any |
| 992 // platform-app-only permissions. We should be able to load him and ask | 993 // platform-app-only permissions. We should be able to load him and ask |
| 993 // questions about his permissions. | 994 // questions about his permissions. |
| 994 scoped_refptr<Extension> extension( | 995 scoped_refptr<Extension> extension( |
| 995 LoadAndExpectSuccess("not_platform_app.json")); | 996 LoadAndExpectSuccess("not_platform_app.json")); |
| 996 scoped_refptr<const ExtensionPermissionSet> permissions; | 997 scoped_refptr<const ExtensionPermissionSet> permissions; |
| 997 permissions = extension->GetActivePermissions(); | 998 permissions = extension->GetActivePermissions(); |
| 998 EXPECT_FALSE(permissions->HasPlatformAppPermissions()); | 999 EXPECT_FALSE(permissions->HasPlatformAppPermissions()); |
| 999 } | 1000 } |
| OLD | NEW |