Unverified Commit 2acd1708 authored by Dan Field's avatar Dan Field Committed by GitHub

Make parameter optional (#65444)

parent 021c2010
...@@ -52,7 +52,7 @@ class _DriverBinding extends BindingBase with SchedulerBinding, ServicesBinding, ...@@ -52,7 +52,7 @@ class _DriverBinding extends BindingBase with SchedulerBinding, ServicesBinding,
@override @override
void initServiceExtensions() { void initServiceExtensions() {
super.initServiceExtensions(); super.initServiceExtensions();
final FlutterDriverExtension extension = FlutterDriverExtension(_handler, _silenceErrors, finders); final FlutterDriverExtension extension = FlutterDriverExtension(_handler, _silenceErrors, finders: finders);
registerServiceExtension( registerServiceExtension(
name: _extensionMethodName, name: _extensionMethodName,
callback: extension.call, callback: extension.call,
...@@ -171,7 +171,11 @@ abstract class FinderExtension { ...@@ -171,7 +171,11 @@ abstract class FinderExtension {
@visibleForTesting @visibleForTesting
class FlutterDriverExtension with DeserializeFinderFactory { class FlutterDriverExtension with DeserializeFinderFactory {
/// Creates an object to manage a Flutter Driver connection. /// Creates an object to manage a Flutter Driver connection.
FlutterDriverExtension(this._requestDataHandler, this._silenceErrors, List<FinderExtension> finders) { FlutterDriverExtension(
this._requestDataHandler,
this._silenceErrors, {
List<FinderExtension> finders = const <FinderExtension>[],
}) : assert(finders != null) {
_testTextInput.register(); _testTextInput.register();
_commandHandlers.addAll(<String, CommandHandlerCallback>{ _commandHandlers.addAll(<String, CommandHandlerCallback>{
......
...@@ -37,7 +37,7 @@ void main() { ...@@ -37,7 +37,7 @@ void main() {
setUp(() { setUp(() {
result = null; result = null;
extension = FlutterDriverExtension((String message) async { log.add(message); return (messageId += 1).toString(); }, false, <FinderExtension>[]); extension = FlutterDriverExtension((String message) async { log.add(message); return (messageId += 1).toString(); }, false);
}); });
testWidgets('returns immediately when transient callback queue is empty', (WidgetTester tester) async { testWidgets('returns immediately when transient callback queue is empty', (WidgetTester tester) async {
...@@ -98,7 +98,7 @@ void main() { ...@@ -98,7 +98,7 @@ void main() {
setUp(() { setUp(() {
result = null; result = null;
extension = FlutterDriverExtension((String message) async { log.add(message); return (messageId += 1).toString(); }, false, <FinderExtension>[]); extension = FlutterDriverExtension((String message) async { log.add(message); return (messageId += 1).toString(); }, false);
}); });
testWidgets('waiting for NoTransientCallbacks returns immediately when transient callback queue is empty', (WidgetTester tester) async { testWidgets('waiting for NoTransientCallbacks returns immediately when transient callback queue is empty', (WidgetTester tester) async {
...@@ -464,7 +464,7 @@ void main() { ...@@ -464,7 +464,7 @@ void main() {
group('getSemanticsId', () { group('getSemanticsId', () {
FlutterDriverExtension extension; FlutterDriverExtension extension;
setUp(() { setUp(() {
extension = FlutterDriverExtension((String arg) async => '', true, <FinderExtension>[]); extension = FlutterDriverExtension((String arg) async => '', true);
}); });
testWidgets('works when semantics are enabled', (WidgetTester tester) async { testWidgets('works when semantics are enabled', (WidgetTester tester) async {
...@@ -513,7 +513,7 @@ void main() { ...@@ -513,7 +513,7 @@ void main() {
}); });
testWidgets('getOffset', (WidgetTester tester) async { testWidgets('getOffset', (WidgetTester tester) async {
final FlutterDriverExtension extension = FlutterDriverExtension((String arg) async => '', true, <FinderExtension>[]); final FlutterDriverExtension extension = FlutterDriverExtension((String arg) async => '', true);
Future<Offset> getOffset(OffsetType offset) async { Future<Offset> getOffset(OffsetType offset) async {
final Map<String, String> arguments = GetOffset(ByValueKey(1), offset).serialize(); final Map<String, String> arguments = GetOffset(ByValueKey(1), offset).serialize();
...@@ -545,7 +545,7 @@ void main() { ...@@ -545,7 +545,7 @@ void main() {
testWidgets('getText', (WidgetTester tester) async { testWidgets('getText', (WidgetTester tester) async {
await silenceDriverLogger(() async { await silenceDriverLogger(() async {
final FlutterDriverExtension extension = FlutterDriverExtension((String arg) async => '', true, <FinderExtension>[]); final FlutterDriverExtension extension = FlutterDriverExtension((String arg) async => '', true);
Future<String> getTextInternal(SerializableFinder search) async { Future<String> getTextInternal(SerializableFinder search) async {
final Map<String, String> arguments = GetText(search, timeout: const Duration(seconds: 1)).serialize(); final Map<String, String> arguments = GetText(search, timeout: const Duration(seconds: 1)).serialize();
...@@ -615,7 +615,7 @@ void main() { ...@@ -615,7 +615,7 @@ void main() {
testWidgets('descendant finder', (WidgetTester tester) async { testWidgets('descendant finder', (WidgetTester tester) async {
await silenceDriverLogger(() async { await silenceDriverLogger(() async {
final FlutterDriverExtension extension = FlutterDriverExtension((String arg) async => '', true, <FinderExtension>[]); final FlutterDriverExtension extension = FlutterDriverExtension((String arg) async => '', true);
Future<String> getDescendantText({ String of, bool matchRoot = false}) async { Future<String> getDescendantText({ String of, bool matchRoot = false}) async {
final Map<String, String> arguments = GetText(Descendant( final Map<String, String> arguments = GetText(Descendant(
...@@ -660,7 +660,7 @@ void main() { ...@@ -660,7 +660,7 @@ void main() {
testWidgets('descendant finder firstMatchOnly', (WidgetTester tester) async { testWidgets('descendant finder firstMatchOnly', (WidgetTester tester) async {
await silenceDriverLogger(() async { await silenceDriverLogger(() async {
final FlutterDriverExtension extension = FlutterDriverExtension((String arg) async => '', true, <FinderExtension>[]); final FlutterDriverExtension extension = FlutterDriverExtension((String arg) async => '', true);
Future<String> getDescendantText() async { Future<String> getDescendantText() async {
final Map<String, String> arguments = GetText(Descendant( final Map<String, String> arguments = GetText(Descendant(
...@@ -694,7 +694,7 @@ void main() { ...@@ -694,7 +694,7 @@ void main() {
testWidgets('ancestor finder', (WidgetTester tester) async { testWidgets('ancestor finder', (WidgetTester tester) async {
await silenceDriverLogger(() async { await silenceDriverLogger(() async {
final FlutterDriverExtension extension = FlutterDriverExtension((String arg) async => '', true, <FinderExtension>[]); final FlutterDriverExtension extension = FlutterDriverExtension((String arg) async => '', true);
Future<Offset> getAncestorTopLeft({ String of, String matching, bool matchRoot = false}) async { Future<Offset> getAncestorTopLeft({ String of, String matching, bool matchRoot = false}) async {
final Map<String, String> arguments = GetOffset(Ancestor( final Map<String, String> arguments = GetOffset(Ancestor(
...@@ -764,7 +764,7 @@ void main() { ...@@ -764,7 +764,7 @@ void main() {
testWidgets('ancestor finder firstMatchOnly', (WidgetTester tester) async { testWidgets('ancestor finder firstMatchOnly', (WidgetTester tester) async {
await silenceDriverLogger(() async { await silenceDriverLogger(() async {
final FlutterDriverExtension extension = FlutterDriverExtension((String arg) async => '', true, <FinderExtension>[]); final FlutterDriverExtension extension = FlutterDriverExtension((String arg) async => '', true);
Future<Offset> getAncestorTopLeft() async { Future<Offset> getAncestorTopLeft() async {
final Map<String, String> arguments = GetOffset(Ancestor( final Map<String, String> arguments = GetOffset(Ancestor(
...@@ -812,7 +812,7 @@ void main() { ...@@ -812,7 +812,7 @@ void main() {
}); });
testWidgets('GetDiagnosticsTree', (WidgetTester tester) async { testWidgets('GetDiagnosticsTree', (WidgetTester tester) async {
final FlutterDriverExtension extension = FlutterDriverExtension((String arg) async => '', true, <FinderExtension>[]); final FlutterDriverExtension extension = FlutterDriverExtension((String arg) async => '', true);
Future<Map<String, Object>> getDiagnosticsTree(DiagnosticsType type, SerializableFinder finder, { int depth = 0, bool properties = true }) async { Future<Map<String, Object>> getDiagnosticsTree(DiagnosticsType type, SerializableFinder finder, { int depth = 0, bool properties = true }) async {
final Map<String, String> arguments = GetDiagnosticsTree(finder, type, subtreeDepth: depth, includeProperties: properties).serialize(); final Map<String, String> arguments = GetDiagnosticsTree(finder, type, subtreeDepth: depth, includeProperties: properties).serialize();
...@@ -882,7 +882,7 @@ void main() { ...@@ -882,7 +882,7 @@ void main() {
Map<String, dynamic> result; Map<String, dynamic> result;
setUp(() { setUp(() {
extension = FlutterDriverExtension((String arg) async => '', true, <FinderExtension>[]); extension = FlutterDriverExtension((String arg) async => '', true);
result = null; result = null;
}); });
......
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