Update web-platform-tests to revision 345300fad3945a5f1441fb2b2001109ca48f36e8

This commit is contained in:
WPT Sync Bot 2019-02-08 20:38:29 -05:00
parent 71ba247942
commit 05db47be0f
109 changed files with 2576 additions and 1228 deletions

View file

@ -22,7 +22,9 @@
// Calculate the index for disconnection.
function getDisconnectIndex(disconnectTime) {
let disconnectIndex = disconnectTime * sampleRate;
return disconnectIndex -= (disconnectIndex) % renderQuantum;
disconnectIndex = renderQuantum *
Math.floor((disconnectIndex + renderQuantum - 1) / renderQuantum);
return disconnectIndex;
}
// Get the index of value change.
@ -35,7 +37,6 @@
// Task 1: test disconnect(AudioParam) method.
audit.define('disconnect(AudioParam)', (task, should) => {
// Creates a buffer source with value [1] and then connect it to two
// gain nodes in series. The output of the buffer source is lowered by
// half
@ -89,14 +90,12 @@
should(channelData, 'Channel #0').containValues([2.25, 1.5]);
should(valueChangeIndex, 'The index of value change')
.beEqualTo(disconnectIndex);
})
.then(() => task.done());
});
// Task 2: test disconnect(AudioParam, output) method.
audit.define('disconnect(AudioParam, output)', (task, should) => {
// Create a 2-channel buffer source with [1, 2] in each channel and
// make a serial connection through gain1 and gain 2. The make the
// buffer source half with a gain node and connect it to a 2-output
@ -168,7 +167,6 @@
valueChangeIndexCh1,
'The index of value change in channel #1')
.beEqualTo(disconnectIndex);
})
.then(() => task.done());
});
@ -191,19 +189,28 @@
gain3.connect(context.destination);
// gain1 is not connected to gain3.gain. Exception should be thrown.
should(function() {
gain1.disconnect(gain3.gain);
}, 'gain1.disconnect(gain3.gain)').throw(DOMException, 'InvalidAccessError');
should(
function() {
gain1.disconnect(gain3.gain);
},
'gain1.disconnect(gain3.gain)')
.throw(DOMException, 'InvalidAccessError');
// When the output index is good but the destination is invalid.
should(function() {
splitter.disconnect(gain1.gain, 1);
}, 'splitter.disconnect(gain1.gain, 1)').throw(DOMException, 'InvalidAccessError');
should(
function() {
splitter.disconnect(gain1.gain, 1);
},
'splitter.disconnect(gain1.gain, 1)')
.throw(DOMException, 'InvalidAccessError');
// When both arguments are wrong, throw IndexSizeError first.
should(function() {
splitter.disconnect(gain1.gain, 2);
}, 'splitter.disconnect(gain1.gain, 2)').throw(DOMException, 'IndexSizeError');
should(
function() {
splitter.disconnect(gain1.gain, 2);
},
'splitter.disconnect(gain1.gain, 2)')
.throw(DOMException, 'IndexSizeError');
task.done();
});

View file

@ -58,7 +58,9 @@
// Calculate the first zero index in the second channel.
let channel1 = buffer.getChannelData(1);
let disconnectIndex = disconnectTime * sampleRate;
disconnectIndex -= (disconnectIndex) % renderQuantum;
disconnectIndex = renderQuantum *
Math.floor(
(disconnectIndex + renderQuantum - 1) / renderQuantum);
let firstZeroIndex = channel1.findIndex(function(element, index) {
if (element === 0)
return index;
@ -70,7 +72,6 @@
should(
firstZeroIndex, 'The index of first zero in the channel #1')
.beEqualTo(disconnectIndex);
})
.then(() => task.done());
});