Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013, 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 import 'dart:async'; | |
| 6 import 'dart:io'; | |
| 7 | |
| 8 import 'package:scheduled_test/scheduled_test.dart'; | |
| 9 | |
| 10 import '../metatest.dart'; | |
| 11 import '../utils.dart'; | |
| 12 | |
| 13 void main() { | |
| 14 metaSetUp(() { | |
| 15 // TODO(nweiz): We used to only increase the timeout to 10s for the Windows | |
| 16 // bots, but the Linux and Mac bots have started taking upwards of 5s when | |
| 17 // running pumpEventQueue, so we're increasing the timeout across the board | |
| 18 // (see issue 9248). | |
| 19 currentSchedule.timeout = new Duration(seconds: 10); | |
| 20 }); | |
| 21 | |
| 22 expectTestsPass('currentSchedule.currentTask returns the current task while ' | |
| 23 'executing a task', () { | |
| 24 test('test', () { | |
| 25 schedule(() => expect('foo', equals('foo')), 'task 1'); | |
| 26 | |
| 27 schedule(() { | |
| 28 expect(currentSchedule.currentTask.description, equals('task 2')); | |
| 29 }, 'task 2'); | |
| 30 | |
| 31 schedule(() => expect('bar', equals('bar')), 'task 3'); | |
| 32 }); | |
| 33 }); | |
| 34 | |
| 35 expectTestsPass('currentSchedule.currentTask is null before the schedule has ' | |
| 36 'started', () { | |
| 37 test('test', () { | |
| 38 schedule(() => expect('foo', equals('foo'))); | |
| 39 | |
| 40 expect(currentSchedule.currentTask, isNull); | |
| 41 }); | |
| 42 }); | |
| 43 | |
| 44 expectTestsPass('currentSchedule.currentTask is null after the schedule has ' | |
| 45 'completed', () { | |
| 46 test('test', () { | |
| 47 schedule(() { | |
| 48 expect(pumpEventQueue().then((_) { | |
| 49 expect(currentSchedule.currentTask, isNull); | |
| 50 }), completes); | |
| 51 }); | |
| 52 | |
| 53 schedule(() => expect('foo', equals('foo'))); | |
| 54 }); | |
| 55 }); | |
| 56 | |
| 57 expectTestsPass('currentSchedule.currentQueue returns the current queue while ' | |
|
Bob Nystrom
2013/04/02 22:03:17
long line.
nweiz
2013/04/02 22:38:44
Done.
| |
| 58 'executing a task', () { | |
| 59 test('test', () { | |
| 60 schedule(() { | |
| 61 expect(currentSchedule.currentQueue.name, equals('tasks')); | |
| 62 }); | |
| 63 }); | |
| 64 }); | |
| 65 | |
| 66 expectTestsPass('currentSchedule.currentQueue is tasks before the schedule ' | |
| 67 'has started', () { | |
| 68 test('test', () { | |
| 69 schedule(() => expect('foo', equals('foo'))); | |
| 70 | |
| 71 expect(currentSchedule.currentQueue.name, equals('tasks')); | |
| 72 }); | |
| 73 }); | |
| 74 } | |
| OLD | NEW |