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

Side by Side Diff: LayoutTests/screen_orientation/lockOrientation-bad-argument.html

Issue 171683015: Screen Orientation API: Add support for lockOrientation() / unlockOrientation() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase 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 screen.lockOrientation() returns false on bad input" );
7 window.jsTestIsAsync = true;
8
9 function onOrientationChangeEvent(ev) {
10 testFailed("Unexpected 'orientationchange' event");
11 }
12
13 function completeTest() {
14 shouldBeEqualToString("screen.orientation", "portrait-primary");
15 screen.unlockOrientation();
16 finishJSTest();
17 }
18
19 screen.addEventListener("orientationchange", onOrientationChangeEvent);
20
21 shouldBeEqualToString("screen.orientation", "portrait-primary");
22 shouldBeFalse("screen.lockOrientation('invalid-orientation')");
23 shouldBeEqualToString("screen.orientation", "portrait-primary");
24 shouldBeFalse("screen.lockOrientation(null)");
25 shouldBeEqualToString("screen.orientation", "portrait-primary");
26 shouldBeFalse("screen.lockOrientation(undefined)");
27 shouldBeEqualToString("screen.orientation", "portrait-primary");
28 shouldBeFalse("screen.lockOrientation(123)");
29 shouldBeEqualToString("screen.orientation", "portrait-primary");
30 shouldBeFalse("screen.lockOrientation(window)");
31 shouldBeEqualToString("screen.orientation", "portrait-primary");
32 shouldThrow("screen.lockOrientation()", '"TypeError: Failed to execute \'lockOri entation\' on \'Screen\': 1 argument required, but only 0 present."');
33
34 // Finish asynchronously to give events a chance to fire.
35 setTimeout(completeTest, 0);
36 </script>
37 </body>
38 </html>
39
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698