B2G/gecko/netwerk/test/httpserver/test/test_async_response_sending.js
/**
 * Represents a sequence of interactions to perform with a copier, in a given
 * order and at the desired time intervals.
 *
 * @param name : string
 *   test name, used in debugging output
 */
Represents a sequence of interactions to perform with a copier, in a given
order and at the desired time intervals.

@param name : string
test name, used in debugging output
Represents a sequence of interactions to perform with a copier in a given order and at the desired time intervals . @param name : string test name used in debugging output
function CopyTest(name, next)
{
  this.name = name;
  this._done = next;
  var sourcePipe = new CustomPipe(name + "-source");
  this._source = sourcePipe.inputStream;
  this._copyableDataStream = sourcePipe.outputStream;
  var sinkPipe = new CustomPipe(name + "-sink");
  this._sink = sinkPipe.outputStream;
  this._copiedDataStream = sinkPipe.inputStream;
  this._copiedDataStream.disableReadabilityLimit();
  this._waitingForData = false;
  this._expectedData = undefined;
  this._receivedData = [];
  this._expectedStatus = -1;
  this._actualStatus = -1;
  this._lastQuantum = [];
  this._allDataWritten = false;
  this._copyingFinished = false;
  this._currentTask = 0;
  this._tasks = [];
  this._copier =
    new WriteThroughCopier(this._source, this._sink, this, null);
  this._waitForWrittenData();
}
function CopyTest ( name , next ) { this . name = name ; this . _done = next ; var sourcePipe = new CustomPipe ( name + "-source" ) ; this . _source = sourcePipe . inputStream ; this . _copyableDataStream = sourcePipe . outputStream ; var sinkPipe = new CustomPipe ( name + "-sink" ) ; this . _sink = sinkPipe . outputStream ; this . _copiedDataStream = sinkPipe . inputStream ; this . _copiedDataStream . disableReadabilityLimit ( ) ; this . _waitingForData = false ; this . _expectedData = undefined ; this . _receivedData = [ ] ; this . _expectedStatus = - 1 ; this . _actualStatus = - 1 ; this . _lastQuantum = [ ] ; this . _allDataWritten = false ; this . _copyingFinished = false ; this . _currentTask = 0 ; this . _tasks = [ ] ; this . _copier = new WriteThroughCopier ( this . _source , this . _sink , this , null ) ; this . _waitForWrittenData ( ) ; }
Represents a sequence of interactions to perform with a copier, in a given
 order and at the desired time intervals.
Represents a sequence of interactions to perform with a copier in a given order and at the desired time intervals .
/** Name used in debugging output. */ /** A function called when the test completes. */ /** The source of data for the copier to copy. */ /**
   * The sink to which to write data which will appear in the copier's source.
   */ /** The sink to which the copier copies data. */ /** Input stream from which to read data the copier's written to its sink. */ /**
   * True if there's a callback waiting to read data written by the copier to
   * its output, from the input end of the pipe representing the copier's sink.
   */ /**
   * An array of the bytes of data expected to be written to output by the
   * copier when this test runs.
   */ /** Array of bytes of data received so far. */ /** The expected final status returned by the copier. */ /** The actual final status returned by the copier. */ /** The most recent sequence of bytes written to output by the copier. */ /**
   * True iff we've received the last quantum of data written to the sink by the
   * copier.
   */ /**
   * True iff the copier has notified its associated stream listener of
   * completion.
   */ /** Index of the next task to execute while driving the copier. */ /** Array containing all tasks to run. */ /** The copier used by this test. */ // Start watching for data written by the copier to the sink.