Commit 993aa3f8 authored by mlamouri@chromium.org's avatar mlamouri@chromium.org

Disable Screen Orientation API on Win8.

This is a temporary measure until:
- we can disable the API only on Win8 Metro OR,
- we can make it work on Win8 Metro.

The API is currently broken on Win8 Metro and it is not trivial to
disable it on that mode only. Given the discussion with the Blink API
owners, disabling it on Win8 would be better than not shipping because
of the bug on Win8 Metro.

BUG=400846

Review URL: https://codereview.chromium.org/456623003

Cr-Commit-Position: refs/heads/master@{#288371}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288371 0039d316-1c4b-4281-b951-d872f2087c98
parent fe656728
......@@ -21,6 +21,10 @@
#include "third_party/WebKit/public/platform/WebScreenInfo.h"
#include "ui/compositor/compositor_switches.h"
#if defined(OS_WIN)
#include "base/win/windows_version.h"
#endif // OS_WIN
namespace content {
class ScreenOrientationBrowserTest : public ContentBrowserTest {
......@@ -86,6 +90,13 @@ class ScreenOrientationBrowserTest : public ContentBrowserTest {
return type;
}
bool ScreenOrientationSupported() {
bool support;
ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(),
"'orientation' in screen")->GetAsBoolean(&support);
return support;
}
bool WindowOrientationSupported() {
bool support;
ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(),
......@@ -123,6 +134,15 @@ IN_PROC_BROWSER_TEST_F(ScreenOrientationBrowserTest, ScreenOrientationChange) {
WaitForResizeComplete(shell()->web_contents());
#endif // USE_AURA
#if defined(OS_WIN)
// Screen Orientation is currently disabled on Windows 8.
// This test will break, requiring an update when the API will be enabled.
if (base::win::OSInfo::GetInstance()->version() >= base::win::VERSION_WIN8) {
EXPECT_EQ(false, ScreenOrientationSupported());
return;
}
#endif // defined(OS_WIN)
int angle = GetOrientationAngle();
for (int i = 0; i < 4; ++i) {
......@@ -170,6 +190,16 @@ IN_PROC_BROWSER_TEST_F(ScreenOrientationBrowserTest, LockSmoke) {
TestNavigationObserver navigation_observer(shell()->web_contents(), 2);
shell()->LoadURL(test_url);
#if defined(OS_WIN)
// Screen Orientation is currently disabled on Windows 8.
// This test will break, requiring an update when the API will be enabled.
if (base::win::OSInfo::GetInstance()->version() >= base::win::VERSION_WIN8) {
EXPECT_EQ(false, ScreenOrientationSupported());
return;
}
#endif // defined(OS_WIN)
navigation_observer.Wait();
#if USE_AURA
WaitForResizeComplete(shell()->web_contents());
......
......@@ -15,6 +15,8 @@
#include "base/android/build_info.h"
#include "base/metrics/field_trial.h"
#include "media/base/android/media_codec_bridge.h"
#elif defined(OS_WIN)
#include "base/win/windows_version.h"
#endif
using blink::WebRuntimeFeatures;
......@@ -67,6 +69,15 @@ static void SetRuntimeFeatureDefaultsForPlatform() {
// Only Android, ChromeOS, and IOS support NetInfo right now.
WebRuntimeFeatures::enableNetworkInformation(false);
#endif
#if defined(OS_WIN)
// Screen Orientation API is currently broken on Windows 8 Metro mode and
// until we can find how to disable it only for Blink instances running in a
// renderer process in Metro, we need to disable the API altogether for Win8.
// See http://crbug.com/400846
if (base::win::OSInfo::GetInstance()->version() >= base::win::VERSION_WIN8)
WebRuntimeFeatures::enableScreenOrientation(false);
#endif // OS_WIN
}
void SetRuntimeFeaturesDefaultsAndUpdateFromArgs(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment