summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-27 15:47:37 +0000
committerhans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-27 15:47:37 +0000
commit7145320c0b916fdac0dfaa43bb95bb13714f73e1 (patch)
tree374e24cb615c2fe998ece1b09396e31725f1f657
parent07b49351b65e228e7bceb7219f2b2a7e9b98f0ac (diff)
downloadchromium_src-7145320c0b916fdac0dfaa43bb95bb13714f73e1.zip
chromium_src-7145320c0b916fdac0dfaa43bb95bb13714f73e1.tar.gz
chromium_src-7145320c0b916fdac0dfaa43bb95bb13714f73e1.tar.bz2
Enable device orientation by default.
Enable device orientation by default. Replace the --enable-device-orientation command-line flag with a --disable-device-orientation flag. BUG=44654 TEST=browser_tests --gtest_filter="DeviceOrientationBrowserTest.*" Review URL: http://codereview.chromium.org/3136038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57684 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/device_orientation/device_orientation_browsertest.cc2
-rw-r--r--chrome/browser/device_orientation/enable_switch_browsertest.cc34
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc2
-rw-r--r--chrome/chrome_tests.gypi1
-rw-r--r--chrome/common/chrome_switches.cc6
-rw-r--r--chrome/common/chrome_switches.h2
-rw-r--r--chrome/renderer/render_thread.cc2
-rw-r--r--chrome/test/data/device_orientation/enable_switch_test.html32
8 files changed, 7 insertions, 74 deletions
diff --git a/chrome/browser/device_orientation/device_orientation_browsertest.cc b/chrome/browser/device_orientation/device_orientation_browsertest.cc
index 332316e..d33f5d3 100644
--- a/chrome/browser/device_orientation/device_orientation_browsertest.cc
+++ b/chrome/browser/device_orientation/device_orientation_browsertest.cc
@@ -38,7 +38,7 @@ class DeviceOrientationBrowserTest : public InProcessBrowserTest {
public:
// From InProcessBrowserTest.
virtual void SetUpCommandLine(CommandLine* command_line) {
- command_line->AppendSwitch(switches::kEnableDeviceOrientation);
+ EXPECT_TRUE(!command_line->HasSwitch(switches::kDisableDeviceOrientation));
}
GURL testUrl(const FilePath::CharType* filename) {
diff --git a/chrome/browser/device_orientation/enable_switch_browsertest.cc b/chrome/browser/device_orientation/enable_switch_browsertest.cc
deleted file mode 100644
index ee3303c..0000000
--- a/chrome/browser/device_orientation/enable_switch_browsertest.cc
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/command_line.h"
-#include "base/file_path.h"
-#include "chrome/browser/browser.h"
-#include "chrome/browser/tab_contents/tab_contents.h"
-#include "chrome/common/chrome_switches.h"
-#include "chrome/test/in_process_browser_test.h"
-#include "chrome/test/ui_test_utils.h"
-
-class DeviceOrientationEnableSwitchTest : public InProcessBrowserTest {
- public:
- GURL testUrl(const FilePath::CharType* filename) {
- const FilePath kTestDir(FILE_PATH_LITERAL("device_orientation"));
- return ui_test_utils::GetTestUrl(kTestDir, FilePath(filename));
- }
-};
-
-IN_PROC_BROWSER_TEST_F(DeviceOrientationEnableSwitchTest, UnavailabilityTest) {
- // Test that device orientation is not available to a web page if
- // the runtime switch is disabled.
-
- const CommandLine& command_line = *CommandLine::ForCurrentProcess();
- bool has_switch = command_line.HasSwitch(switches::kEnableDeviceOrientation);
- ASSERT_FALSE(has_switch) << "This test does not make sense if "
- << "--enable-device-orientation is set.";
-
- GURL test_url = testUrl(FILE_PATH_LITERAL("enable_switch_test.html"));
- ui_test_utils::NavigateToURL(browser(), test_url);
- std::string status = browser()->GetSelectedTabContents()->GetURL().ref();
- EXPECT_EQ("pass", status) << "Page detected device orientation properties.";
-}
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index 5fd4b72..8a355f6 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -541,7 +541,7 @@ void BrowserRenderProcessHost::PropagateBrowserCommandLineToRenderer(
switches::kDisableSessionStorage,
switches::kDisableSharedWorkers,
switches::kDisableApplicationCache,
- switches::kEnableDeviceOrientation,
+ switches::kDisableDeviceOrientation,
switches::kEnableIndexedDatabase,
switches::kEnableSpeechInput,
switches::kDisableGeolocation,
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index a8fb62b..9888c23 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -1671,7 +1671,6 @@
'browser/cocoa/applescript/window_applescript_test.mm',
'browser/crash_recovery_browsertest.cc',
'browser/device_orientation/device_orientation_browsertest.cc',
- 'browser/device_orientation/enable_switch_browsertest.cc',
'browser/dom_ui/file_browse_browsertest.cc',
'browser/dom_ui/mediaplayer_browsertest.cc',
'browser/download/save_page_browsertest.cc',
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index c1c7a49..03dfadf 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -166,6 +166,9 @@ const char kDisableDesktopNotifications[] = "disable-desktop-notifications";
// Browser flag to disable the web inspector for all renderers.
const char kDisableDevTools[] = "disable-dev-tools";
+// Disables device orientation events.
+const char kDisableDeviceOrientation[] = "disable-device-orientation";
+
// Disable extensions.
const char kDisableExtensions[] = "disable-extensions";
@@ -373,9 +376,6 @@ const char kEnableCookiePrompt[] = "enable-cookie-prompt";
// Enables device motion events.
const char kEnableDeviceMotion[] = "enable-device-motion";
-// Enables device orientation events.
-const char kEnableDeviceOrientation[] = "enable-device-orientation";
-
const char kEnableDNSSECCerts[] = "enable-dnssec-certs";
// Enables extension APIs that are in development.
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index a466041..1b87560 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -60,6 +60,7 @@ extern const char kDisableCustomJumpList[];
extern const char kDisableDatabases[];
extern const char kDisableDesktopNotifications[];
extern const char kDisableDevTools[];
+extern const char kDisableDeviceOrientation[];
extern const char kDisableExtensions[];
extern const char kDisableExtensionsFileAccessCheck[];
extern const char kDisableGeolocation[];
@@ -118,7 +119,6 @@ extern const char kEnableConnectBackupJobs[];
extern const char kEnableContentPrefetch[];
extern const char kEnableCookiePrompt[];
extern const char kEnableDeviceMotion[];
-extern const char kEnableDeviceOrientation[];
extern const char kEnableDNSSECCerts[];
extern const char kEnableExperimentalExtensionApis[];
extern const char kEnableExperimentalWebGL[];
diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc
index e6658eb..d45a925 100644
--- a/chrome/renderer/render_thread.cc
+++ b/chrome/renderer/render_thread.cc
@@ -931,7 +931,7 @@ void RenderThread::EnsureWebKitInitialized() {
command_line.HasSwitch(switches::kEnableDeviceMotion));
WebRuntimeFeatures::enableDeviceOrientation(
- command_line.HasSwitch(switches::kEnableDeviceOrientation));
+ !command_line.HasSwitch(switches::kDisableDeviceOrientation));
WebRuntimeFeatures::enableSpeechInput(
command_line.HasSwitch(switches::kEnableSpeechInput));
diff --git a/chrome/test/data/device_orientation/enable_switch_test.html b/chrome/test/data/device_orientation/enable_switch_test.html
deleted file mode 100644
index c2f90ac..0000000
--- a/chrome/test/data/device_orientation/enable_switch_test.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<html>
- <head>
- <title>DeviceOrientationEnableSwitchTest</title>
- <script type="text/javascript">
- var failed = false;
- function pass() {
- if (failed)
- return;
- document.getElementById('status').innerHTML = 'PASS';
- document.location = '#pass';
- }
- function fail() {
- document.getElementById('status').innerHTML = 'FAIL';
- document.location = '#fail';
- failed = true;
- }
- function run() {
- for (var property in window) {
- if (property == "DeviceOrientationEvent")
- fail();
- if (property == "ondeviceorientation")
- fail();
- }
-
- pass();
- }
- </script>
- </head>
- <body onload="run()">
- <div id="status">Running...</div>
- </body>
-</html>