Commit 99e916d0 authored by Yegor's avatar Yegor

[driver] fix analyzer warnings in the extension (#3205)

parent 63358728
...@@ -42,7 +42,7 @@ void enableFlutterDriverExtension() { ...@@ -42,7 +42,7 @@ void enableFlutterDriverExtension() {
} }
/// Handles a command and returns a result. /// Handles a command and returns a result.
typedef Future<R> CommandHandlerCallback<R extends Result>(Command c); typedef Future<Result> CommandHandlerCallback(Command c);
/// Deserializes JSON map to a command object. /// Deserializes JSON map to a command object.
typedef Command CommandDeserializerCallback(Map<String, String> params); typedef Command CommandDeserializerCallback(Map<String, String> params);
...@@ -93,7 +93,7 @@ class FlutterDriverExtension { ...@@ -93,7 +93,7 @@ class FlutterDriverExtension {
Command command = commandDeserializer(params); Command command = commandDeserializer(params);
return commandHandler(command).then((Result result) { return commandHandler(command).then((Result result) {
return new ServiceExtensionResponse.result(JSON.encode(result.toJson())); return new ServiceExtensionResponse.result(JSON.encode(result.toJson()));
}, onError: (e, s) { }, onError: (Object e, Object s) {
_log.warning('$e:\n$s'); _log.warning('$e:\n$s');
return new ServiceExtensionResponse.error(ServiceExtensionResponse.extensionError, '$e'); return new ServiceExtensionResponse.error(ServiceExtensionResponse.extensionError, '$e');
}); });
...@@ -122,9 +122,9 @@ class FlutterDriverExtension { ...@@ -122,9 +122,9 @@ class FlutterDriverExtension {
/// [descriptionGetter] describes the object to be waited for. It is used in /// [descriptionGetter] describes the object to be waited for. It is used in
/// the warning printed should timeout happen. /// the warning printed should timeout happen.
Future<ObjectRef> _waitForObject(String descriptionGetter(), Object locator()) async { Future<ObjectRef> _waitForObject(String descriptionGetter(), Object locator()) async {
Object object = await retry(locator, _kDefaultTimeout, _kDefaultPauseBetweenRetries, predicate: (object) { Object object = await retry(locator, _kDefaultTimeout, _kDefaultPauseBetweenRetries, predicate: (Object object) {
return object != null; return object != null;
}).catchError((dynamic error, stackTrace) { }).catchError((Object error, Object stackTrace) {
_log.warning('Timed out waiting for ${descriptionGetter()}'); _log.warning('Timed out waiting for ${descriptionGetter()}');
return null; return null;
}); });
...@@ -132,7 +132,7 @@ class FlutterDriverExtension { ...@@ -132,7 +132,7 @@ class FlutterDriverExtension {
ObjectRef elemRef = object != null ObjectRef elemRef = object != null
? new ObjectRef(_registerObject(object)) ? new ObjectRef(_registerObject(object))
: new ObjectRef.notFound(); : new ObjectRef.notFound();
return new Future.value(elemRef); return new Future<ObjectRef>.value(elemRef);
} }
Future<ObjectRef> findByValueKey(ByValueKey byKey) async { Future<ObjectRef> findByValueKey(ByValueKey byKey) async {
...@@ -220,8 +220,8 @@ class FlutterDriverExtension { ...@@ -220,8 +220,8 @@ class FlutterDriverExtension {
Element object = _dereference(reference); Element object = _dereference(reference);
if (object == null) if (object == null)
return new Future.error('Object reference not found ($reference).'); return new Future<String>.error('Object reference not found ($reference).');
return new Future.value(object); return new Future<Element>.value(object);
} }
} }
...@@ -4,8 +4,12 @@ ...@@ -4,8 +4,12 @@
import 'flutter_driver_test.dart' as flutter_driver_test; import 'flutter_driver_test.dart' as flutter_driver_test;
import 'src/retry_test.dart' as retry_test; import 'src/retry_test.dart' as retry_test;
import 'src/timeline_test.dart' as timeline_test;
import 'src/timeline_summary_test.dart' as timeline_summary_test;
void main() { void main() {
flutter_driver_test.main(); flutter_driver_test.main();
retry_test.main(); retry_test.main();
timeline_summary_test.main();
timeline_test.main();
} }
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