Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: pkg/webdriver/lib/webdriver.dart

Issue 11827017: Update remaining usages of Completer.completeException. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 r.headers.add( 256 r.headers.add(
257 HttpHeaders.CONTENT_TYPE, 'application/json;charset=UTF-8'); 257 HttpHeaders.CONTENT_TYPE, 'application/json;charset=UTF-8');
258 OutputStream s = r.outputStream; 258 OutputStream s = r.outputStream;
259 if (params != null && params is Map) { 259 if (params != null && params is Map) {
260 s.writeString(json.stringify(params)); 260 s.writeString(json.stringify(params));
261 } 261 }
262 s.close(); 262 s.close();
263 }; 263 };
264 connection.onError = (e) { 264 connection.onError = (e) {
265 if (completer != null) { 265 if (completer != null) {
266 completer.completeException(new WebDriverError(-1, e)); 266 completer.completeError(new WebDriverError(-1, e));
267 completer = null; 267 completer = null;
268 } 268 }
269 }; 269 };
270 connection.followRedirects = false; 270 connection.followRedirects = false;
271 connection.onResponse = (r) { 271 connection.onResponse = (r) {
272 StringInputStream s = new StringInputStream(r.inputStream); 272 StringInputStream s = new StringInputStream(r.inputStream);
273 StringBuffer sbuf = new StringBuffer(); 273 StringBuffer sbuf = new StringBuffer();
274 s.onData = () { 274 s.onData = () {
275 var data = s.read(); 275 var data = s.read();
276 if (data != null) { 276 if (data != null) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 if (status == 0) { 313 if (status == 0) {
314 if (customHandler != null) { 314 if (customHandler != null) {
315 customHandler(r, value); 315 customHandler(r, value);
316 } else if (completer != null) { 316 } else if (completer != null) {
317 completer.complete(value); 317 completer.complete(value);
318 } 318 }
319 } 319 }
320 }; 320 };
321 }; 321 };
322 } catch (e, s) { 322 } catch (e, s) {
323 completer.completeException( 323 completer.completeError(
324 new WebDriverError(-1, e), s); 324 new WebDriverError(-1, e), s);
325 completer = null; 325 completer = null;
326 } 326 }
327 } 327 }
328 328
329 Future _simpleCommand(method, extraPath, [successCodes, params]) { 329 Future _simpleCommand(method, extraPath, [successCodes, params]) {
330 var completer = new Completer(); 330 var completer = new Completer();
331 _serverRequest(method, '${_path}/$extraPath', completer, 331 _serverRequest(method, '${_path}/$extraPath', completer,
332 successCodes, params: params); 332 successCodes, params: params);
333 return completer.future; 333 return completer.future;
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 * Get the log for a given log type. Log buffer is reset after each request. 1356 * Get the log for a given log type. Log buffer is reset after each request.
1357 * Each log entry is a [Map] with these fields: 1357 * Each log entry is a [Map] with these fields:
1358 * 1358 *
1359 * 'timestamp' (int) - The timestamp of the entry. 1359 * 'timestamp' (int) - The timestamp of the entry.
1360 * 'level' (String) - The log level of the entry, for example, "INFO". 1360 * 'level' (String) - The log level of the entry, for example, "INFO".
1361 * 'message' (String) - The log message. 1361 * 'message' (String) - The log message.
1362 */ 1362 */
1363 Future<List<Map>> getLogs(String type) => 1363 Future<List<Map>> getLogs(String type) =>
1364 _post('log', params: { 'type': type }); 1364 _post('log', params: { 'type': type });
1365 } 1365 }
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698