@@ -14,7 +14,7 @@ import {
1414 tick ,
1515 xit
1616} from 'angular2/test_lib' ;
17- import { PromiseWrapper } from 'angular2/src/facade/async' ;
17+ import { TimerWrapper , PromiseWrapper } from 'angular2/src/facade/async' ;
1818import { BaseException , global } from 'angular2/src/facade/lang' ;
1919import { Parser } from 'angular2/change_detection' ;
2020
@@ -120,7 +120,7 @@ export function main() {
120120 describe ( 'timers' , ( ) => {
121121 it ( 'should run queued zero duration timer on zero tick' , fakeAsync ( ( ) => {
122122 var ran = false ;
123- PromiseWrapper . setTimeout ( ( ) => { ran = true } , 0 ) ;
123+ TimerWrapper . setTimeout ( ( ) => { ran = true } , 0 ) ;
124124
125125 expect ( ran ) . toEqual ( false ) ;
126126
@@ -131,7 +131,7 @@ export function main() {
131131
132132 it ( 'should run queued timer after sufficient clock ticks' , fakeAsync ( ( ) => {
133133 var ran = false ;
134- PromiseWrapper . setTimeout ( ( ) => { ran = true ; } , 10 ) ;
134+ TimerWrapper . setTimeout ( ( ) => { ran = true ; } , 10 ) ;
135135
136136 tick ( 6 ) ;
137137 expect ( ran ) . toEqual ( false ) ;
@@ -142,7 +142,7 @@ export function main() {
142142
143143 it ( 'should run queued timer only once' , fakeAsync ( ( ) => {
144144 var cycles = 0 ;
145- PromiseWrapper . setTimeout ( ( ) => { cycles ++ ; } , 10 ) ;
145+ TimerWrapper . setTimeout ( ( ) => { cycles ++ ; } , 10 ) ;
146146
147147 tick ( 10 ) ;
148148 expect ( cycles ) . toEqual ( 1 ) ;
@@ -156,8 +156,8 @@ export function main() {
156156
157157 it ( 'should not run cancelled timer' , fakeAsync ( ( ) => {
158158 var ran = false ;
159- var id = PromiseWrapper . setTimeout ( ( ) => { ran = true ; } , 10 ) ;
160- PromiseWrapper . clearTimeout ( id ) ;
159+ var id = TimerWrapper . setTimeout ( ( ) => { ran = true ; } , 10 ) ;
160+ TimerWrapper . clearTimeout ( id ) ;
161161
162162 tick ( 10 ) ;
163163 expect ( ran ) . toEqual ( false ) ;
@@ -168,7 +168,7 @@ export function main() {
168168 if ( IS_DARTIUM ) return ;
169169 expect ( ( ) => {
170170 fakeAsync ( ( ) => {
171- PromiseWrapper . setTimeout ( ( ) => { } , 10 ) ;
171+ TimerWrapper . setTimeout ( ( ) => { } , 10 ) ;
172172 } ) ( ) ;
173173 } ) . toThrowError ( '1 timer(s) still in the queue.' ) ;
174174 } ) ;
@@ -178,14 +178,14 @@ export function main() {
178178 if ( IS_DARTIUM ) return ;
179179 expect ( ( ) => {
180180 fakeAsync ( ( ) => {
181- PromiseWrapper . setInterval ( ( ) => { } , 10 ) ;
181+ TimerWrapper . setInterval ( ( ) => { } , 10 ) ;
182182 } ) ( ) ;
183183 } ) . toThrowError ( '1 periodic timer(s) still in the queue.' ) ;
184184 } ) ;
185185
186186 it ( 'should run periodic timers' , fakeAsync ( ( ) => {
187187 var cycles = 0 ;
188- var id = PromiseWrapper . setInterval ( ( ) => { cycles ++ ; } , 10 ) ;
188+ var id = TimerWrapper . setInterval ( ( ) => { cycles ++ ; } , 10 ) ;
189189
190190 tick ( 10 ) ;
191191 expect ( cycles ) . toEqual ( 1 ) ;
@@ -196,13 +196,13 @@ export function main() {
196196 tick ( 10 ) ;
197197 expect ( cycles ) . toEqual ( 3 ) ;
198198
199- PromiseWrapper . clearInterval ( id ) ;
199+ TimerWrapper . clearInterval ( id ) ;
200200 } ) ) ;
201201
202202 it ( 'should not run cancelled periodic timer' , fakeAsync ( ( ) => {
203203 var ran = false ;
204- var id = PromiseWrapper . setInterval ( ( ) => { ran = true ; } , 10 ) ;
205- PromiseWrapper . clearInterval ( id ) ;
204+ var id = TimerWrapper . setInterval ( ( ) => { ran = true ; } , 10 ) ;
205+ TimerWrapper . clearInterval ( id ) ;
206206
207207 tick ( 10 ) ;
208208 expect ( ran ) . toEqual ( false ) ;
@@ -218,9 +218,9 @@ export function main() {
218218 var cycles = 0 ;
219219 var id ;
220220
221- id = PromiseWrapper . setInterval ( ( ) => {
221+ id = TimerWrapper . setInterval ( ( ) => {
222222 cycles ++ ;
223- PromiseWrapper . clearInterval ( id ) ;
223+ TimerWrapper . clearInterval ( id ) ;
224224 } , 10 ) ;
225225
226226 tick ( 10 ) ;
@@ -235,29 +235,29 @@ export function main() {
235235
236236 PromiseWrapper . resolve ( null ) . then ( ( _ ) => log . add ( 'microtask' ) ) ;
237237
238- PromiseWrapper . setTimeout ( ( ) => log . add ( 'timer' ) , 9 ) ;
238+ TimerWrapper . setTimeout ( ( ) => log . add ( 'timer' ) , 9 ) ;
239239
240- var id = PromiseWrapper . setInterval ( ( ) => log . add ( 'periodic timer' ) , 10 ) ;
240+ var id = TimerWrapper . setInterval ( ( ) => log . add ( 'periodic timer' ) , 10 ) ;
241241
242242 expect ( log . result ( ) ) . toEqual ( '' ) ;
243243
244244 tick ( 10 ) ;
245245 expect ( log . result ( ) ) . toEqual ( 'microtask; timer; periodic timer' ) ;
246246
247- PromiseWrapper . clearInterval ( id ) ;
247+ TimerWrapper . clearInterval ( id ) ;
248248 } ) ) ;
249249
250250 it ( 'should process micro-tasks created in timers before next timers' , fakeAsync ( ( ) => {
251251 var log = new Log ( ) ;
252252
253253 PromiseWrapper . resolve ( null ) . then ( ( _ ) => log . add ( 'microtask' ) ) ;
254254
255- PromiseWrapper . setTimeout ( ( ) => {
255+ TimerWrapper . setTimeout ( ( ) => {
256256 log . add ( 'timer' ) ;
257257 PromiseWrapper . resolve ( null ) . then ( ( _ ) => log . add ( 't microtask' ) ) ;
258258 } , 9 ) ;
259259
260- var id = PromiseWrapper . setInterval ( ( ) => {
260+ var id = TimerWrapper . setInterval ( ( ) => {
261261 log . add ( 'periodic timer' ) ;
262262 PromiseWrapper . resolve ( null ) . then ( ( _ ) => log . add ( 'pt microtask' ) ) ;
263263 } , 10 ) ;
@@ -268,7 +268,7 @@ export function main() {
268268 tick ( 10 ) ;
269269 expect ( log . result ( ) ) . toEqual ( 'microtask; timer; t microtask; periodic timer; pt microtask; periodic timer; pt microtask' ) ;
270270
271- PromiseWrapper . clearInterval ( id ) ;
271+ TimerWrapper . clearInterval ( id ) ;
272272 } ) ) ;
273273 } ) ;
274274
0 commit comments