OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library unittest.runner.browser.iframe_test; | 5 library unittest.runner.browser.iframe_test; |
6 | 6 |
7 import '../../backend/live_test.dart'; | 7 import '../../backend/live_test.dart'; |
8 import '../../backend/live_test_controller.dart'; | 8 import '../../backend/live_test_controller.dart'; |
| 9 import '../../backend/metadata.dart'; |
9 import '../../backend/state.dart'; | 10 import '../../backend/state.dart'; |
10 import '../../backend/suite.dart'; | 11 import '../../backend/suite.dart'; |
11 import '../../backend/test.dart'; | 12 import '../../backend/test.dart'; |
12 import '../../util/multi_channel.dart'; | 13 import '../../util/multi_channel.dart'; |
13 import '../../util/remote_exception.dart'; | 14 import '../../util/remote_exception.dart'; |
14 | 15 |
15 /// A test in a running iframe. | 16 /// A test in a running iframe. |
16 class IframeTest implements Test { | 17 class IframeTest implements Test { |
17 final String name; | 18 final String name; |
| 19 final Metadata metadata; |
18 | 20 |
19 /// The channel used to communicate with the test's [IframeListener]. | 21 /// The channel used to communicate with the test's [IframeListener]. |
20 final MultiChannel _channel; | 22 final MultiChannel _channel; |
21 | 23 |
22 IframeTest(this.name, this._channel); | 24 IframeTest(this.name, this.metadata, this._channel); |
23 | 25 |
24 LiveTest load(Suite suite) { | 26 LiveTest load(Suite suite) { |
25 var controller; | 27 var controller; |
26 controller = new LiveTestController(suite, this, () { | 28 controller = new LiveTestController(suite, this, () { |
27 controller.setState(const State(Status.running, Result.success)); | 29 controller.setState(const State(Status.running, Result.success)); |
28 | 30 |
29 var testChannel = _channel.virtualChannel(); | 31 var testChannel = _channel.virtualChannel(); |
30 _channel.sink.add({ | 32 _channel.sink.add({ |
31 'command': 'run', | 33 'command': 'run', |
32 'channel': testChannel.id | 34 'channel': testChannel.id |
(...skipping 10 matching lines...) Expand all Loading... |
43 new Result.parse(message['result']))); | 45 new Result.parse(message['result']))); |
44 } else { | 46 } else { |
45 assert(message['type'] == 'complete'); | 47 assert(message['type'] == 'complete'); |
46 controller.completer.complete(); | 48 controller.completer.complete(); |
47 } | 49 } |
48 }); | 50 }); |
49 }); | 51 }); |
50 return controller.liveTest; | 52 return controller.liveTest; |
51 } | 53 } |
52 } | 54 } |
OLD | NEW |