| 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); |
| 11 }); | 11 }); |
| 12 }, 'An audio track returns settings'); | 12 }, 'An audio track returns settings'); |
| 13 | 13 |
| 14 promise_test(function() { | 14 promise_test(function() { |
| 15 return navigator.mediaDevices.getUserMedia({video: true}) | 15 return navigator.mediaDevices.getUserMedia({video: true}) |
| 16 .then(function(s) { | 16 .then(function(s) { |
| 17 settings = s.getVideoTracks()[0].getSettings(); | 17 settings = s.getVideoTracks()[0].getSettings(); |
| 18 assert_greater_than(Object.keys(settings).length, 0); | 18 assert_greater_than(Object.keys(settings).length, 0); |
| 19 }); | 19 }); |
| 20 }, 'A video track returns settings'); | 20 }, 'A video track returns settings'); |
| 21 | 21 |
| 22 promise_test(function() { | 22 promise_test(function() { |
| 23 return navigator.mediaDevices.getUserMedia({audio: true}) |
| 24 .then(function(s) { |
| 25 settings = s.getAudioTracks()[0].getSettings(); |
| 26 assert_greater_than(Object.keys(settings).length, 0); |
| 27 assert_true('deviceId' in settings, |
| 28 'Device ID missing: ' + JSON.stringify(settings)); |
| 29 }); |
| 30 }, 'An audio track returns the expected variables'); |
| 31 |
| 32 promise_test(function() { |
| 23 return navigator.mediaDevices.getUserMedia({video: true}) | 33 return navigator.mediaDevices.getUserMedia({video: true}) |
| 24 .then(function(s) { | 34 .then(function(s) { |
| 25 settings = s.getVideoTracks()[0].getSettings(); | 35 settings = s.getVideoTracks()[0].getSettings(); |
| 26 assert_greater_than(Object.keys(settings).length, 0); | 36 assert_greater_than(Object.keys(settings).length, 0); |
| 37 assert_true('deviceId' in settings, |
| 38 'Device ID missing: ' + JSON.stringify(settings)); |
| 27 assert_true('frameRate' in settings, | 39 assert_true('frameRate' in settings, |
| 28 'Frame rate missing: ' + JSON.stringify(settings)); | 40 'Frame rate missing: ' + JSON.stringify(settings)); |
| 29 assert_true('width' in settings, | 41 assert_true('width' in settings, |
| 30 'Width missing: ' + JSON.stringify(settings)); | 42 'Width missing: ' + JSON.stringify(settings)); |
| 31 assert_true('height' in settings, | 43 assert_true('height' in settings, |
| 32 'Height missing: ' + JSON.stringify(settings)); | 44 'Height missing: ' + JSON.stringify(settings)); |
| 33 }); | 45 }); |
| 34 }, 'A video track returns frame rate'); | 46 }, 'A video track returns the expected variables'); |
| 47 |
| 48 promise_test(function() { |
| 49 return navigator.mediaDevices.getUserMedia({audio: true, video: true}) |
| 50 .then(function(s) { |
| 51 videoSettings = s.getVideoTracks()[0].getSettings(); |
| 52 audioSettings = s.getAudioTracks()[0].getSettings(); |
| 53 assert_not_equals(videoSettings.deviceId, audioSettings.deviceId, |
| 54 'video and audio device IDs should be different') |
| 55 }); |
| 56 }, 'Video and audio device IDs are different'); |
| 35 | 57 |
| 36 promise_test(function() { | 58 promise_test(function() { |
| 37 return navigator.mediaDevices.getUserMedia( | 59 return navigator.mediaDevices.getUserMedia( |
| 38 {video: {facingMode: {exact: "user"}}}) | 60 {video: {facingMode: {exact: "user"}}}) |
| 39 .then(function(s) { | 61 .then(function(s) { |
| 40 assert_unreached(); | 62 assert_unreached(); |
| 41 }) | 63 }) |
| 42 .catch(function(e) { | 64 .catch(function(e) { |
| 43 assert_equals(e.name, 'Error'); | 65 assert_equals(e.name, 'Error'); |
| 44 }); | 66 }); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 56 }) | 78 }) |
| 57 .catch(function(e) { | 79 .catch(function(e) { |
| 58 console.log('Fake devices are not functional yet.'); | 80 console.log('Fake devices are not functional yet.'); |
| 59 // TODO(hta): Finish creation of fake devices. Until then, accept failure. | 81 // TODO(hta): Finish creation of fake devices. Until then, accept failure. |
| 60 // crbug.com/678561 | 82 // crbug.com/678561 |
| 61 assert_equals(e.name, 'TypeError', "Check crbug.com/678561"); | 83 assert_equals(e.name, 'TypeError', "Check crbug.com/678561"); |
| 62 }); | 84 }); |
| 63 }, 'With a fake user-facing device, facing mode is matched') | 85 }, 'With a fake user-facing device, facing mode is matched') |
| 64 | 86 |
| 65 </script> | 87 </script> |
| OLD | NEW |