| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of unittestTest; | 5 part of unittestTest; |
| 6 | 6 |
| 7 Future _defer(void fn()) { | 7 Future _defer(void fn()) { |
| 8 return new Future.sync(fn); | 8 return new Future.sync(fn); |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 count: count, setup: setup, teardown: teardown, | 52 count: count, setup: setup, teardown: teardown, |
| 53 uncaughtError: uncaughtError); | 53 uncaughtError: uncaughtError); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void onDone(bool success) { | 56 void onDone(bool success) { |
| 57 _port.send(_result); | 57 _port.send(_result); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 makeDelayedSetup(index, s) => () { | 61 makeDelayedSetup(index, s) => () { |
| 62 return new Future.delayed(new Duration(milliseconds:1), () { | 62 return new Future.delayed(new Duration(milliseconds: 1), () { |
| 63 s.write('l$index U '); | 63 s.write('l$index U '); |
| 64 }); | 64 }); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 makeDelayedTeardown(index, s) => () { | 67 makeDelayedTeardown(index, s) => () { |
| 68 return new Future.delayed(new Duration(milliseconds:1), () { | 68 return new Future.delayed(new Duration(milliseconds: 1), () { |
| 69 s.write('l$index D '); | 69 s.write('l$index D '); |
| 70 }); | 70 }); |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 makeImmediateSetup(index, s) => () { | 73 makeImmediateSetup(index, s) => () { |
| 74 s.write('l$index U '); | 74 s.write('l$index U '); |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 makeImmediateTeardown(index, s) => () { | 77 makeImmediateTeardown(index, s) => () { |
| 78 s.write('l$index D '); | 78 s.write('l$index D '); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 runTestInIsolate(sendport) { | 81 runTestInIsolate(sendport) { |
| 82 var testConfig = new TestConfiguration(sendport); | 82 var testConfig = new TestConfiguration(sendport); |
| 83 unittestConfiguration = testConfig; | 83 unittestConfiguration = testConfig; |
| 84 testFunction(testConfig); | 84 testFunction(testConfig); |
| 85 } | 85 } |
| 86 | 86 |
| 87 main() { | 87 main() { |
| 88 var replyPort = new ReceivePort(); | 88 var replyPort = new ReceivePort(); |
| 89 Isolate.spawn(runTestInIsolate, replyPort.sendPort); | 89 Isolate.spawn(runTestInIsolate, replyPort.sendPort); |
| 90 replyPort.first.then((String msg) { | 90 replyPort.first.then((String msg) { |
| 91 expect(msg.trim(), equals(expected)); | 91 expect(msg.trim(), equals(expected)); |
| 92 }); | 92 }); |
| 93 } | 93 } |
| OLD | NEW |