3 <script src=
"../http/tests/inspector/inspector-test.js"></script>
6 if (!window
.testRunner
)
7 debug("This test requires testRunner");
11 return "angle: " + screen
.orientation
.angle
+ "; type: " + screen
.orientation
.type
;
14 if (window
.testRunner
)
15 testRunner
.setMockScreenOrientation("landscape-primary");
19 function addDumpResult(next
)
21 InspectorTest
.evaluateInPage("dump()", dumpCallback
);
23 function dumpCallback(result
)
25 InspectorTest
.addResult(result
.value
);
30 function testOverride(angle
, orientation
, next
)
32 var protocolCallback
= addDumpResult
.bind(null, next
);
34 InspectorTest
.ScreenOrientationAgent
.setScreenOrientationOverride(angle
, orientation
, protocolCallback
);
36 InspectorTest
.ScreenOrientationAgent
.clearScreenOrientationOverride(protocolCallback
);
40 function testError(angle
, orientation
, next
)
42 InspectorTest
.ScreenOrientationAgent
.setScreenOrientationOverride(angle
, orientation
, protocolCallback
);
44 function protocolCallback(error
)
46 InspectorTest
.addResult(error
);
51 InspectorTest
.runTestSuite([
52 function initial(next
)
57 function setWrongAngle1(next
)
59 testError(-1, "portraitPrimary", next
);
62 function setWrongAngle2(next
)
64 testError(360, "portraitPrimary", next
);
67 function setWrongType(next
)
69 testError(120, "wrongType", next
);
72 function setPortraitPrimary(next
)
74 testOverride(0, "portraitPrimary", next
);
77 function setPortraitSecondary(next
)
79 testOverride(180, "portraitSecondary", next
);
82 function setLandscapePrimary(next
)
84 testOverride(90, "landscapePrimary", next
);
87 function restoresAfterReload(next
)
89 InspectorTest
.reloadPage(addDumpResult
.bind(null, next
));
92 function setLandscapeSecondary(next
)
94 testOverride(270, "landscapeSecondary", next
);
97 function clearOverride(next
)
99 testOverride(0, "", next
);
105 <body onload=
"runTest()">