Commit 5a9063f5 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Remove waitForElement-specific timeout. (#7442)

It is now handled at a higher level for all commands.
parent 6d84e4aa
...@@ -21,7 +21,6 @@ import 'render_tree.dart'; ...@@ -21,7 +21,6 @@ import 'render_tree.dart';
const String _extensionMethodName = 'driver'; const String _extensionMethodName = 'driver';
const String _extensionMethod = 'ext.flutter.$_extensionMethodName'; const String _extensionMethod = 'ext.flutter.$_extensionMethodName';
const Duration _kDefaultTimeout = const Duration(seconds: 5);
class _DriverBinding extends WidgetsFlutterBinding { // TODO(ianh): refactor so we're not extending a concrete binding class _DriverBinding extends WidgetsFlutterBinding { // TODO(ianh): refactor so we're not extending a concrete binding
@override @override
...@@ -156,9 +155,7 @@ class _FlutterDriverExtension { ...@@ -156,9 +155,7 @@ class _FlutterDriverExtension {
return new RenderTree(RendererBinding.instance?.renderView?.toStringDeep()); return new RenderTree(RendererBinding.instance?.renderView?.toStringDeep());
} }
/// Runs `finder` repeatedly until it finds one or more [Element]s, or times out. /// Runs `finder` repeatedly until it finds one or more [Element]s.
///
/// The timeout is five seconds.
Future<Finder> _waitForElement(Finder finder) { Future<Finder> _waitForElement(Finder finder) {
// Short-circuit if the element is already on the UI // Short-circuit if the element is already on the UI
if (finder.precache()) if (finder.precache())
...@@ -168,15 +165,9 @@ class _FlutterDriverExtension { ...@@ -168,15 +165,9 @@ class _FlutterDriverExtension {
Completer<Finder> completer = new Completer<Finder>(); Completer<Finder> completer = new Completer<Finder>();
StreamSubscription<Duration> subscription; StreamSubscription<Duration> subscription;
Timer timeout = new Timer(_kDefaultTimeout, () {
subscription.cancel();
completer.completeError('Timed out waiting for ${finder.description}');
});
subscription = _onFrameReady.listen((Duration duration) { subscription = _onFrameReady.listen((Duration duration) {
if (finder.precache()) { if (finder.precache()) {
subscription.cancel(); subscription.cancel();
timeout.cancel();
completer.complete(finder); completer.complete(finder);
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment