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

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

Issue 241203003: Screen Orientation: fire event on Window instead of Screen. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@ScreenOrientationUndefined
Patch Set: fix tests Created 6 years, 8 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <body> 3 <body>
4 <script src="../resources/js-test.js"></script> 4 <script src="../resources/js-test.js"></script>
5 <script> 5 <script>
6 description("Validates that screen.lockOrientation() returns false on bad input" ); 6 description("Validates that screen.lockOrientation() returns false on bad input" );
7 window.jsTestIsAsync = true; 7 window.jsTestIsAsync = true;
8 8
9 function onOrientationChangeEvent(ev) { 9 function onOrientationChangeEvent(ev) {
10 testFailed("Unexpected 'orientationchange' event"); 10 testFailed("Unexpected 'orientationchange' event");
11 } 11 }
12 12
13 function completeTest() { 13 function completeTest() {
14 shouldBeEqualToString("screen.orientation", "portrait-primary"); 14 shouldBeEqualToString("screen.orientation", "portrait-primary");
15 screen.unlockOrientation(); 15 screen.unlockOrientation();
16 finishJSTest(); 16 finishJSTest();
17 } 17 }
18 18
19 screen.addEventListener("orientationchange", onOrientationChangeEvent); 19 window.addEventListener("orientationchange", onOrientationChangeEvent);
20 20
21 function typeErrorEnum(argStr) { 21 function typeErrorEnum(argStr) {
22 return "TypeError: Failed to execute 'lockOrientation' on 'Screen': parameter 1 ('" + argStr + "') is not a valid enum value."; 22 return "TypeError: Failed to execute 'lockOrientation' on 'Screen': parameter 1 ('" + argStr + "') is not a valid enum value.";
23 } 23 }
24 24
25 shouldBeEqualToString("screen.orientation", "portrait-primary"); 25 shouldBeEqualToString("screen.orientation", "portrait-primary");
26 shouldThrow("screen.lockOrientation('invalid-orientation')", "typeErrorEnum('inv alid-orientation')"); 26 shouldThrow("screen.lockOrientation('invalid-orientation')", "typeErrorEnum('inv alid-orientation')");
27 shouldBeEqualToString("screen.orientation", "portrait-primary"); 27 shouldBeEqualToString("screen.orientation", "portrait-primary");
28 shouldThrow("screen.lockOrientation(null)", "typeErrorEnum('null')"); 28 shouldThrow("screen.lockOrientation(null)", "typeErrorEnum('null')");
29 shouldBeEqualToString("screen.orientation", "portrait-primary"); 29 shouldBeEqualToString("screen.orientation", "portrait-primary");
30 shouldThrow("screen.lockOrientation(undefined)", "typeErrorEnum('undefined')"); 30 shouldThrow("screen.lockOrientation(undefined)", "typeErrorEnum('undefined')");
31 shouldBeEqualToString("screen.orientation", "portrait-primary"); 31 shouldBeEqualToString("screen.orientation", "portrait-primary");
32 shouldThrow("screen.lockOrientation(123)", "typeErrorEnum('123')"); 32 shouldThrow("screen.lockOrientation(123)", "typeErrorEnum('123')");
33 shouldBeEqualToString("screen.orientation", "portrait-primary"); 33 shouldBeEqualToString("screen.orientation", "portrait-primary");
34 shouldThrow("screen.lockOrientation(window)", "typeErrorEnum('[object Window]')" ); 34 shouldThrow("screen.lockOrientation(window)", "typeErrorEnum('[object Window]')" );
35 shouldBeEqualToString("screen.orientation", "portrait-primary"); 35 shouldBeEqualToString("screen.orientation", "portrait-primary");
36 shouldThrow("screen.lockOrientation(['portrait-primary', 'landscape-primary'])", "typeErrorEnum('portrait-primary,landscape-primary')"); 36 shouldThrow("screen.lockOrientation(['portrait-primary', 'landscape-primary'])", "typeErrorEnum('portrait-primary,landscape-primary')");
37 shouldBeEqualToString("screen.orientation", "portrait-primary"); 37 shouldBeEqualToString("screen.orientation", "portrait-primary");
38 shouldThrow("screen.lockOrientation()", '"TypeError: Failed to execute \'lockOri entation\' on \'Screen\': 1 argument required, but only 0 present."'); 38 shouldThrow("screen.lockOrientation()", '"TypeError: Failed to execute \'lockOri entation\' on \'Screen\': 1 argument required, but only 0 present."');
39 39
40 // Finish asynchronously to give events a chance to fire. 40 // Finish asynchronously to give events a chance to fire.
41 setTimeout(completeTest, 0); 41 setTimeout(completeTest, 0);
42 </script> 42 </script>
43 </body> 43 </body>
44 </html> 44 </html>
45 45
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698