summaryrefslogtreecommitdiffstats
path: root/dom/media/test/test_mediarecorder_creation.html
blob: 4ce2b6560806c2a3df4cf3ffea8af254324918db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE HTML>
<html>
<head>
  <title>Test MediaRecorder Creation</title>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
  <script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var manager = new MediaTestManager;

/**
 * Starts a test on every media recorder file included to check that
 * a media recorder object created with a stream derived from a media
 * element with that file produces the correct starting attribute values.
 */
function startTest(test, token) {
  var element = document.createElement('audio');

  element.token = token;
  manager.started(token);

  element.src = test.name;
  element.test = test;
  element.stream = element.mozCaptureStreamUntilEnded();

  var mediaRecorder = new MediaRecorder(element.stream);

  is(mediaRecorder.stream, element.stream,
     'Stream should be provided stream on creation');
  is(mediaRecorder.mimeType, '',
     'mimeType should be an empty string on creation');
  is(mediaRecorder.state, 'inactive',
     'state should be inactive on creation');

  manager.finished(token);
}

manager.runTests(gMediaRecorderTests, startTest);
</script>
</pre>
</body>
</html>