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

Side by Side Diff: LayoutTests/screen_orientation/locked-no-orientation-change-event.html

Issue 132113006: Add initial Blink-side support for the Screen Orientation API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add locked-no-orientation-change-event.html layout test Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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.");
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 onOrientationChangeEvent(ev) {
19 ++orientationChangeCount;
20 testFailed("Unexpected 'orientationchange' event.");
21 }
22
23 function changeOrientation() {
24 if (currentTestOrientation == testOrientations.length) {
25 if (orientationChangeCount)
26 testFailed("Received " + orientationChangeCount + " unexpected 'orie ntationchange' event(s).");
27 else
28 testPassed("Received no 'orientationchange' event, as expected.");
29 finishJSTest();
30 return;
31 }
32 debug("Faking device screen orientation change to '" + testOrientations[curr entTestOrientation] +"'...");
33 internals.setScreenOrientation(document, testOrientations[currentTestOrienta tion++]);
34 setTimeout(changeOrientation, 100);
35 }
36
37 internals.setScreenOrientationClientMock(document);
38 screen.addEventListener("orientationchange", onOrientationChangeEvent);
39
40 shouldBeEqualToString("screen.orientation", "portrait-primary");
41 debug("locking orientation to 'portrait-primary'.");
42 shouldBeTrue("screen.lockOrientation('portrait-primary')");
43 setTimeout(changeOrientation, 100);
44 </script>
45 </body>
46 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698