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

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

Issue 1195793008: [DevTools] Implement screen orientation override. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Restore test Created 5 years, 6 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: LayoutTests/inspector/screen-orientation-override.html
diff --git a/LayoutTests/inspector/screen-orientation-override.html b/LayoutTests/inspector/screen-orientation-override.html
new file mode 100644
index 0000000000000000000000000000000000000000..11bf460764e2d1a18ac3e1cf144028d06accf05f
--- /dev/null
+++ b/LayoutTests/inspector/screen-orientation-override.html
@@ -0,0 +1,109 @@
+<html>
+<head>
+<script src="../http/tests/inspector/inspector-test.js"></script>
+<script>
+
+if (!window.testRunner)
+ debug("This test requires testRunner");
+
+function dump()
+{
+ return "angle: " + screen.orientation.angle + "; type: " + screen.orientation.type;
+}
+
+if (window.testRunner)
+ testRunner.setMockScreenOrientation("landscape-primary");
+
+function test()
+{
+ function addDumpResult(next)
+ {
+ InspectorTest.evaluateInPage("dump()", dumpCallback);
+
+ function dumpCallback(result)
+ {
+ InspectorTest.addResult(result.value);
+ next();
+ }
+ }
+
+ function testOverride(angle, orientation, next)
+ {
+ 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.ScreenOrientationAgent.setScreenOrientationOverride(angle, orientation, protocolCallback);
+
+ function protocolCallback(error)
+ {
+ InspectorTest.addResult(error);
+ next();
+ }
+ }
+
+ InspectorTest.runTestSuite([
+ function initial(next)
+ {
+ addDumpResult(next);
+ },
+
+ function setWrongAngle1(next)
+ {
+ testError(-1, "portraitPrimary", next);
+ },
+
+ function setWrongAngle2(next)
+ {
+ testError(360, "portraitPrimary", next);
+ },
+
+ function setWrongType(next)
+ {
+ testError(120, "wrongType", next);
+ },
+
+ function setPortraitPrimary(next)
+ {
+ testOverride(0, "portraitPrimary", next);
+ },
+
+ function setPortraitSecondary(next)
+ {
+ testOverride(180, "portraitSecondary", next);
+ },
+
+ function setLandscapePrimary(next)
+ {
+ testOverride(90, "landscapePrimary", next);
+ },
+
+ function restoresAfterReload(next)
+ {
+ InspectorTest.reloadPage(addDumpResult.bind(null, next));
+ },
+
+ function setLandscapeSecondary(next)
+ {
+ testOverride(270, "landscapeSecondary", next);
+ },
+
+ function clearOverride(next)
+ {
+ testOverride(0, "", next);
+ }
+ ]);
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>
+</p>
+</body>
+</html>
« no previous file with comments | « LayoutTests/http/tests/inspector/inspector-test.js ('k') | LayoutTests/inspector/screen-orientation-override-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698