b=890528 add more documentation and make length optional when createExpectedBuffers is present r=ehsan

--HG--
extra : transplant_source : R%7DJo%87%0C%0D%0FuX%C4%BC%C0%95%08b%5D%DA%D1%BF
This commit is contained in:
Karl Tomlinson 2013-09-02 11:27:44 +12:00
parent 402dc6daeb
commit b7844721cf

View File

@ -68,8 +68,6 @@ function getEmptyBuffer(context, length) {
* This function assumes that the test file defines a single gTest variable with
* the following properties and methods:
*
* + length: mandatory property equal to the total number of frames which we
* are waiting to see in the output.
* + numberOfChannels: optional property which specifies the number of channels
* in the output. The default value is 2.
* + createGraph: mandatory method which takes a context object and does
@ -84,9 +82,17 @@ function getEmptyBuffer(context, length) {
* returns either one expected buffer or an array of
* them, designating what is expected to be observed
* in the output. If omitted, the output is expected
* to be silence. The sum of the length of the expected
* buffers should be equal to gTest.length. This
* function is guaranteed to be called before createGraph.
* to be silence. All buffers must have the same
* length, which must be a bufferSize supported by
* ScriptProcessorNode. This function is guaranteed
* to be called before createGraph.
* + length: property equal to the total number of frames which we are waiting
* to see in the output, mandatory if createExpectedBuffers is not
* provided, in which case it must be a bufferSize supported by
* ScriptProcessorNode (256, 512, 1024, 2048, 4096, 8192, or 16384).
* If createExpectedBuffers is provided then this must be equal to
* the number of expected buffers * the expected buffer length.
*
* + skipOfflineContextTests: optional. when true, skips running tests on an offline
* context by circumventing testOnOfflineContext.
*/
@ -120,7 +126,9 @@ function runTest()
"Correct number of channels for expected buffer " + i);
expectedFrames += expectedBuffers[i].length;
}
is(expectedFrames, gTest.length, "Correct number of expected frames");
if (gTest.length && !gTest.createExpectedBuffers) {
is(expectedFrames, gTest.length, "Correct number of expected frames");
}
if (gTest.createGraphAsync) {
gTest.createGraphAsync(context, function(nodeToInspect) {