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

Side by Side Diff: LayoutTests/screen_orientation/lockOrientation-basic.html

Issue 374623002: [screen-orientation] Update implementation to match recent spec changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 5 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/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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698