Home

# Class goog.testing.ContinuationTestCase

Constructs a test case that supports tests with continuations. Test functions may issue "wait" commands that suspend the test temporarily and continue once the wait condition is met.

extends goog.testing.TestCase

Instance Method Summary
| `addStep_(?Function func) ⇒ ?goog.testing.ContinuationTestCase.Step` Creates a new asynchronous test step which will be added to the current test phase.
| `createNextTest_() ⇒ ?goog.testing.ContinuationTestCase.Test` Creates the next test in the queue.
| `cycleTests()` Cycles through the tests, breaking out using a setTimeout if the execution time has execeeded {@link #MAX_RUN_TIME}.
| `enableWaitFunctions_(boolean enable)` Enables or disables the wait functions in the global scope.
| `finalize()` Finalizes the test case, called when the tests have finished executing.
| `finishTest_()` Cleans up a finished test and cycles to the next test.
| `handleComplete_(?goog.testing.ContinuationTestCase.Step step)` Handles completion of a step's wait condition. Advances the test, allowing the step's test method to run.
| `handleTimeout_(?goog.testing.ContinuationTestCase.Step step, number duration)` Handles the timeout event for a step that has exceeded the maximum time. This causes the current test to fail.
| `runNextStep_()` Executes the next step in the current phase, advancing through each phase as all steps are completed.
| `runTests()` Executes each of the tests. Overridable by the individual test case. This allows test cases to defer when the test is actually started. If overridden, finalize must be called by the test to indicate it has finished.
| `testCondition_(?goog.testing.ContinuationTestCase.Step step, ?Function condition, number startTime, number interval, number timeout)` Tests a wait condition and executes the associated test step once the condition is true. If the condition does not become true before the maximum duration, the interval will stop and the test step will fail in the kill timer.
| `waitForCondition(?Function condition, ?Function continuation, number= opt_interval, number= opt_maxTimeout)` Creates a new test step which will run once a condition becomes true. The condition will be polled at a user-specified interval until it becomes true, or until a maximum timeout is reached.
| `waitForEvent((EventTarget|goog.events.EventTarget|null) eventTarget, string eventType, ?Function continuation)` Creates a new test step that will run after an event has fired. If the event does not fire within a reasonable timeout, the test will fail.
| `waitForTimeout(?Function continuation, number= opt_duration)` Creates a new test step that will run after a user-specified timeout.