OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
6 * A configuration for running layoutr tests with testrunner. | 6 * A configuration for running layoutr tests with testrunner. |
7 * This configuration is similar to the interactive_html_config | 7 * This configuration is similar to the interactive_html_config |
8 * as it runs each test in its own IFrame. However, where the former | 8 * as it runs each test in its own IFrame. However, where the former |
9 * recreated the IFrame for each test, here the IFrames are preserved. | 9 * recreated the IFrame for each test, here the IFrames are preserved. |
10 * Furthermore we post a message on completion. | 10 * Furthermore we post a message on completion. |
(...skipping 30 matching lines...) Expand all Loading... |
41 // The format of a message is '<type> <elapsedTime> <body>'. | 41 // The format of a message is '<type> <elapsedTime> <body>'. |
42 // If we don't get a type we default to a 'log' type. | 42 // If we don't get a type we default to a 'log' type. |
43 var messageParser = const RegExp('\([a-z]*\) \([0-9]*\) \(.*\)'); | 43 var messageParser = const RegExp('\([a-z]*\) \([0-9]*\) \(.*\)'); |
44 Match match = messageParser.firstMatch(msg); | 44 Match match = messageParser.firstMatch(msg); |
45 if (match == null) { | 45 if (match == null) { |
46 messageType = 'log'; | 46 messageType = 'log'; |
47 elapsed = 0; | 47 elapsed = 0; |
48 body = msg; | 48 body = msg; |
49 } else { | 49 } else { |
50 messageType = match.group(1); | 50 messageType = match.group(1); |
51 elapsed = parseInt(match.group(2)); | 51 elapsed = int.parse(match.group(2)); |
52 body = match.group(3); | 52 body = match.group(3); |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 String toString() => text(messageType, elapsed, body); | 56 String toString() => text(messageType, elapsed, body); |
57 } | 57 } |
58 | 58 |
59 /** | 59 /** |
60 * The child configuration that is used to run individual tests in | 60 * The child configuration that is used to run individual tests in |
61 * an IFrame and post the results back to the parent. In principle | 61 * an IFrame and post the results back to the parent. In principle |
(...skipping 27 matching lines...) Expand all Loading... |
89 * window, gets the test ID from the query parameter in the | 89 * window, gets the test ID from the query parameter in the |
90 * IFrame URL, sets that as a solo test and starts test execution. | 90 * IFrame URL, sets that as a solo test and starts test execution. |
91 */ | 91 */ |
92 window.on.message.add((MessageEvent e) { | 92 window.on.message.add((MessageEvent e) { |
93 var m = new _Message.fromString(e.data); | 93 var m = new _Message.fromString(e.data); |
94 if (m.messageType == _Message.START) { | 94 if (m.messageType == _Message.START) { |
95 parentWindow = e.source; | 95 parentWindow = e.source; |
96 String search = window.location.search; | 96 String search = window.location.search; |
97 int pos = search.indexOf('t='); | 97 int pos = search.indexOf('t='); |
98 String ids = search.substring(pos+2); | 98 String ids = search.substring(pos+2); |
99 int id = parseInt(ids); | 99 int id = int.parse(ids); |
100 setSoloTest(id); | 100 setSoloTest(id); |
101 runTests(); | 101 runTests(); |
102 } | 102 } |
103 }); | 103 }); |
104 } | 104 } |
105 | 105 |
106 void onStart() { | 106 void onStart() { |
107 // Listen for uncaught errors. | 107 // Listen for uncaught errors. |
108 window.on.error.add(_onErrorClosure); | 108 window.on.error.add(_onErrorClosure); |
109 } | 109 } |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 */ | 301 */ |
302 void useHtmlLayoutConfiguration() { | 302 void useHtmlLayoutConfiguration() { |
303 if (window.location.search == '') { // This is the parent. | 303 if (window.location.search == '') { // This is the parent. |
304 _prepareDom(); | 304 _prepareDom(); |
305 configure(new ParentHtmlConfiguration()); | 305 configure(new ParentHtmlConfiguration()); |
306 } else { | 306 } else { |
307 configure(new ChildHtmlConfiguration()); | 307 configure(new ChildHtmlConfiguration()); |
308 } | 308 } |
309 } | 309 } |
310 | 310 |
OLD | NEW |