OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <html> | |
3 <body> | |
4 <script src="../resources/js-test.js"></script> | |
5 <script> | |
6 description("Validates that no orientationchange event is fired when we are lock ed."); | |
mlamouri (slow - plz ping)
2014/02/12 20:11:26
This test seems to essentially test the mock objec
Inactive
2014/02/12 21:08:04
So you want to remove this layout test?
mlamouri (slow - plz ping)
2014/02/13 16:12:08
I guess we could remove it yes. There is no point
Inactive
2014/02/13 17:03:24
Done.
| |
7 window.jsTestIsAsync = true; | |
8 | |
9 var orientationChangeCount = 0; | |
10 var currentTestOrientation = 0; | |
11 var testOrientations = [ | |
12 "portrait-secondary", | |
13 "landscape-primary", | |
14 "landscape-secondary", | |
15 "portrait-primary" | |
16 ]; | |
17 | |
18 function testComplete() { | |
19 screen.unlockOrientation(); | |
20 finishJSTest(); | |
21 } | |
22 | |
23 function onOrientationChangeEvent(ev) { | |
24 ++orientationChangeCount; | |
25 testFailed("Unexpected 'orientationchange' event."); | |
26 } | |
27 | |
28 function changeOrientation() { | |
29 shouldBeEqualToString("screen.orientation", "portrait-primary"); | |
30 if (currentTestOrientation == testOrientations.length) { | |
31 if (orientationChangeCount) | |
32 testFailed("Received " + orientationChangeCount + " unexpected 'orie ntationchange' event(s)."); | |
33 else | |
34 testPassed("Received no 'orientationchange' event, as expected."); | |
35 testComplete(); | |
36 return; | |
37 } | |
38 debug("Faking device screen orientation change to '" + testOrientations[curr entTestOrientation] +"'..."); | |
39 internals.setScreenOrientation(document, testOrientations[currentTestOrienta tion++]); | |
40 setTimeout(changeOrientation, 100); | |
41 } | |
42 | |
43 internals.setScreenOrientationClientMock(document); | |
44 screen.addEventListener("orientationchange", onOrientationChangeEvent); | |
45 | |
46 shouldBeEqualToString("screen.orientation", "portrait-primary"); | |
47 debug("locking orientation to 'portrait-primary'."); | |
48 shouldBeTrue("screen.lockOrientation('portrait-primary')"); | |
49 setTimeout(changeOrientation, 100); | |
50 </script> | |
51 </body> | |
52 </html> | |
OLD | NEW |