OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 library webdriver; | 5 library webdriver; |
6 | 6 |
7 import 'dart:json' as json; | 7 import 'dart:json' as json; |
8 import 'dart:uri'; | 8 import 'dart:uri'; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 | 10 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 completer = null; | 261 completer = null; |
262 } | 262 } |
263 }; | 263 }; |
264 connection.followRedirects = false; | 264 connection.followRedirects = false; |
265 connection.onResponse = (r) { | 265 connection.onResponse = (r) { |
266 StringInputStream s = new StringInputStream(r.inputStream); | 266 StringInputStream s = new StringInputStream(r.inputStream); |
267 StringBuffer sbuf = new StringBuffer(); | 267 StringBuffer sbuf = new StringBuffer(); |
268 s.onData = () { | 268 s.onData = () { |
269 var data = s.read(); | 269 var data = s.read(); |
270 if (data != null) { | 270 if (data != null) { |
271 sbuf.add(data); | 271 sbuf.write(data); |
272 } | 272 } |
273 }; | 273 }; |
274 s.onClosed = () { | 274 s.onClosed = () { |
275 var value = null; | 275 var value = null; |
276 results = sbuf.toString().trim(); | 276 results = sbuf.toString().trim(); |
277 // For some reason we get a bunch of NULs on the end | 277 // For some reason we get a bunch of NULs on the end |
278 // of the text and the json.parse blows up on these, so | 278 // of the text and the json.parse blows up on these, so |
279 // strip them. | 279 // strip them. |
280 // These NULs can be seen in the TCP packet, so it is not | 280 // These NULs can be seen in the TCP packet, so it is not |
281 // an issue with character encoding; it seems to be a bug | 281 // an issue with character encoding; it seems to be a bug |
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1349 * Get the log for a given log type. Log buffer is reset after each request. | 1349 * Get the log for a given log type. Log buffer is reset after each request. |
1350 * Each log entry is a [Map] with these fields: | 1350 * Each log entry is a [Map] with these fields: |
1351 * | 1351 * |
1352 * 'timestamp' (int) - The timestamp of the entry. | 1352 * 'timestamp' (int) - The timestamp of the entry. |
1353 * 'level' (String) - The log level of the entry, for example, "INFO". | 1353 * 'level' (String) - The log level of the entry, for example, "INFO". |
1354 * 'message' (String) - The log message. | 1354 * 'message' (String) - The log message. |
1355 */ | 1355 */ |
1356 Future<List<Map>> getLogs(String type) => | 1356 Future<List<Map>> getLogs(String type) => |
1357 _post('log', params: { 'type': type }); | 1357 _post('log', params: { 'type': type }); |
1358 } | 1358 } |
OLD | NEW |