OLD | NEW |
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/testharness.js"></script> |
| 5 <script src="../resources/testharnessreport.js"></script> |
5 <script> | 6 <script> |
6 description("Validates the Screen Orientation API is exposed."); | |
7 | 7 |
8 shouldBeDefined("screen.lockOrientation"); | 8 test(function() { |
9 shouldBeDefined("screen.unlockOrientation"); | 9 assert_true('orientation' in window.screen); |
10 shouldBeDefined("screen.orientation"); | 10 assert_true('angle' in window.screen.orientation); |
11 shouldBeDefined("window.onorientationchange"); | 11 assert_true('type' in window.screen.orientation); |
| 12 assert_true('lock' in window.screen.orientation); |
| 13 assert_true('unlock' in window.screen.orientation); |
| 14 assert_true('onchange' in window.screen.orientation); |
| 15 }, "Test that the Screen Orientation API is present.") |
| 16 |
| 17 test(function() { |
| 18 assert_equals(typeof(screen.orientation), "object"); |
| 19 assert_equals(typeof(screen.orientation.angle), "number"); |
| 20 assert_equals(typeof(screen.orientation.type), "string"); |
| 21 assert_equals(typeof(screen.orientation.lock), "function"); |
| 22 assert_equals(typeof(screen.orientation.unlock), "function"); |
| 23 assert_equals(typeof(screen.orientation.onchange), "object"); |
| 24 }, "Test Screen Orientation API property types."); |
| 25 |
| 26 test(function() { |
| 27 assert_true('addEventListener' in screen.orientation); |
| 28 assert_true('removeEventListener' in screen.orientation); |
| 29 assert_true('dispatchEvent' in screen.orientation); |
| 30 assert_true(screen.orientation instanceof EventTarget) |
| 31 }, "Test that screen.orientation is an EventTarget."); |
| 32 |
12 </script> | 33 </script> |
13 </body> | 34 </body> |
14 </html> | 35 </html> |
15 | |
OLD | NEW |