chromium/chrome/test/data/extensions/hangout_services_test.html

<!--
Copyright 2013 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.

A web page intended for both manual and automated end-to-end testing of
the Hangout Services component extension and the APIs it uses.
-->
<html>
<head>
<title>Hangout Services Test Page</title>
<script src="hangout_services_test.js">
</script>
<script>
//
// UI glue and other code that needs to use the document. Leaving in
// HTML file with the UI elements it is using.
//

// Populates UI elements with initial contents.
function populate() {
  navigator.mediaDevices.enumerateDevices().then(populateSources);
}

function populateSources(devices) {
  var select = document.getElementById('selectSource');
  for (var i = 0; i < devices.length; ++i) {
    var device = devices[i];
    if (device.kind == 'audioinput') {
      var option = document.createElement('option');
      option.value = device.deviceId;
      option.text = device.label + ' (' + device.deviceId + ')';
      select.add(option);
    }
  }
}

//
// Manual tests.
//

function manualTestChooseDesktopMedia() {
  chooseDesktopMedia(function(results) {
      alert('Cancel ID: ' + results.cancelId +
            ', stream ID: ' + results.streamId);
    });
}

// Browser test scaffolding. Starts the test run from a browser
// test. Sets the document title to 'success' or 'failure' when the
// test completes.
function browsertestRunAllTests() {
  runAllTests(function(results) {
      if (results == '') {
	document.title = 'success';
      } else {
	console.log('Test failed:');
	console.log(results);
	document.title = 'failure';
      }
    });
}
</script>
</head>
<body onload="populate()">
<audio id="audio" src="long_audio.ogg" controls autoplay></audio>
<br/>

<p>
Run all automated tests manually (empty results indicate success):
<input type="submit" value="Run"
       onclick="runAllTests(function(results) { alert('Results:\n' +
       results); });"><br/>
Manually test choosing desktop media:
<input type="submit" value="Choose Media"
       onclick="manualTestChooseDesktopMedia();"><br/>
</body>
</html>