OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <body> |
| 4 <script src="../resources/js-test.js"></script> |
| 5 <script> |
| 6 description("Validates that the orientationchange event is fired."); |
| 7 window.jsTestIsAsync = true; |
| 8 |
| 9 var currentTestOrientation = 0; |
| 10 var testOrientations = [ |
| 11 "portrait-secondary", |
| 12 "landscape-primary", |
| 13 "landscape-secondary", |
| 14 "portrait-primary" |
| 15 ]; |
| 16 |
| 17 var testEvent; |
| 18 function onOrientationChangeEvent(ev) { |
| 19 testEvent = ev; |
| 20 shouldBeEqualToString("testEvent.type", "orientationchange"); |
| 21 shouldBeEqualToString("screen.orientation", "" + testOrientations[currentTes
tOrientation]); |
| 22 if (currentTestOrientation == testOrientations.length - 1) { |
| 23 finishJSTest(); |
| 24 return; |
| 25 } |
| 26 internals.setScreenOrientation(document, testOrientations[++currentTestOrien
tation]); |
| 27 } |
| 28 |
| 29 shouldBeEqualToString("screen.orientation", "portrait-primary"); |
| 30 |
| 31 internals.setScreenOrientationClientMock(document); |
| 32 screen.addEventListener("orientationchange", onOrientationChangeEvent); |
| 33 internals.setScreenOrientation(document, testOrientations[currentTestOrientation
]); |
| 34 </script> |
| 35 </body> |
| 36 </html> |
OLD | NEW |