summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/extension_manifests_unittest.cc
diff options
context:
space:
mode:
authorcsilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-07 19:13:05 +0000
committercsilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-07 19:13:05 +0000
commit554890fecb9712a3e7a99c5c82ca5b3d4f06f0d5 (patch)
treec84a41245a96421e7d29b8da37f4dd4ccd455f14 /chrome/common/extensions/extension_manifests_unittest.cc
parente20779b8a5b1ee99481ce780b10cab5215aa01db (diff)
downloadchromium_src-554890fecb9712a3e7a99c5c82ca5b3d4f06f0d5.zip
chromium_src-554890fecb9712a3e7a99c5c82ca5b3d4f06f0d5.tar.gz
chromium_src-554890fecb9712a3e7a99c5c82ca5b3d4f06f0d5.tar.bz2
Revert 108885 - Add platform_app flag to manifest.
Enforce constraint that a platform app must declare a panel as its launch container. BUG=none TEST=unit tests added. Review URL: http://codereview.chromium.org/8429023 TBR=miket@chromium.org Review URL: http://codereview.chromium.org/8467022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108887 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/extension_manifests_unittest.cc')
-rw-r--r--chrome/common/extensions/extension_manifests_unittest.cc43
1 files changed, 22 insertions, 21 deletions
diff --git a/chrome/common/extensions/extension_manifests_unittest.cc b/chrome/common/extensions/extension_manifests_unittest.cc
index 7029570..be4ecce 100644
--- a/chrome/common/extensions/extension_manifests_unittest.cc
+++ b/chrome/common/extensions/extension_manifests_unittest.cc
@@ -8,15 +8,16 @@
#include <gtk/gtk.h>
#endif
+#include "base/command_line.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/i18n/rtl.h"
#include "base/json/json_value_serializer.h"
#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
+#include "base/stringprintf.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
-#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
@@ -26,7 +27,6 @@
#include "chrome/common/extensions/extension_sidebar_defaults.h"
#include "chrome/common/extensions/file_browser_handler.h"
#include "chrome/common/extensions/url_pattern.h"
-#include "chrome/test/base/scoped_command_line_override.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h"
@@ -221,16 +221,16 @@ TEST_F(ExtensionManifestTest, InitFromValueValid) {
// Test that an empty list of page actions does not stop a browser action
// from being loaded.
- LoadAndExpectSuccess("init_valid_empty_page_actions.json");
+ extension = LoadAndExpectSuccess("init_valid_empty_page_actions.json");
// Test with a minimum_chrome_version.
- LoadAndExpectSuccess("init_valid_minimum_chrome.json");
+ extension = LoadAndExpectSuccess("init_valid_minimum_chrome.json");
// Test a hosted app with a minimum_chrome_version.
- LoadAndExpectSuccess("init_valid_app_minimum_chrome.json");
+ extension = LoadAndExpectSuccess("init_valid_app_minimum_chrome.json");
// Test a hosted app with a requirements section.
- LoadAndExpectSuccess("init_valid_app_requirements.json");
+ extension = LoadAndExpectSuccess("init_valid_app_requirements.json");
// Verify empty permission settings are considered valid.
LoadAndExpectSuccess("init_valid_permissions_empty.json");
@@ -240,11 +240,6 @@ TEST_F(ExtensionManifestTest, InitFromValueValid) {
LoadAndExpectSuccess("init_valid_permissions_unknown.json");
}
-TEST_F(ExtensionManifestTest, PlatformApps) {
- // A minimal platform app.
- LoadAndExpectSuccess("init_valid_platform_app.json");
-}
-
TEST_F(ExtensionManifestTest, InitFromValueValidNameInRTL) {
#if defined(TOOLKIT_GTK)
GtkTextDirection gtk_dir = gtk_widget_get_default_direction();
@@ -397,11 +392,6 @@ TEST_F(ExtensionManifestTest, AppLaunchContainer) {
errors::kInvalidLaunchContainer);
LoadAndExpectError("launch_container_invalid_type.json",
errors::kInvalidLaunchContainer);
- {
- ScopedCommandLineOverride override(switches::kEnablePlatformApps);
- LoadAndExpectError("launch_container_invalid_type_for_platform.json",
- errors::kInvalidLaunchContainerForPlatform);
- }
LoadAndExpectError("launch_container_invalid_value.json",
errors::kInvalidLaunchContainer);
LoadAndExpectError("launch_container_without_launch_url.json",
@@ -536,9 +526,11 @@ TEST_F(ExtensionManifestTest, ExperimentalPermission) {
LoadAndExpectSuccess("experimental.json", Extension::COMPONENT);
LoadAndExpectSuccess("experimental.json", Extension::INTERNAL,
Extension::FROM_WEBSTORE);
- ScopedCommandLineOverride override(
+ CommandLine old_command_line = *CommandLine::ForCurrentProcess();
+ CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableExperimentalExtensionApis);
LoadAndExpectSuccess("experimental.json");
+ *CommandLine::ForCurrentProcess() = old_command_line;
}
TEST_F(ExtensionManifestTest, DevToolsExtensions) {
@@ -547,20 +539,25 @@ TEST_F(ExtensionManifestTest, DevToolsExtensions) {
LoadAndExpectError("devtools_extension_url_invalid_type.json",
errors::kInvalidDevToolsPage);
- ScopedCommandLineOverride override(
+ CommandLine old_command_line = *CommandLine::ForCurrentProcess();
+ CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableExperimentalExtensionApis);
+
scoped_refptr<Extension> extension;
extension = LoadAndExpectSuccess("devtools_extension.json");
EXPECT_EQ(extension->url().spec() + "devtools.html",
extension->devtools_url().spec());
EXPECT_TRUE(extension->HasEffectiveAccessToAllHosts());
+
+ *CommandLine::ForCurrentProcess() = old_command_line;
}
TEST_F(ExtensionManifestTest, Sidebar) {
LoadAndExpectError("sidebar.json",
errors::kExperimentalFlagRequired);
- ScopedCommandLineOverride override(
+ CommandLine old_command_line = *CommandLine::ForCurrentProcess();
+ CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableExperimentalExtensionApis);
LoadAndExpectError("sidebar_no_permissions.json",
@@ -585,6 +582,8 @@ TEST_F(ExtensionManifestTest, Sidebar) {
"icon.png");
EXPECT_EQ(extension->url().spec() + "sidebar.html",
extension->sidebar_defaults()->default_page().spec());
+
+ *CommandLine::ForCurrentProcess() = old_command_line;
}
TEST_F(ExtensionManifestTest, DisallowHybridApps) {
@@ -817,7 +816,7 @@ TEST_F(ExtensionManifestTest, TtsEngine) {
}
TEST_F(ExtensionManifestTest, WebIntents) {
- ScopedCommandLineOverride override("--enable-web-intents");
+ CommandLine::ForCurrentProcess()->AppendSwitch("--enable-web-intents");
LoadAndExpectError("intent_invalid_1.json",
extension_manifest_errors::kInvalidIntents);
@@ -880,11 +879,13 @@ TEST_F(ExtensionManifestTest, IsolatedApps) {
LoadAndExpectError("isolated_app_valid.json",
errors::kExperimentalFlagRequired);
- ScopedCommandLineOverride override(
+ CommandLine old_command_line = *CommandLine::ForCurrentProcess();
+ CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableExperimentalExtensionApis);
scoped_refptr<Extension> extension2(
LoadAndExpectSuccess("isolated_app_valid.json"));
EXPECT_TRUE(extension2->is_storage_isolated());
+ *CommandLine::ForCurrentProcess() = old_command_line;
}