| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>enumerateDevices: test that enumerateDevices is present</title> | 4 <title>enumerateDevices: test that enumerateDevices is present</title> |
| 5 <link rel="author" title="Dr Alex Gouaillard" href="mailto:agouaillard@gmail.com
"/> | 5 <link rel="author" title="Dr Alex Gouaillard" href="mailto:agouaillard@gmail.com
"/> |
| 6 <link rel="help" href="https://w3c.github.io/mediacapture-main/#enumerating-devi
ces"> | 6 <link rel="help" href="https://w3c.github.io/mediacapture-main/#enumerating-devi
ces"> |
| 7 <meta name='assert' content='Check that the enumerateDevices() method is present
.'/> | 7 <meta name='assert' content='Check that the enumerateDevices() method is present
.'/> |
| 8 </head> | 8 </head> |
| 9 <body> | 9 <body> |
| 10 <h1 class="instructions" style="display:none">Description</h1> | 10 <h1 class="instructions" style="display:none">Description</h1> |
| 11 <p class="instructions" style="display:none">This test checks for the presence o
f the | 11 <p class="instructions" style="display:none">This test checks for the presence o
f the |
| 12 <code>navigator.mediaDevices.enumerateDevices()</code> method.</p> | 12 <code>navigator.mediaDevices.enumerateDevices()</code> method.</p> |
| 13 <div id='log'></div> | 13 <div id='log'></div> |
| 14 <script src=../../../resources/testharness.js></script> | 14 <script src=/resources/testharness.js></script> |
| 15 <script src=../../../resources/testharnessreport.js></script> | 15 <script src=/resources/testharnessreport.js></script> |
| 16 <script> | 16 <script> |
| 17 "use strict"; | 17 "use strict"; |
| 18 //NOTE ALEX: for completion, a test for ondevicechange event is missing. | 18 //NOTE ALEX: for completion, a test for ondevicechange event is missing. |
| 19 test(function () { | 19 test(function () { |
| 20 assert_true(undefined !== navigator.mediaDevices.enumerateDevices, "navigator.
mediaDevices.enumerateDevices exists"); | 20 assert_true(undefined !== navigator.mediaDevices.enumerateDevices, "navigator.
mediaDevices.enumerateDevices exists"); |
| 21 var p = navigator.mediaDevices.enumerateDevices() | 21 var p = navigator.mediaDevices.enumerateDevices() |
| 22 p.then(function(list){ | 22 p.then(function(list){ |
| 23 for(let mediainfo of list){ | 23 for(let mediainfo of list){ |
| 24 // TODO check the type of mediainfo | 24 // TODO check the type of mediainfo |
| 25 assert_true(undefined !== mediainfo.deviceId, "mediaInfo's deviceId should
exist."); | 25 assert_true(undefined !== mediainfo.deviceId, "mediaInfo's deviceId should
exist."); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 38 } | 38 } |
| 39 } | 39 } |
| 40 }) | 40 }) |
| 41 p.catch(function(err){ | 41 p.catch(function(err){ |
| 42 assert_unreached("A call to enumerateDevices() should never fail."); | 42 assert_unreached("A call to enumerateDevices() should never fail."); |
| 43 }); | 43 }); |
| 44 }, "mediaDevices.enumerateDevices() is present and working on navigator"); | 44 }, "mediaDevices.enumerateDevices() is present and working on navigator"); |
| 45 </script> | 45 </script> |
| 46 </body> | 46 </body> |
| 47 </html> | 47 </html> |
| OLD | NEW |