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, leaving in HTML file with the UI elements it is using. | 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 // | 18 // |
18 | 19 |
19 // Populates UI elements with initial contents. | 20 // Populates UI elements with initial contents. |
20 function populate() { | 21 function populate() { |
21 populateSinks(); | 22 populateSinks(); |
22 MediaStreamTrack.getSources(populateSources); | 23 MediaStreamTrack.getSources(populateSources); |
23 } | 24 } |
24 | 25 |
25 // Populates the select box with information on all sinks and the | 26 // Populates the select box with information on all sinks and the |
26 // currently selected sink. | 27 // currently selected sink. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 populateSinks(); | 63 populateSinks(); |
63 }); | 64 }); |
64 } | 65 } |
65 | 66 |
66 function getAssociatedDeviceFromSelection() { | 67 function getAssociatedDeviceFromSelection() { |
67 var select = document.getElementById('selectSource'); | 68 var select = document.getElementById('selectSource'); |
68 getAssociatedSink(select.value, function(sinkId) { | 69 getAssociatedSink(select.value, function(sinkId) { |
69 alert('Associated sink ID: ' + sinkId); | 70 alert('Associated sink ID: ' + sinkId); |
70 }); | 71 }); |
71 } | 72 } |
| 73 |
| 74 // |
| 75 // Manual tests. |
| 76 // |
| 77 |
| 78 function manualTestChooseDesktopMedia() { |
| 79 chooseDesktopMedia(function(results) { |
| 80 alert('Cancel ID: ' + results.cancelId + |
| 81 ', stream ID: ' + results.streamId); |
| 82 }); |
| 83 } |
| 84 |
| 85 function manualTestListenForSinksChangedEvent() { |
| 86 listenForSinksChangedEvent(function(msg) { |
| 87 if (msg['eventName'] && msg['eventName'] == 'onSinksChanged') |
| 88 alert('Got onSinksChanged event.'); |
| 89 }); |
| 90 } |
| 91 |
| 92 // Browser test scaffolding. Starts the test run from a browser |
| 93 // test. Sets the document title to 'success' or 'failure' when the |
| 94 // test completes. |
| 95 function browsertestRunAllTests() { |
| 96 runAllTests(function(results) { |
| 97 if (results == '') { |
| 98 document.title = 'success'; |
| 99 } else { |
| 100 console.log('Test failed:'); |
| 101 console.log(results); |
| 102 document.title = 'failure'; |
| 103 } |
| 104 }); |
| 105 } |
72 </script> | 106 </script> |
73 </head> | 107 </head> |
74 <body onload="populate()"> | 108 <body onload="populate()"> |
75 <audio id="audio" src="long_audio.ogg" controls autoplay></audio> | 109 <audio id="audio" src="long_audio.ogg" controls autoplay></audio> |
76 <br/> | 110 <br/> |
77 | 111 |
78 Audio output devices, along with currently selected device. Click to change:<br/
> | 112 Audio output devices, along with currently selected device. Click to change:<br/
> |
79 <select style="width:100%" id="select" size=10 | 113 <select style="width:100%" id="select" size=10 |
80 onClick="setActiveSinkFromSelection()"></select> | 114 onClick="setActiveSinkFromSelection()"></select> |
81 <br/> | 115 <br/> |
82 | 116 |
83 Audio input devices. Click to get associated output device ID:<br/> | 117 Audio input devices. Click to get associated output device ID:<br/> |
84 <select size=10 id="selectSource" onClick="getAssociatedDeviceFromSelection()"> | 118 <select size=10 id="selectSource" onClick="getAssociatedDeviceFromSelection()"> |
85 </select> | 119 </select> |
86 | 120 |
87 <p> | 121 <p> |
88 Run all automated tests manually (empty results indicate success): | 122 Run all automated tests manually (empty results indicate success): |
89 <input type="submit" value="Run" | 123 <input type="submit" value="Run" |
90 onclick="runAllTests(function(results) { alert('Results:\n' + | 124 onclick="runAllTests(function(results) { alert('Results:\n' + |
91 results); });"><br/> | 125 results); });"><br/> |
92 Manually test choosing desktop media: | 126 Manually test choosing desktop media: |
93 <input type="submit" value="Choose Media" | 127 <input type="submit" value="Choose Media" |
94 onclick="manualTestChooseDesktopMedia();"><br/> | 128 onclick="manualTestChooseDesktopMedia();"><br/> |
95 Start listening for onSinksChanged event (manual test): | 129 Start listening for onSinksChanged event (manual test): |
96 <input type="submit" value="Start listening" | 130 <input type="submit" value="Start listening" |
97 onclick="manualTestListenForSinksChangedEvent();"><br/> | 131 onclick="manualTestListenForSinksChangedEvent();"><br/> |
98 </body> | 132 </body> |
99 </html> | 133 </html> |
OLD | NEW |