content/media/test/test_mediarecorder_creation.html

Fri, 16 Jan 2015 04:50:19 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 04:50:19 +0100
branch
TOR_BUG_9701
changeset 13
44a2da4a2ab2
permissions
-rw-r--r--

Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <title>Test MediaRecorder Creation</title>
michael@0 5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 7 <script type="text/javascript" src="manifest.js"></script>
michael@0 8 </head>
michael@0 9 <body>
michael@0 10 <pre id="test">
michael@0 11 <script class="testbody" type="text/javascript">
michael@0 12 var manager = new MediaTestManager;
michael@0 13
michael@0 14 /**
michael@0 15 * Starts a test on every media recorder file included to check that
michael@0 16 * a media recorder object created with a stream derived from a media
michael@0 17 * element with that file produces the correct starting attribute values.
michael@0 18 */
michael@0 19 function startTest(test, token) {
michael@0 20 var element = document.createElement('audio');
michael@0 21
michael@0 22 element.token = token;
michael@0 23 manager.started(token);
michael@0 24
michael@0 25 element.src = test.name;
michael@0 26 element.test = test;
michael@0 27 element.stream = element.mozCaptureStreamUntilEnded();
michael@0 28
michael@0 29 var mediaRecorder = new MediaRecorder(element.stream);
michael@0 30
michael@0 31 is(mediaRecorder.stream, element.stream,
michael@0 32 'Stream should be provided stream on creation');
michael@0 33 is(mediaRecorder.mimeType, '',
michael@0 34 'mimeType should be an empty string on creation');
michael@0 35 is(mediaRecorder.state, 'inactive',
michael@0 36 'state should be inactive on creation');
michael@0 37
michael@0 38 manager.finished(token);
michael@0 39 }
michael@0 40
michael@0 41 manager.runTests(gMediaRecorderTests, startTest);
michael@0 42 </script>
michael@0 43 </pre>
michael@0 44 </body>
michael@0 45 </html>

mercurial