Chromium Code Reviews| Index: tests/lib/async/catch_errors13_test.dart |
| diff --git a/tests/lib/async/catch_errors13_test.dart b/tests/lib/async/catch_errors13_test.dart |
| index 0889f2e19340878fa3facd825b97276f41e74842..73f52e3bd71f7cfe21518e91ec6283179aa80e96 100644 |
| --- a/tests/lib/async/catch_errors13_test.dart |
| +++ b/tests/lib/async/catch_errors13_test.dart |
| @@ -19,16 +19,28 @@ main() { |
| // Test that errors are caught by nested `catchErrors`. Also uses |
| // `scheduleMicrotask` in the body of a Timer. |
| + bool outerTimerRan = false; |
| + int outerTimerCounterDelayCount = 0; |
| catchErrors(() { |
| events.add("catch error entry"); |
| catchErrors(() { |
| events.add("catch error entry2"); |
| Timer.run(() { throw "timer error"; }); |
| - new Timer(const Duration(milliseconds: 50), |
| - () { |
| - scheduleMicrotask(() { throw "scheduleMicrotask"; }); |
| - throw "delayed error"; |
| - }); |
| + |
| + void runDelayed() { |
| + new Timer(const Duration(milliseconds: 10), |
| + () { |
| + if (outerTimerRan) { |
| + scheduleMicrotask(() { throw "scheduleMicrotask"; }); |
| + throw "delayed error"; |
| + } else if (outerTimerCounterDelayCount < 100) { |
|
sra1
2013/11/08 00:09:02
What is significant about "100" ?
It seems to me
floitsch
2013/11/08 00:19:52
I prefer making it deterministic. Added a comment.
|
| + outerTimerCounterDelayCount++; |
| + runDelayed(); |
| + } |
| + }); |
| + } |
| + |
| + runDelayed(); |
| }).listen((x) { |
| events.add(x); |
| if (x == "scheduleMicrotask") { |
| @@ -36,7 +48,10 @@ main() { |
| } |
| }); |
| events.add("after inner"); |
| - Timer.run(() { throw "timer outer"; }); |
| + Timer.run(() { |
| + outerTimerRan = true; |
| + throw "timer outer"; |
| + }); |
| throw "inner throw"; |
| }).listen((x) { |
| events.add(x); |