| 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..fbeb01199d511bc6db946e9ab90e9aa8e6213e06
|
| --- /dev/null
|
| +++ b/LayoutTests/inspector/screen-orientation-override.html
|
| @@ -0,0 +1,87 @@
|
| +<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;
|
| +}
|
| +
|
| +function setup()
|
| +{
|
| + if (window.testRunner)
|
| + testRunner.setMockScreenOrientation("landscape-primary");
|
| + return dump();
|
| +}
|
| +
|
| +function test()
|
| +{
|
| + function testOverride(angle, orientation, next)
|
| + {
|
| + if (orientation) {
|
| + InspectorTest.ScreenOrientationAgent.setScreenOrientationOverride(angle, orientation, protocolCallback);
|
| + } else {
|
| + InspectorTest.ScreenOrientationAgent.clearScreenOrientationOverride(protocolCallback);
|
| + }
|
| +
|
| + function protocolCallback()
|
| + {
|
| + InspectorTest.evaluateInPage("dump()", dumpCallback);
|
| + }
|
| +
|
| + function dumpCallback(result)
|
| + {
|
| + InspectorTest.addResult(result.value);
|
| + next();
|
| + }
|
| + }
|
| +
|
| + InspectorTest.runTestSuite([
|
| + function setUp(next)
|
| + {
|
| + InspectorTest.evaluateInPage("setup()", callback);
|
| +
|
| + function callback(result)
|
| + {
|
| + InspectorTest.addResult(result.value);
|
| + next();
|
| + }
|
| + },
|
| +
|
| + function setPortraitPrimary(next)
|
| + {
|
| + testOverride(0, "portraitPrimary", next);
|
| + },
|
| +
|
| + function setPortraitSecondary(next)
|
| + {
|
| + testOverride(180, "portraitSecondary", next);
|
| + },
|
| +
|
| + function setLandscapePrimary(next)
|
| + {
|
| + testOverride(90, "landscapePrimary", next);
|
| + },
|
| +
|
| + function setLandscapeSecondary(next)
|
| + {
|
| + testOverride(270, "landscapeSecondary", next);
|
| + },
|
| +
|
| + function clearOverride(next)
|
| + {
|
| + testOverride(0, "", next);
|
| + }
|
| + ]);
|
| +}
|
| +</script>
|
| +</head>
|
| +<body onload="runTest()">
|
| +<p>
|
| +</p>
|
| +</body>
|
| +</html>
|
|
|