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

Unified Diff: pkg/webdriver/base64decoder.dart

Issue 11301046: Restructure pkg/unittest and pkg/webdriver to follow the pub conventions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: pkg/webdriver/base64decoder.dart
===================================================================
--- pkg/webdriver/base64decoder.dart (revision 14313)
+++ pkg/webdriver/base64decoder.dart (working copy)
@@ -1,49 +0,0 @@
-/**
- * A simple base64 decoder class, used to decode web browser screenshots
- * returned by WebDriver.
- */
-class Base64Decoder {
-
- static int getVal(String s, pos) {
- int code = s.charCodeAt(pos);
- if (code >= 65 && code < (65+26)) { // 'A'..'Z'
- return code - 65;
- } else if (code >= 97 && code < (97+26)) { // 'a'..'z'
- return code - 97 + 26;
- } else if (code >= 48 && code < (48+10)) { // '0'..'9'
- return code - 48 + 52;
- } else if (code == 43) { // '+'
- return 62;
- } else if (code == 47) { // '/'
- return 63;
- } else {
- throw 'Invalid character $s';
- }
- }
-
- static List<int> decode(String s) {
- var rtn = new List<int>();
- var pos = 0;
- while (pos < s.length) {
- if (s[pos+2] =='=') { // Single byte as two chars.
- int v = (getVal(s, pos) << 18 ) | (getVal(s, pos+1) << 12 );
- rtn.add((v >> 16) & 0xff);
- break;
- } else if (s[pos+3] == '=') { // Two bytes as 3 chars.
- int v = (getVal(s, pos) << 18 ) | (getVal(s, pos+1) << 12 ) |
- (getVal(s, pos + 2) << 6);
- rtn.add((v >> 16) & 0xff);
- rtn.add((v >> 8) & 0xff);
- break;
- } else { // Three bytes as 4 chars.
- int v = (getVal(s, pos) << 18 ) | (getVal(s, pos+1) << 12 ) |
- (getVal(s, pos + 2) << 6) | getVal(s, pos+3);
- pos += 4;
- rtn.add((v >> 16 ) & 0xff);
- rtn.add((v >> 8) & 0xff);
- rtn.add(v & 0xff);
- }
- }
- return rtn;
- }
-}

Powered by Google App Engine
This is Rietveld 408576698