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

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

Issue 12321078: Make base64 decoding available in dart:crypto Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove duplicate base64 decoding functionality from webdriver and use dart:crypto Created 7 years, 8 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 | « pkg/webdriver/lib/src/base64decoder.dart ('k') | no next file » | 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:async'; 7 import 'dart:async';
8 import 'dart:crypto';
8 import 'dart:io'; 9 import 'dart:io';
9 import 'dart:json' as json; 10 import 'dart:json' as json;
10 import 'dart:uri'; 11 import 'dart:uri';
11 12
12 part 'src/base64decoder.dart';
13
14 /** 13 /**
15 * WebDriver bindings for Dart. 14 * WebDriver bindings for Dart.
16 * 15 *
17 * These bindings are based on the WebDriver JSON wire protocol spec 16 * These bindings are based on the WebDriver JSON wire protocol spec
18 * (http://code.google.com/p/selenium/wiki/JsonWireProtocol). Not 17 * (http://code.google.com/p/selenium/wiki/JsonWireProtocol). Not
19 * all of these commands are implemented yet by WebDriver itself. 18 * all of these commands are implemented yet by WebDriver itself.
20 * Nontheless this is a complete implementation of the spec as the 19 * Nontheless this is a complete implementation of the spec as the
21 * unsupported commands may be supported in the future. Currently, 20 * unsupported commands may be supported in the future. Currently,
22 * there are known issues with local and session storage, script 21 * there are known issues with local and session storage, script
23 * execution, and log access. 22 * execution, and log access.
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 } 655 }
657 656
658 /** 657 /**
659 * Take a screenshot of the current page (PNG). 658 * Take a screenshot of the current page (PNG).
660 * 659 *
661 * Potential Errors: NoSuchWindow. 660 * Potential Errors: NoSuchWindow.
662 */ 661 */
663 Future<List<int>> getScreenshot([fname]) { 662 Future<List<int>> getScreenshot([fname]) {
664 var completer = new Completer(); 663 var completer = new Completer();
665 return _get('screenshot', completer, (r, v) { 664 return _get('screenshot', completer, (r, v) {
666 var image = Base64Decoder.decode(v); 665 var image = CryptoUtils.base64StringToBytes(v);
667 if (fname != null) { 666 if (fname != null) {
668 writeBytesToFile(fname, image); 667 writeBytesToFile(fname, image);
669 } 668 }
670 completer.complete(image); 669 completer.complete(image);
671 }); 670 });
672 } 671 }
673 672
674 /** 673 /**
675 * List all available IME (Input Method Editor) engines on the machine. 674 * List all available IME (Input Method Editor) engines on the machine.
676 * To use an engine, it has to be present in this list. 675 * To use an engine, it has to be present in this list.
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 * 1441 *
1443 * 'timestamp' (int) - The timestamp of the entry. 1442 * 'timestamp' (int) - The timestamp of the entry.
1444 * 'level' (String) - The log level of the entry, for example, "INFO". 1443 * 'level' (String) - The log level of the entry, for example, "INFO".
1445 * 'message' (String) - The log message. 1444 * 'message' (String) - The log message.
1446 * 1445 *
1447 * This works with Firefox but Chrome returns a 500 response due to a 1446 * This works with Firefox but Chrome returns a 500 response due to a
1448 * bad cast. 1447 * bad cast.
1449 */ 1448 */
1450 Future<List<Map>> getLogs(String type) => _post('log', { 'type': type }); 1449 Future<List<Map>> getLogs(String type) => _post('log', { 'type': type });
1451 } 1450 }
OLDNEW
« no previous file with comments | « pkg/webdriver/lib/src/base64decoder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698