Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: third_party/WebKit/LayoutTests/inspector/screen-orientation-override.html

Issue 1727083002: Revert of [DevTools] Move screen orientation override to RenderWidgetScreenMetricsEmulator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/inspector/screen-orientation-override.html
diff --git a/third_party/WebKit/LayoutTests/inspector/screen-orientation-override.html b/third_party/WebKit/LayoutTests/inspector/screen-orientation-override.html
index b65b21dbb2306a3d65820307ecfa22614eac8010..11bf460764e2d1a18ac3e1cf144028d06accf05f 100644
--- a/third_party/WebKit/LayoutTests/inspector/screen-orientation-override.html
+++ b/third_party/WebKit/LayoutTests/inspector/screen-orientation-override.html
@@ -3,25 +3,16 @@
<script src="../http/tests/inspector/inspector-test.js"></script>
<script>
-var windowOrientationChangeEvent = false;
-var screenOrientationChangeEvent = false;
-
-window.addEventListener("orientationchange", function() { windowOrientationChangeEvent = true; maybeLog(); });
-screen.orientation.addEventListener("change", function() { screenOrientationChangeEvent = true; maybeLog(); });
+if (!window.testRunner)
+ debug("This test requires testRunner");
function dump()
{
return "angle: " + screen.orientation.angle + "; type: " + screen.orientation.type;
}
-function maybeLog()
-{
- if (windowOrientationChangeEvent && screenOrientationChangeEvent) {
- windowOrientationChangeEvent = false;
- screenOrientationChangeEvent = false;
- console.log(dump());
- }
-}
+if (window.testRunner)
+ testRunner.setMockScreenOrientation("landscape-primary");
function test()
{
@@ -38,27 +29,29 @@
function testOverride(angle, orientation, next)
{
- InspectorTest.addConsoleSniffer(addDumpResult.bind(null, next));
- InspectorTest.EmulationAgent.invoke_setDeviceMetricsOverride({width: 0, height: 0, deviceScaleFactor: 0, mobile: true, fitWindow: false, screenOrientation: {type: orientation, angle: angle}}, function() {});
+ var protocolCallback = addDumpResult.bind(null, next);
+ if (orientation) {
+ InspectorTest.ScreenOrientationAgent.setScreenOrientationOverride(angle, orientation, protocolCallback);
+ } else {
+ InspectorTest.ScreenOrientationAgent.clearScreenOrientationOverride(protocolCallback);
+ }
}
function testError(angle, orientation, next)
{
- InspectorTest.EmulationAgent.invoke_setDeviceMetricsOverride({width: 0, height: 0, deviceScaleFactor: 0, mobile: true, fitWindow: false, screenOrientation: {type: orientation, angle: angle}}, next);
+ InspectorTest.ScreenOrientationAgent.setScreenOrientationOverride(angle, orientation, protocolCallback);
+
+ function protocolCallback(error)
+ {
+ InspectorTest.addResult(error);
+ next();
+ }
}
-
- var original;
InspectorTest.runTestSuite([
function initial(next)
{
- InspectorTest.evaluateInPage("dump()", dumpCallback);
-
- function dumpCallback(result)
- {
- original = result.value;
- next();
- }
+ addDumpResult(next);
},
function setWrongAngle1(next)
@@ -103,18 +96,7 @@
function clearOverride(next)
{
- InspectorTest.EmulationAgent.clearDeviceMetricsOverride(checkInitial);
-
- function checkInitial()
- {
- InspectorTest.evaluateInPage("dump()", dumpCallback);
- }
-
- function dumpCallback(result)
- {
- InspectorTest.addResult("Equals to initial: " + (original === result.value ? "true" : "false"));
- next();
- }
+ testOverride(0, "", next);
}
]);
}

Powered by Google App Engine
This is Rietveld 408576698