mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 09:58:32 +00:00
[web] improve requestanimationframe test.
This test is flaky and causes timeouts 70% of the time in DDC. The reasons are not clear at the moment, but I noticed that the test was not properly using async-helper. This change may help improve our investigation in the near future. Change-Id: I834265dd6b898098ee7d5210ffe68ef0a6db74a0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332280 Reviewed-by: Srujan Gaddam <srujzs@google.com> Commit-Queue: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
parent
7cf0603208
commit
c439c97b80
|
@ -7,7 +7,8 @@ library RequestAnimationFrameTest;
|
|||
import 'dart:async';
|
||||
import 'dart:html';
|
||||
|
||||
import 'package:expect/minitest.dart';
|
||||
import 'package:async_helper/async_helper.dart';
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
Future testOneShot() async {
|
||||
final done = new Completer();
|
||||
|
@ -34,9 +35,9 @@ Future testTwoShot() async {
|
|||
Future testCancel1() async {
|
||||
final done = new Completer();
|
||||
var frame1 = window.requestAnimationFrame((timestamp1) {
|
||||
fail('Should have been cancelled');
|
||||
Expect.fail('Should have been cancelled');
|
||||
});
|
||||
var frame2 = window.requestAnimationFrame(done.complete);
|
||||
window.requestAnimationFrame(done.complete);
|
||||
window.cancelAnimationFrame(frame1);
|
||||
await done.future;
|
||||
}
|
||||
|
@ -44,18 +45,20 @@ Future testCancel1() async {
|
|||
Future testCancel2() async {
|
||||
final done1 = new Completer();
|
||||
final done2 = new Completer();
|
||||
var frame1 = window.requestAnimationFrame(done1.complete);
|
||||
window.requestAnimationFrame(done1.complete);
|
||||
var frame2 = window.requestAnimationFrame((timestamp2) {
|
||||
fail('Should have been cancelled');
|
||||
Expect.fail('Should have been cancelled');
|
||||
});
|
||||
var frame3 = window.requestAnimationFrame(done2.complete);
|
||||
window.requestAnimationFrame(done2.complete);
|
||||
window.cancelAnimationFrame(frame2);
|
||||
await Future.wait([done1.future, done2.future]);
|
||||
}
|
||||
|
||||
main() async {
|
||||
await testOneShot();
|
||||
await testTwoShot();
|
||||
await testCancel1();
|
||||
await testCancel2();
|
||||
main() {
|
||||
asyncTest(() async {
|
||||
await testOneShot();
|
||||
await testTwoShot();
|
||||
await testCancel1();
|
||||
await testCancel2();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -9,7 +9,8 @@ library RequestAnimationFrameTest;
|
|||
import 'dart:async';
|
||||
import 'dart:html';
|
||||
|
||||
import 'package:expect/minitest.dart';
|
||||
import 'package:async_helper/async_helper.dart';
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
Future testOneShot() async {
|
||||
final done = new Completer();
|
||||
|
@ -36,9 +37,9 @@ Future testTwoShot() async {
|
|||
Future testCancel1() async {
|
||||
final done = new Completer();
|
||||
var frame1 = window.requestAnimationFrame((timestamp1) {
|
||||
fail('Should have been cancelled');
|
||||
Expect.fail('Should have been cancelled');
|
||||
});
|
||||
var frame2 = window.requestAnimationFrame(done.complete);
|
||||
window.requestAnimationFrame(done.complete);
|
||||
window.cancelAnimationFrame(frame1);
|
||||
await done.future;
|
||||
}
|
||||
|
@ -46,18 +47,20 @@ Future testCancel1() async {
|
|||
Future testCancel2() async {
|
||||
final done1 = new Completer();
|
||||
final done2 = new Completer();
|
||||
var frame1 = window.requestAnimationFrame(done1.complete);
|
||||
window.requestAnimationFrame(done1.complete);
|
||||
var frame2 = window.requestAnimationFrame((timestamp2) {
|
||||
fail('Should have been cancelled');
|
||||
Expect.fail('Should have been cancelled');
|
||||
});
|
||||
var frame3 = window.requestAnimationFrame(done2.complete);
|
||||
window.requestAnimationFrame(done2.complete);
|
||||
window.cancelAnimationFrame(frame2);
|
||||
await Future.wait([done1.future, done2.future]);
|
||||
}
|
||||
|
||||
main() async {
|
||||
await testOneShot();
|
||||
await testTwoShot();
|
||||
await testCancel1();
|
||||
await testCancel2();
|
||||
main() {
|
||||
asyncTest(() async {
|
||||
await testOneShot();
|
||||
await testTwoShot();
|
||||
await testCancel1();
|
||||
await testCancel2();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue