| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library browser; | 4 library browser; |
| 5 | 5 |
| 6 import "dart:async"; | 6 import "dart:async"; |
| 7 import "dart:convert" show LineSplitter, UTF8, JSON; | 7 import "dart:convert" show LineSplitter, UTF8, JSON; |
| 8 import "dart:core"; | 8 import "dart:core"; |
| 9 import "dart:io"; | 9 import "dart:io"; |
| 10 | 10 |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 // test. | 779 // test. |
| 780 int id; | 780 int id; |
| 781 static int _idCounter = 0; | 781 static int _idCounter = 0; |
| 782 | 782 |
| 783 BrowserTest(this.url, this.doneCallback, this.timeout) { | 783 BrowserTest(this.url, this.doneCallback, this.timeout) { |
| 784 id = _idCounter++; | 784 id = _idCounter++; |
| 785 } | 785 } |
| 786 | 786 |
| 787 String toJSON() => JSON.encode({'url': url, | 787 String toJSON() => JSON.encode({'url': url, |
| 788 'id': id, | 788 'id': id, |
| 789 'isSimpleHtmlTest': false}); | 789 'isHtmlTest': false}); |
| 790 } | 790 } |
| 791 | 791 |
| 792 | 792 |
| 793 /** | 793 /** |
| 794 * Describes a test with a custom HTML page to be run in the browser. | 794 * Describes a test with a custom HTML page to be run in the browser. |
| 795 */ | 795 */ |
| 796 class HtmlTest extends BrowserTest { | 796 class HtmlTest extends BrowserTest { |
| 797 List<String> expectedMessages; | 797 List<String> expectedMessages; |
| 798 | 798 |
| 799 HtmlTest(url, doneCallback, timeout, this.expectedMessages) | 799 HtmlTest(url, doneCallback, timeout, this.expectedMessages) |
| 800 : super(url, doneCallback, timeout) { } | 800 : super(url, doneCallback, timeout) { } |
| 801 | 801 |
| 802 String toJSON() => JSON.encode({'url': url, | 802 String toJSON() => JSON.encode({'url': url, |
| 803 'id': id, | 803 'id': id, |
| 804 'isSimpleHtmlTest': true, | 804 'isHtmlTest': true, |
| 805 'expectedMessages': expectedMessages}); | 805 'expectedMessages': expectedMessages}); |
| 806 } | 806 } |
| 807 | 807 |
| 808 | 808 |
| 809 /* Describes the output of running the test in a browser */ | 809 /* Describes the output of running the test in a browser */ |
| 810 class BrowserTestOutput { | 810 class BrowserTestOutput { |
| 811 final Duration delayUntilTestStarted; | 811 final Duration delayUntilTestStarted; |
| 812 final Duration duration; | 812 final Duration duration; |
| 813 | 813 |
| 814 final String lastKnownMessage; | 814 final String lastKnownMessage; |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1408 testStartedCallBack(browserId, back, testId); | 1408 testStartedCallBack(browserId, back, testId); |
| 1409 }, onError: (error) { DebugLogger.error("$error"); }); | 1409 }, onError: (error) { DebugLogger.error("$error"); }); |
| 1410 } | 1410 } |
| 1411 | 1411 |
| 1412 String getNextTest(String browserId) { | 1412 String getNextTest(String browserId) { |
| 1413 var nextTest = nextTestCallBack(browserId); | 1413 var nextTest = nextTestCallBack(browserId); |
| 1414 if (underTermination) { | 1414 if (underTermination) { |
| 1415 // Browsers will be killed shortly, send them a terminate signal so | 1415 // Browsers will be killed shortly, send them a terminate signal so |
| 1416 // that they stop pulling. | 1416 // that they stop pulling. |
| 1417 return terminateSignal; | 1417 return terminateSignal; |
| 1418 } else { | |
| 1419 return nextTest == null ? waitSignal : nextTest.toJSON(); | |
| 1420 } | 1418 } |
| 1419 return nextTest == null ? waitSignal : nextTest.toJSON(); |
| 1421 } | 1420 } |
| 1422 | 1421 |
| 1423 String getDriverUrl(String browserId) { | 1422 String getDriverUrl(String browserId) { |
| 1424 if (errorReportingServer == null) { | 1423 if (errorReportingServer == null) { |
| 1425 print("Bad browser testing server, you are not started yet. Can't " | 1424 print("Bad browser testing server, you are not started yet. Can't " |
| 1426 "produce driver url"); | 1425 "produce driver url"); |
| 1427 exit(1); | 1426 exit(1); |
| 1428 // This should never happen - exit immediately; | 1427 // This should never happen - exit immediately; |
| 1429 } | 1428 } |
| 1430 var port = configuration['_servers_'].port; | 1429 var port = configuration['_servers_'].port; |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1767 </div> | 1766 </div> |
| 1768 <div id="embedded_iframe_div" class="test box"> | 1767 <div id="embedded_iframe_div" class="test box"> |
| 1769 <iframe style="width:100%;height:100%;" id="embedded_iframe"></iframe> | 1768 <iframe style="width:100%;height:100%;" id="embedded_iframe"></iframe> |
| 1770 </div> | 1769 </div> |
| 1771 </body> | 1770 </body> |
| 1772 </html> | 1771 </html> |
| 1773 """; | 1772 """; |
| 1774 return driverContent; | 1773 return driverContent; |
| 1775 } | 1774 } |
| 1776 } | 1775 } |
| OLD | NEW |