OLD | NEW |
1 typedef void Test(); | 1 typedef void Test(); |
2 typedef void Operation(); | 2 typedef void Operation(); |
3 typedef void Reporter(Map<String, Result> results); | 3 typedef void Reporter(Map<String, Result> results); |
4 | 4 |
5 class Suite { | 5 class Suite { |
6 /** | 6 /** |
7 * Ctor. | 7 * Ctor. |
8 * [:_window:] The window of the suite. | 8 * [:_window:] The window of the suite. |
9 * [:_name:] The name of the suite. | 9 * [:_name:] The name of the suite. |
10 */ | 10 */ |
11 Suite(this._window, this._name) : | 11 Suite(this._window, this._name) : |
12 _operations = new List<Operation>(), | 12 _operations = new List<Operation>(), |
13 _nTests = 0, _nRanTests = 0 { | 13 _nTests = 0, _nRanTests = 0 { |
14 starter(MessageEvent event) { | 14 starter(MessageEvent event) { |
15 String command = event.data; | 15 String command = event.data; |
16 switch (command) { | 16 switch (command) { |
17 case 'start': | 17 case 'start': |
18 _run(); | 18 _run(); |
19 return; | 19 return; |
20 default: | 20 default: |
21 _window.alert('[${_name}]: unknown command ${command}'); | 21 _window.alert('[${_name}]: unknown command ${command}'); |
22 } | 22 } |
23 }; | 23 }; |
24 try { | 24 try { |
25 // dart:dom | 25 // dart:dom_deprecated |
26 _window.addEventListener('message', starter, false); | 26 _window.addEventListener('message', starter, false); |
27 } catch (NoSuchMethodException e) { | 27 } catch (NoSuchMethodException e) { |
28 // dart:html | 28 // dart:html |
29 _window.on.message.add(starter); | 29 _window.on.message.add(starter); |
30 } | 30 } |
31 } | 31 } |
32 | 32 |
33 /** | 33 /** |
34 * Adds a preparation step to the suite. | 34 * Adds a preparation step to the suite. |
35 * [:operation:] The operation to be performed. | 35 * [:operation:] The operation to be performed. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 List<Operation> _operations; | 128 List<Operation> _operations; |
129 int _nTests; | 129 int _nTests; |
130 int _nRanTests; | 130 int _nRanTests; |
131 | 131 |
132 Suite _addOperation(Operation operation) { | 132 Suite _addOperation(Operation operation) { |
133 _operations.add(operation); | 133 _operations.add(operation); |
134 return this; | 134 return this; |
135 } | 135 } |
136 } | 136 } |
OLD | NEW |