| 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 _window.on.message.add(starter); | 24 try { |
| 25 // dart:dom_deprecated |
| 26 _window.addEventListener('message', starter, false); |
| 27 } on NoSuchMethodException catch (e) { |
| 28 // dart:html |
| 29 _window.on.message.add(starter); |
| 30 } |
| 25 } | 31 } |
| 26 | 32 |
| 27 /** | 33 /** |
| 28 * Adds a preparation step to the suite. | 34 * Adds a preparation step to the suite. |
| 29 * [:operation:] The operation to be performed. | 35 * [:operation:] The operation to be performed. |
| 30 */ | 36 */ |
| 31 Suite prep(Operation operation){ | 37 Suite prep(Operation operation){ |
| 32 return _addOperation(operation); | 38 return _addOperation(operation); |
| 33 } | 39 } |
| 34 | 40 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 127 |
| 122 List<Operation> _operations; | 128 List<Operation> _operations; |
| 123 int _nTests; | 129 int _nTests; |
| 124 int _nRanTests; | 130 int _nRanTests; |
| 125 | 131 |
| 126 Suite _addOperation(Operation operation) { | 132 Suite _addOperation(Operation operation) { |
| 127 _operations.add(operation); | 133 _operations.add(operation); |
| 128 return this; | 134 return this; |
| 129 } | 135 } |
| 130 } | 136 } |
| OLD | NEW |