| 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; | 7 import "dart:convert" show LineSplitter, UTF8; |
| 8 import "dart:core"; | 8 import "dart:core"; |
| 9 import "dart:io"; | 9 import "dart:io"; |
| 10 | 10 |
| (...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 | 937 |
| 938 void handleReport(HttpRequest request, String browserId, var testId) { | 938 void handleReport(HttpRequest request, String browserId, var testId) { |
| 939 StringBuffer buffer = new StringBuffer(); | 939 StringBuffer buffer = new StringBuffer(); |
| 940 request.transform(UTF8.decoder).listen((data) { | 940 request.transform(UTF8.decoder).listen((data) { |
| 941 buffer.write(data); | 941 buffer.write(data); |
| 942 }, onDone: () { | 942 }, onDone: () { |
| 943 String back = buffer.toString(); | 943 String back = buffer.toString(); |
| 944 request.response.close(); | 944 request.response.close(); |
| 945 testDoneCallBack(browserId, back, testId); | 945 testDoneCallBack(browserId, back, testId); |
| 946 // TODO(ricow): We should do something smart if we get an error here. | 946 // TODO(ricow): We should do something smart if we get an error here. |
| 947 }, onError: (error) { DebugLogger.error(error); }); | 947 }, onError: (error) { DebugLogger.error("$error"); }); |
| 948 } | 948 } |
| 949 | 949 |
| 950 void handleStarted(HttpRequest request, String browserId, var testId) { | 950 void handleStarted(HttpRequest request, String browserId, var testId) { |
| 951 StringBuffer buffer = new StringBuffer(); | 951 StringBuffer buffer = new StringBuffer(); |
| 952 // If an error occurs while receiving the data from the request stream, | 952 // If an error occurs while receiving the data from the request stream, |
| 953 // we don't handle it specially. We can safely ignore it, since the started | 953 // we don't handle it specially. We can safely ignore it, since the started |
| 954 // events are not crucial. | 954 // events are not crucial. |
| 955 request.transform(UTF8.decoder).listen((data) { | 955 request.transform(UTF8.decoder).listen((data) { |
| 956 buffer.write(data); | 956 buffer.write(data); |
| 957 }, onDone: () { | 957 }, onDone: () { |
| 958 String back = buffer.toString(); | 958 String back = buffer.toString(); |
| 959 request.response.close(); | 959 request.response.close(); |
| 960 testStartedCallBack(browserId, back, testId); | 960 testStartedCallBack(browserId, back, testId); |
| 961 }, onError: (error) { DebugLogger.error(error); }); | 961 }, onError: (error) { DebugLogger.error("$error"); }); |
| 962 } | 962 } |
| 963 | 963 |
| 964 String getNextTest(String browserId) { | 964 String getNextTest(String browserId) { |
| 965 var nextTest = nextTestCallBack(browserId); | 965 var nextTest = nextTestCallBack(browserId); |
| 966 if (underTermination) { | 966 if (underTermination) { |
| 967 // Browsers will be killed shortly, send them a terminate signal so | 967 // Browsers will be killed shortly, send them a terminate signal so |
| 968 // that they stop pulling. | 968 // that they stop pulling. |
| 969 return terminateSignal; | 969 return terminateSignal; |
| 970 } else if (nextTest == null) { | 970 } else if (nextTest == null) { |
| 971 // We don't currently have any tests ready for consumption, wait. | 971 // We don't currently have any tests ready for consumption, wait. |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 </head> | 1130 </head> |
| 1131 <body onload="startTesting()"> | 1131 <body onload="startTesting()"> |
| 1132 Dart test driver, number of tests: <div id="number"></div> | 1132 Dart test driver, number of tests: <div id="number"></div> |
| 1133 <iframe id="embedded_iframe"></iframe> | 1133 <iframe id="embedded_iframe"></iframe> |
| 1134 </body> | 1134 </body> |
| 1135 </html> | 1135 </html> |
| 1136 """; | 1136 """; |
| 1137 return driverContent; | 1137 return driverContent; |
| 1138 } | 1138 } |
| 1139 } | 1139 } |
| OLD | NEW |