| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright 2013 The Chromium Authors. All rights reserved. | 2 Copyright 2013 The Chromium Authors. All rights reserved. |
| 3 Use of this source code is governed by a BSD-style license that can be | 3 Use of this source code is governed by a BSD-style license that can be |
| 4 found in the LICENSE file. | 4 found in the LICENSE file. |
| 5 | 5 |
| 6 A web page intended for both manual and automated end-to-end testing of | 6 A web page intended for both manual and automated end-to-end testing of |
| 7 the Hangout Services component extension and the APIs it uses. | 7 the Hangout Services component extension and the APIs it uses. |
| 8 --> | 8 --> |
| 9 <html> | 9 <html> |
| 10 <head> | 10 <head> |
| 11 <title>Hangout Services Test Page</title> | 11 <title>Hangout Services Test Page</title> |
| 12 <script src="hangout_services_test.js"> | 12 <script src="hangout_services_test.js"> |
| 13 </script> | 13 </script> |
| 14 <script> | 14 <script> |
| 15 // | 15 // |
| 16 // UI glue and other code that needs to use the document. Leaving in | 16 // UI glue and other code that needs to use the document. Leaving in |
| 17 // HTML file with the UI elements it is using. | 17 // HTML file with the UI elements it is using. |
| 18 // | 18 // |
| 19 | 19 |
| 20 // Populates UI elements with initial contents. | 20 // Populates UI elements with initial contents. |
| 21 function populate() { | 21 function populate() { |
| 22 populateSinks(); | 22 populateSinks(); |
| 23 MediaStreamTrack.getSources(populateSources); | 23 navigator.mediaDevices.enumerateDevices().then(populateSources); |
| 24 } | 24 } |
| 25 | 25 |
| 26 // Populates the select box with information on all sinks and the | 26 // Populates the select box with information on all sinks and the |
| 27 // currently selected sink. | 27 // currently selected sink. |
| 28 function populateSinks() { | 28 function populateSinks() { |
| 29 var select = document.getElementById('select'); | 29 var select = document.getElementById('select'); |
| 30 while (select.length > 0) | 30 while (select.length > 0) |
| 31 select.remove(0); | 31 select.remove(0); |
| 32 getSinks(function(sinks) { | 32 getSinks(function(sinks) { |
| 33 for (var i = 0; i < sinks.length; ++i) { | 33 for (var i = 0; i < sinks.length; ++i) { |
| 34 var option = document.createElement('option'); | 34 var option = document.createElement('option'); |
| 35 option.value = sinks[i].sinkId; | 35 option.value = sinks[i].sinkId; |
| 36 option.text = sinks[i].sinkLabel + ' (' + sinks[i].sinkId + ')'; | 36 option.text = sinks[i].sinkLabel + ' (' + sinks[i].sinkId + ')'; |
| 37 select.add(option); | 37 select.add(option); |
| 38 } | 38 } |
| 39 getActiveSink(function(sinkId) { | 39 getActiveSink(function(sinkId) { |
| 40 select.value = sinkId; | 40 select.value = sinkId; |
| 41 }); | 41 }); |
| 42 }); | 42 }); |
| 43 } | 43 } |
| 44 | 44 |
| 45 function populateSources(sources) { | 45 function populateSources(devices) { |
| 46 var select = document.getElementById('selectSource'); | 46 var select = document.getElementById('selectSource'); |
| 47 for (var i = 0; i < sources.length; ++i) { | 47 for (var i = 0; i < devices.length; ++i) { |
| 48 var source = sources[i]; | 48 var device = devices[i]; |
| 49 if (source.kind == 'audio') { | 49 if (device.kind == 'audioinput') { |
| 50 var option = document.createElement('option'); | 50 var option = document.createElement('option'); |
| 51 option.value = source.id; | 51 option.value = device.deviceId; |
| 52 option.text = source.label + ' (' + source.id + ')'; | 52 option.text = device.label + ' (' + device.deviceId + ')'; |
| 53 select.add(option); | 53 select.add(option); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 // Sets the currently active sink to the one selected in the select | 58 // Sets the currently active sink to the one selected in the select |
| 59 // box. | 59 // box. |
| 60 function setActiveSinkFromSelection() { | 60 function setActiveSinkFromSelection() { |
| 61 var select = document.getElementById('select'); | 61 var select = document.getElementById('select'); |
| 62 setActiveSink(select.value, function() { | 62 setActiveSink(select.value, function() { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 onclick="runAllTests(function(results) { alert('Results:\n' + | 124 onclick="runAllTests(function(results) { alert('Results:\n' + |
| 125 results); });"><br/> | 125 results); });"><br/> |
| 126 Manually test choosing desktop media: | 126 Manually test choosing desktop media: |
| 127 <input type="submit" value="Choose Media" | 127 <input type="submit" value="Choose Media" |
| 128 onclick="manualTestChooseDesktopMedia();"><br/> | 128 onclick="manualTestChooseDesktopMedia();"><br/> |
| 129 Start listening for onSinksChanged event (manual test): | 129 Start listening for onSinksChanged event (manual test): |
| 130 <input type="submit" value="Start listening" | 130 <input type="submit" value="Start listening" |
| 131 onclick="manualTestListenForSinksChangedEvent();"><br/> | 131 onclick="manualTestListenForSinksChangedEvent();"><br/> |
| 132 </body> | 132 </body> |
| 133 </html> | 133 </html> |
| OLD | NEW |