Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Unified Diff: tests/html/request_animation_frame_test.dart

Issue 10454031: Add cancelAnimationFrame (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/html/html.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/request_animation_frame_test.dart
diff --git a/tests/html/request_animation_frame_test.dart b/tests/html/request_animation_frame_test.dart
index 62fb5d777f25d78290ec5a6bf2cd99e78aa40dce..15f6919f2130e6d986d46201ae8872e9c3a64fa3 100644
--- a/tests/html/request_animation_frame_test.dart
+++ b/tests/html/request_animation_frame_test.dart
@@ -17,12 +17,38 @@ main() {
test('twoShot', () {
var frame = window.requestAnimationFrame(
- (timestamp1) {
+ expectAsync1((timestamp1) {
window.requestAnimationFrame(
expectAsync1((timestamp2) {
- // Not monotonic on Safari and IE.
- // Expect.isTrue(timestamp2 > timestamp1, 'timestamps ordered');
- }));
+ // Not monotonic on Safari and IE.
+ // Expect.isTrue(timestamp2 > timestamp1, 'timestamps ordered');
+ }));
+ }));
+ });
+
+
+ // How do we test that a callback is never called? We can't wrap the uncalled
+ // callback with 'expectAsync1'. Will request several frames and try
+ // cancelling the one that is not the last.
+ test('cancel1', () {
+ var frame1 = window.requestAnimationFrame(
+ (timestamp1) {
+ throw new Exception('Should have been cancelled');
+ });
+ var frame2 = window.requestAnimationFrame(
+ expectAsync1((timestamp2) { }));
+ window.cancelAnimationFrame(frame1);
+ });
+
+ test('cancel2', () {
+ var frame1 = window.requestAnimationFrame(
+ expectAsync1((timestamp1) { }));
+ var frame2 = window.requestAnimationFrame(
+ (timestamp2) {
+ throw new Exception('Should have been cancelled');
});
+ var frame3 = window.requestAnimationFrame(
+ expectAsync1((timestamp3) { }));
+ window.cancelAnimationFrame(frame2);
});
}
« no previous file with comments | « tests/html/html.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698