OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <body> | 3 <body> |
4 <script src="../resources/testharness.js"></script> | 4 <script src="../resources/testharness.js"></script> |
5 <script src="../resources/testharnessreport.js"></script> | 5 <script src="../resources/testharnessreport.js"></script> |
6 <script> | 6 <script> |
7 | 7 |
8 var previousOrientation = screen.orientation; | 8 var previousOrientation = screen.orientation; |
9 | 9 |
10 test(function() { | 10 test(function() { |
11 var caught = false; | 11 var caught = false; |
12 try { | 12 try { |
13 screen.unlockOrientation(); | 13 screen.orientation.unlock(); |
14 } catch (e) { | 14 } catch (e) { |
15 caught = true; | 15 caught = true; |
16 } | 16 } |
17 | 17 |
18 assert_false(caught); | 18 assert_false(caught); |
19 }, "Test that unlockOrientation() doesn't throw when there is no lock"); | 19 }, "Test that screen.orientation.unlock() doesn't throw when there is no lock"); |
20 | 20 |
21 test(function() { | 21 test(function() { |
22 [ 'any', 'portrait', 'landscape', 'portrait-primary', 'portrait-secondary', | 22 [ 'any', 'portrait', 'landscape', 'portrait-primary', 'portrait-secondary', |
23 'landscape-primary', 'landscape-secondary' ].forEach(function(orientation)
{ | 23 'landscape-primary', 'landscape-secondary' ].forEach(function(orientation)
{ |
24 var pending = true; | 24 var pending = true; |
25 screen.lockOrientation(orientation).then(function() { | 25 screen.orientation.lock(orientation).then(function() { |
26 pending = false; | 26 pending = false; |
27 }, function() { | 27 }, function() { |
28 pending = false; | 28 pending = false; |
29 }); | 29 }); |
30 | 30 |
31 assert_true(pending); | 31 assert_true(pending); |
32 }); | 32 }); |
33 }, "Test that screen.lockOrientation returns a pending promise."); | 33 }, "Test that screen.orientation.lock returns a pending promise."); |
34 | 34 |
35 test(function() { | 35 test(function() { |
36 assert_equals(screen.orientation, previousOrientation); | 36 assert_equals(screen.orientation, previousOrientation); |
37 }, "Test that screen.lockOrientation() is actually async"); | 37 }, "Test that screen.orientation.lock() is actually async"); |
38 | 38 |
39 test(function() { | 39 test(function() { |
40 var caught = false; | 40 var caught = false; |
41 try { | 41 try { |
42 screen.unlockOrientation(); | 42 screen.orientation.unlock(); |
43 } catch (e) { | 43 } catch (e) { |
44 caught = true; | 44 caught = true; |
45 } | 45 } |
46 | 46 |
47 assert_false(caught); | 47 assert_false(caught); |
48 }, "Test that unlockOrientation doesn't throw when there is a lock"); | 48 }, "Test that screen.unlock() doesn't throw when there is a lock"); |
49 | 49 |
50 </script> | 50 </script> |
51 </body> | 51 </body> |
52 </html> | 52 </html> |
OLD | NEW |