mockclock.js
No description.

File Location

/goog/testing/mockclock.js

Classes

goog.testing.MockClock
Class for unit testing code that uses setTimeout and clearTimeout. NOTE: If you are using MockClock to test code that makes use of goog.fx.Animation, then you must either: 1. Install and dispose of the MockClock in setUpPage() and tearDownPage() respectively (rather than setUp()/tearDown()). or 2. Ensure that every test clears the animation queue by calling mockClock.tick(x) at the end of each test function (where `x` is large enough to complete all animations). Otherwise, if any animation is left pending at the time that MockClock.dispose() is called, that will permanently prevent any future animations from playing on the page.

Public Protected Private

Global Functions

goog.testing.MockClock.insert_(timeoutqueue)
Inserts a timer descriptor into a descending-order queue. Later-inserted duplicates appear at lower indices. For example, the asterisk in (5,4,*,3,2,1) would be the insertion point for 3.
Arguments:
timeout : Object
The timeout to insert, with numerical runAtMillis property.
queue : Array.<Object>
The queue to insert into, with each element having a numerical runAtMillis property.
code »

Directory testing

File Reference