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

Side by Side Diff: test/codegen/lib/html/request_animation_frame_test.dart

Issue 1930043002: Add all dart:html tests from the sdk to test/codegen. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: ptal Created 4 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 unified diff | Download patch
« no previous file with comments | « test/codegen/lib/html/range_test.dart ('k') | test/codegen/lib/html/resource_data.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library RequestAnimationFrameTest;
6 import 'package:unittest/unittest.dart';
7 import 'package:unittest/html_config.dart';
8 import 'dart:html';
9
10 main() {
11 useHtmlConfiguration();
12
13 test('oneShot', () {
14 var frame = window.requestAnimationFrame(
15 expectAsync((timestamp) { }));
16 });
17
18 test('twoShot', () {
19 var frame = window.requestAnimationFrame(
20 expectAsync((timestamp1) {
21 window.requestAnimationFrame(
22 expectAsync((timestamp2) {
23 // Not monotonic on Safari and IE.
24 // expect(timestamp2, greaterThan(timestamp1),
25 // reason: 'timestamps ordered');
26 }));
27 }));
28 });
29
30
31 // How do we test that a callback is never called? We can't wrap the uncalled
32 // callback with 'expectAsync'. Will request several frames and try
33 // cancelling the one that is not the last.
34 test('cancel1', () {
35 var frame1 = window.requestAnimationFrame(
36 (timestamp1) {
37 throw new Exception('Should have been cancelled');
38 });
39 var frame2 = window.requestAnimationFrame(
40 expectAsync((timestamp2) { }));
41 window.cancelAnimationFrame(frame1);
42 });
43
44 test('cancel2', () {
45 var frame1 = window.requestAnimationFrame(
46 expectAsync((timestamp1) { }));
47 var frame2 = window.requestAnimationFrame(
48 (timestamp2) {
49 throw new Exception('Should have been cancelled');
50 });
51 var frame3 = window.requestAnimationFrame(
52 expectAsync((timestamp3) { }));
53 window.cancelAnimationFrame(frame2);
54 });
55 }
OLDNEW
« no previous file with comments | « test/codegen/lib/html/range_test.dart ('k') | test/codegen/lib/html/resource_data.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698