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 test.runner.browser.iframe_test; | 5 library test.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/metadata.dart'; |
| 10 import '../../backend/operating_system.dart'; |
10 import '../../backend/state.dart'; | 11 import '../../backend/state.dart'; |
11 import '../../backend/suite.dart'; | 12 import '../../backend/suite.dart'; |
12 import '../../backend/test.dart'; | 13 import '../../backend/test.dart'; |
| 14 import '../../backend/test_platform.dart'; |
13 import '../../util/multi_channel.dart'; | 15 import '../../util/multi_channel.dart'; |
14 import '../../util/remote_exception.dart'; | 16 import '../../util/remote_exception.dart'; |
15 import '../../util/stack_trace_mapper.dart'; | 17 import '../../util/stack_trace_mapper.dart'; |
16 | 18 |
17 /// A test in a running iframe. | 19 /// A test in a running iframe. |
18 class IframeTest implements Test { | 20 class IframeTest extends Test { |
19 final String name; | 21 final String name; |
20 final Metadata metadata; | 22 final Metadata metadata; |
21 | 23 |
22 /// The mapper used to map stack traces for errors coming from this test, or | 24 /// The mapper used to map stack traces for errors coming from this test, or |
23 /// `null`. | 25 /// `null`. |
24 final StackTraceMapper _mapper; | 26 final StackTraceMapper _mapper; |
25 | 27 |
26 /// The channel used to communicate with the test's [IframeListener]. | 28 /// The channel used to communicate with the test's [IframeListener]. |
27 final MultiChannel _channel; | 29 final MultiChannel _channel; |
28 | 30 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 }, () { | 66 }, () { |
65 // Ignore all future messages from the test and complete it immediately. | 67 // Ignore all future messages from the test and complete it immediately. |
66 // We don't need to tell it to run its tear-down because there's nothing a | 68 // We don't need to tell it to run its tear-down because there's nothing a |
67 // browser test needs to clean up on the file system anyway. | 69 // browser test needs to clean up on the file system anyway. |
68 testChannel.sink.close(); | 70 testChannel.sink.close(); |
69 if (!controller.completer.isCompleted) controller.completer.complete(); | 71 if (!controller.completer.isCompleted) controller.completer.complete(); |
70 }); | 72 }); |
71 return controller.liveTest; | 73 return controller.liveTest; |
72 } | 74 } |
73 | 75 |
74 Test change({String name, Metadata metadata}) { | 76 Test forPlatform(TestPlatform platform, {OperatingSystem os}) { |
75 if (name == name && metadata == this.metadata) return this; | 77 if (!metadata.testOn.evaluate(platform, os: os)) return null; |
76 if (name == null) name = this.name; | 78 return new IframeTest( |
77 if (metadata == null) metadata = this.metadata; | 79 name, metadata.forPlatform(platform, os: os), _channel, |
78 return new IframeTest(name, metadata, _channel); | 80 mapper: _mapper); |
79 } | 81 } |
80 } | 82 } |
OLD | NEW |