goog.Disposable | |
goog.testing.MockClock | goog.Disposable |
opt_autoInstall
: boolean=
Install the MockClock at construction time.
|
![]()
Clears a requestAnimationFrame.
Mock implementation for cancelRequestAnimationFrame.
Arguments:
|
code » | ||
![]()
Clears an interval.
Mock implementation for clearInterval.
Arguments:
|
code » | ||
![]()
Clears a timeout.
Mock implementation for clearTimeout.
Arguments:
|
code » | ||
![]()
No description.
|
code » | ||
![]()
Signals that the mock clock has been reset, allowing objects that
maintain their own internal state to reset.
|
code » | ||
No description.
Returns: number
The MockClock's current time in milliseconds.
|
code » | ||
No description.
Returns: number
delay The amount of time between when a timeout is
scheduled to fire and when it actually fires, in milliseconds. May
be negative.
|
code » | ||
No description.
Returns: number
The number of timeouts that have been scheduled.
|
code » | ||
![]()
Installs the MockClock by overriding the global object's implementation of
setTimeout, setInterval, clearTimeout and clearInterval.
|
code » | ||
No description.
Arguments:
Returns: boolean
Whether the timer has been set and not cleared,
independent of the timeout's expiration. In other words, the timeout
could have passed or could be scheduled for the future. Either way,
this function returns true or false depending only on whether the
provided timeoutKey represents a timeout that has been set and not
cleared.
|
code » | ||
![]()
Installs the mocks for requestAnimationFrame and cancelRequestAnimationFrame.
|
code » | ||
Schedules a function to be called when an animation frame is triggered.
Mock implementation for requestAnimationFrame.
|
code » | ||
![]()
Resets the MockClock, removing all timeouts that are scheduled and resets
the fake timer count.
|
code » | ||
![]()
Runs any function that is scheduled before a certain time. Timeouts can
be made to fire early or late if timeoutDelay_ is non-0.
Arguments:
|
code » | ||
![]()
Schedules a function to be run at a certain time.
|
code » | ||
Schedules a function to be called immediately after the current JS
execution.
Mock implementation for setImmediate.
|
code » | ||
Schedules a function to be called every
millis milliseconds.
Mock implementation for setInterval.
|
code » | ||
![]()
Sets the amount of time between when a timeout is scheduled to fire and when
it actually fires.
Arguments:
|
code » | ||
Schedules a function to be called after
millis milliseconds.
Mock implementation for setTimeout.
|
code » | ||
Increments the MockClock's time by a given number of milliseconds, running
any functions that are now overdue.
Arguments:
Returns: number
Current mock time in milliseconds.
|
code » | ||
![]()
Removes the MockClock's hooks into the global object's functions and revert
to their original values.
|
code » |
![]()
Invokes a callback function when this object is disposed. Callbacks are
invoked in the order in which they were added.
Arguments:
|
code » | |||
![]()
Disposes of the object. If the object hasn't already been disposed of, calls
#disposeInternal . Classes that extend goog.Disposable should
override #disposeInternal in order to delete references to COM
objects, DOM nodes, and other disposable objects. Reentrant.
Returns: void
Nothing.
|
code » | |||
![]()
Deletes or nulls out any references to COM objects, DOM nodes, or other
disposable objects. Classes that extend
goog.Disposable should
override this method.
Not reentrant. To avoid calling it twice, it must only be called from the
subclass' disposeInternal method. Everywhere else the public
dispose method must be used.
For example:
mypackage.MyClass = function() { mypackage.MyClass.base(this, 'constructor'); // Constructor logic specific to MyClass. ... }; goog.inherits(mypackage.MyClass, goog.Disposable); mypackage.MyClass.prototype.disposeInternal = function() { // Dispose logic specific to MyClass. ... // Call superclass's disposeInternal at the end of the subclass's, like // in C++, to avoid hard-to-catch issues. mypackage.MyClass.base(this, 'disposeInternal'); }; |
code » | |||
Use
#isDisposed instead.
No description.
Returns: boolean
Whether the object has been disposed of.
|
code » | |||
No description.
Returns: boolean
Whether the object has been disposed of.
|
code » | |||
![]()
Associates a disposable object with this object so that they will be disposed
together.
Arguments:
|
code » |
![]()
No description.
|
Code » | |
![]()
Map of deleted keys. These keys represents keys that were deleted in a
clearInterval, timeoutid -> object.
|
Code » | |
![]()
The current simulated time in milliseconds.
|
Code » | |
![]()
Reverse-order queue of timers to fire.
The last item of the queue is popped off. Insertion happens from the
right. For example, the expiration times for each element of the queue
might be in the order 300, 200, 200.
|
Code » | |
PropertyReplacer instance which overwrites and resets setTimeout,
setInterval, etc. or null if the MockClock is not installed.
|
Code » | |
![]()
Additional delay between the time a timeout was set to fire, and the time
it actually fires. Useful for testing workarounds for this Firefox 2 bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=291386
May be negative.
|
Code » | |
![]()
Count of the number of timeouts made.
|
Code » |
![]()
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.
|
code » |
![]()
Maximum 32-bit signed integer.
Timeouts over this time return immediately in many browsers, due to integer
overflow. Such known browsers include Firefox, Chrome, and Safari, but not
IE.
|
Code » | |
![]()
Default wait timeout for mocking requestAnimationFrame (in milliseconds).
|
Code » | |
![]()
No description.
|
Code » |