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

Side by Side Diff: tools/testing/dart/android.dart

Issue 2903703002: Tighten types in test.dart even more. (Closed)
Patch Set: Play nicer with strong mode. Created 3 years, 6 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
« no previous file with comments | « tools/testing/dart/analysis_options.yaml ('k') | tools/testing/dart/browser_controller.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) 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 4
5 library android; 5 library android;
6 6
7 import "dart:async"; 7 import "dart:async";
8 import "dart:convert" show LineSplitter, UTF8; 8 import "dart:convert" show LineSplitter, UTF8;
9 import "dart:core"; 9 import "dart:core";
10 import "dart:collection"; 10 import "dart:collection";
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 69 }
70 70
71 var results = await Future.wait([ 71 var results = await Future.wait([
72 getOutput(process.stdout), 72 getOutput(process.stdout),
73 getOutput(process.stderr), 73 getOutput(process.stderr),
74 process.exitCode 74 process.exitCode
75 ]); 75 ]);
76 if (timer != null) timer.cancel(); 76 if (timer != null) timer.cancel();
77 77
78 String command = "$executable ${args.join(' ')}"; 78 String command = "$executable ${args.join(' ')}";
79 return new AdbCommandResult( 79 return new AdbCommandResult(command, results[0] as String,
80 command, results[0], results[1], results[2], timedOut); 80 results[1] as String, results[2] as int, timedOut);
81 }); 81 });
82 } 82 }
83 83
84 /** 84 /**
85 * Helper class to loop through all adb ports. 85 * Helper class to loop through all adb ports.
86 * 86 *
87 * The ports come in pairs: 87 * The ports come in pairs:
88 * - even number: console connection 88 * - even number: console connection
89 * - odd number: adb connection 89 * - odd number: adb connection
90 * Note that this code doesn't check if the ports are used. 90 * Note that this code doesn't check if the ports are used.
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 * Upload data to the device. 244 * Upload data to the device.
245 */ 245 */
246 Future pushData(Path local, Path remote) { 246 Future pushData(Path local, Path remote) {
247 return _adbCommand(['push', '$local', '$remote']); 247 return _adbCommand(['push', '$local', '$remote']);
248 } 248 }
249 249
250 /** 250 /**
251 * Upload data to the device, unless [local] is the same as the most recently 251 * Upload data to the device, unless [local] is the same as the most recently
252 * used source for [remote]. 252 * used source for [remote].
253 */ 253 */
254 Future pushCachedData(String local, String remote) { 254 Future<AdbCommandResult> pushCachedData(String local, String remote) {
255 if (_cachedData[remote] == local) { 255 if (_cachedData[remote] == local) {
256 return new Future.value( 256 return new Future.value(
257 new AdbCommandResult("Skipped cached push", "", "", 0, false)); 257 new AdbCommandResult("Skipped cached push", "", "", 0, false));
258 } 258 }
259 _cachedData[remote] = local; 259 _cachedData[remote] = local;
260 return _adbCommand(['push', local, remote]); 260 return _adbCommand(['push', local, remote]);
261 } 261 }
262 262
263 /** 263 /**
264 * Change permission of directory recursively. 264 * Change permission of directory recursively.
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 static RegExp _deviceLineRegexp = 383 static RegExp _deviceLineRegexp =
384 new RegExp(r'^([a-zA-Z0-9_-]+)[ \t]+device$', multiLine: true); 384 new RegExp(r'^([a-zA-Z0-9_-]+)[ \t]+device$', multiLine: true);
385 385
386 static Future<List<String>> listDevices() { 386 static Future<List<String>> listDevices() {
387 return Process.run('adb', ['devices']).then((ProcessResult result) { 387 return Process.run('adb', ['devices']).then((ProcessResult result) {
388 if (result.exitCode != 0) { 388 if (result.exitCode != 0) {
389 throw new Exception("Could not list devices [stdout: ${result.stdout}," 389 throw new Exception("Could not list devices [stdout: ${result.stdout},"
390 "stderr: ${result.stderr}]"); 390 "stderr: ${result.stderr}]");
391 } 391 }
392 return _deviceLineRegexp 392 return _deviceLineRegexp
393 .allMatches(result.stdout) 393 .allMatches(result.stdout as String)
394 .map((Match m) => m.group(1)) 394 .map((Match m) => m.group(1))
395 .toList(); 395 .toList();
396 }); 396 });
397 } 397 }
398 } 398 }
399 399
400 /** 400 /**
401 * Represents an android intent. 401 * Represents an android intent.
402 */ 402 */
403 class Intent { 403 class Intent {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 443
444 void releaseDevice(AdbDevice device) { 444 void releaseDevice(AdbDevice device) {
445 if (_waiter.length > 0) { 445 if (_waiter.length > 0) {
446 Completer completer = _waiter.removeFirst(); 446 Completer completer = _waiter.removeFirst();
447 completer.complete(device); 447 completer.complete(device);
448 } else { 448 } else {
449 _idleDevices.add(device); 449 _idleDevices.add(device);
450 } 450 }
451 } 451 }
452 } 452 }
OLDNEW
« no previous file with comments | « tools/testing/dart/analysis_options.yaml ('k') | tools/testing/dart/browser_controller.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698