| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <body> | |
| 4 <script src="../../../resources/testharness.js"></script> | |
| 5 <script src="../../../resources/testharnessreport.js"></script> | |
| 6 <script> | |
| 7 | |
| 8 var previousOrientation = screen.orientation; | |
| 9 | |
| 10 test(function() { | |
| 11 screen.orientation.unlock(); | |
| 12 }, "Test that screen.orientation.unlock() doesn't throw when there is no lock"); | |
| 13 | |
| 14 async_test(function(t) { | |
| 15 var orientations = ['any', 'portrait', 'landscape', 'portrait-secondary', | |
| 16 'landscape-primary', 'landscape-secondary', 'portrait-pr
imary']; | |
| 17 | |
| 18 setOrientation = function(idx) { | |
| 19 if( idx == orientations.length) { | |
| 20 screen.orientation.unlock(); | |
| 21 t.done(); | |
| 22 return; | |
| 23 } | |
| 24 (function(i) { | |
| 25 screen.orientation.lock(orientations[i]).then(function() { | |
| 26 setOrientation(i+1); | |
| 27 },function() {}); | |
| 28 })(idx); | |
| 29 }; | |
| 30 | |
| 31 setOrientation(0); | |
| 32 | |
| 33 }, "Test that screen.orientation.lock returns a pending promise."); | |
| 34 | |
| 35 test(function() { | |
| 36 assert_equals(screen.orientation, previousOrientation); | |
| 37 }, "Test that screen.orientation.lock() is actually async"); | |
| 38 | |
| 39 </script> | |
| 40 </body> | |
| 41 </html> | |
| OLD | NEW |