Index: tests/html/async_window_test.dart |
diff --git a/tests/html/async_window_test.dart b/tests/html/async_window_test.dart |
index 7410e4976eb6aaabfa6eda8ac18937ac2d0c65bd..1e5544857711c8a23101abe826e361a13170082a 100644 |
--- a/tests/html/async_window_test.dart |
+++ b/tests/html/async_window_test.dart |
@@ -2,32 +2,29 @@ library AsyncWindowTest; |
import '../../pkg/unittest/lib/unittest.dart'; |
import '../../pkg/unittest/lib/html_config.dart'; |
import 'dart:html'; |
-import 'dart:async'; |
main() { |
useHtmlConfiguration(); |
- test('Timer', () { |
- new Timer(const Duration(milliseconds: 10), expectAsync0((){})); |
+ test('Window.setTimeout', () { |
+ window.setTimeout(expectAsync0((){}), 10); |
}); |
- test('Timer.repeating', () { |
+ test('Window.setInterval', () { |
int counter = 0; |
int id = null; |
- new Timer.repeating(const Duration(milliseconds: 10), |
- expectAsyncUntil1( |
- (timer) { |
- if (counter == 3) { |
- counter = 1024; |
- timer.cancel(); |
- // Wait some more time to be sure callback won't be invoked any |
- // more. |
- new Timer(const Duration(milliseconds: 50), expectAsync0((){})); |
- return; |
- } |
- // As callback should have been cleared on 4th invocation, counter |
- // should never be greater than 3. |
- assert(counter < 3); |
- counter++; |
- }, |
- () => counter == 3)); |
+ id = window.setInterval(expectAsyncUntil0( |
+ () { |
+ if (counter == 3) { |
+ counter = 1024; |
+ window.clearInterval(id); |
+ // Wait some more time to be sure callback won't be invoked any more. |
+ window.setTimeout(expectAsync0((){}), 50); |
+ return; |
+ } |
+ // As callback should have been cleared on 4th invocation, counter |
+ // should never be greater than 3. |
+ assert(counter < 3); |
+ counter++; |
+ }, |
+ () => counter == 3), 10); |
}); |
} |