OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
4 <script> | 4 <script> |
5 | 5 |
6 promise_test(function() { | 6 promise_test(function() { |
7 return navigator.mediaDevices.getUserMedia({audio: true}) | 7 return navigator.mediaDevices.getUserMedia({audio: true}) |
8 .then(function(s) { | 8 .then(function(s) { |
9 settings = s.getAudioTracks()[0].getSettings(); | 9 settings = s.getAudioTracks()[0].getSettings(); |
10 assert_greater_than(Object.keys(settings).length, 0); | 10 assert_greater_than(Object.keys(settings).length, 0); |
(...skipping 15 matching lines...) Expand all Loading... |
26 assert_greater_than(Object.keys(settings).length, 0); | 26 assert_greater_than(Object.keys(settings).length, 0); |
27 assert_true('frameRate' in settings, | 27 assert_true('frameRate' in settings, |
28 'Frame rate missing: ' + JSON.stringify(settings)); | 28 'Frame rate missing: ' + JSON.stringify(settings)); |
29 assert_true('width' in settings, | 29 assert_true('width' in settings, |
30 'Width missing: ' + JSON.stringify(settings)); | 30 'Width missing: ' + JSON.stringify(settings)); |
31 assert_true('height' in settings, | 31 assert_true('height' in settings, |
32 'Height missing: ' + JSON.stringify(settings)); | 32 'Height missing: ' + JSON.stringify(settings)); |
33 }); | 33 }); |
34 }, 'A video track returns frame rate'); | 34 }, 'A video track returns frame rate'); |
35 | 35 |
| 36 promise_test(function() { |
| 37 return navigator.mediaDevices.getUserMedia( |
| 38 {video: {facingMode: {exact: "user"}}}) |
| 39 .then(function(s) { |
| 40 assert_unreached(); |
| 41 }) |
| 42 .catch(function(e) { |
| 43 assert_equals(e.name, 'Error'); |
| 44 }); |
| 45 }, 'With no fake device, asking for user-facing device rejects'); |
| 46 |
| 47 promise_test(function() { |
| 48 return internals.addFakeDevice({kind: "video"}, |
| 49 {facingMode: {exact: "user"}}) |
| 50 .then(function() { |
| 51 navigator.mediaDevices.getUserMedia({video: {facingMode: {exact: "user"}}}) |
| 52 }) |
| 53 .then(function(s) { |
| 54 settings = s.getVideoTracks()[0].getSettings(); |
| 55 assert_equals(settings.facingMode, "user"); |
| 56 }) |
| 57 .catch(function(e) { |
| 58 console.log('Fake devices are not functional yet.'); |
| 59 // TODO(hta): Finish creation of fake devices. Until then, accept failure. |
| 60 // crbug.com/678561 |
| 61 assert_equals(e.name, 'TypeError', "Check crbug.com/678561"); |
| 62 }); |
| 63 }, 'With a fake user-facing device, facing mode is matched') |
| 64 |
36 </script> | 65 </script> |
OLD | NEW |