Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / webaudio / audiochannelmerger-disconnect.html
blobc100b8f4d629e8f188ba8484cd97c2aba019e9a7
1 <!DOCTYPE html>
2 <html>
4 <head>
5 <script src="../resources/js-test.js"></script>
6 <script src="resources/compatibility.js"></script>
7 <script src="resources/audio-testing.js"></script>
8 </head>
10 <body>
11 <script>
12 description('Test ChannelMergerNode behavior on dynamic input change.');
13 window.jsTestIsAsync = true;
15 var sampleRate = 44100;
16 var numberOfChannels = 2;
18 // The test needs the long render length (20 seconds) to capture the
19 // disconnection which happens after starting the rendering.
20 var renderLength = sampleRate * 20;
22 var audit = Audit.createTaskRunner();
24 // Task: Check if the merger outputs a silent channel when an input is
25 // disconnected.
26 audit.defineTask('silent-disconnect', function (done) {
27 var context = new OfflineAudioContext(
28 numberOfChannels, renderLength, sampleRate
30 var merger = context.createChannelMerger();
31 var source1 = context.createBufferSource();
32 var source2 = context.createBufferSource();
34 // Create and assign a mono testing buffer.
35 var bufferDCOffset = createTestingAudioBuffer(context, 1, renderLength);
36 source1.buffer = bufferDCOffset;
37 source2.buffer = bufferDCOffset;
39 // Connect the output of source into the 4th input of merger. The merger
40 // should produce 6 channel output.
41 source1.connect(merger, 0, 0);
42 source2.connect(merger, 0, 1);
43 merger.connect(context.destination);
44 source1.start();
45 source2.start();
47 // When the rendering begins, disconnect |source2| as soon as possible.
48 context.onstatechange = function () {
49 if (context.state === 'running')
50 source2.disconnect();
53 context.startRendering().then(function (buffer) {
55 // The entire first channel of the output should be 1.
56 Should('Channel #0', buffer.getChannelData(0)).beConstantValueOf(1);
58 // The second channel should contain 1, and 0 after the disconnection.
59 Should('Channel #1', buffer.getChannelData(1)).containValues([1, 0]);
61 done();
62 });
63 });
65 audit.defineTask('finish', function (done) {
66 finishJSTest();
67 done();
68 });
70 audit.runTasks(
71 'silent-disconnect',
72 'finish'
75 successfullyParsed = true;
76 </script>
77 </body>
79 </html>