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,
@override
void initServiceExtensions() {
super.initServiceExtensions();
final FlutterDriverExtension extension = FlutterDriverExtension(_handler, _silenceErrors, finders);
final FlutterDriverExtension extension = FlutterDriverExtension(_handler, _silenceErrors, finders: finders);
registerServiceExtension(
name: _extensionMethodName,
callback: extension.call,
......@@ -171,7 +171,11 @@ abstract class FinderExtension {
@visibleForTesting
class FlutterDriverExtension with DeserializeFinderFactory {
/// 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();
_commandHandlers.addAll(<String, CommandHandlerCallback>{
......
......@@ -37,7 +37,7 @@ void main() {
setUp(() {
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 {
......@@ -98,7 +98,7 @@ void main() {
setUp(() {
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 {
......@@ -464,7 +464,7 @@ void main() {
group('getSemanticsId', () {
FlutterDriverExtension extension;
setUp(() {
extension = FlutterDriverExtension((String arg) async => '', true, <FinderExtension>[]);
extension = FlutterDriverExtension((String arg) async => '', true);
});
testWidgets('works when semantics are enabled', (WidgetTester tester) async {
......@@ -513,7 +513,7 @@ void main() {
});
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 {
final Map<String, String> arguments = GetOffset(ByValueKey(1), offset).serialize();
......@@ -545,7 +545,7 @@ void main() {
testWidgets('getText', (WidgetTester tester) 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 {
final Map<String, String> arguments = GetText(search, timeout: const Duration(seconds: 1)).serialize();
......@@ -615,7 +615,7 @@ void main() {
testWidgets('descendant finder', (WidgetTester tester) 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 {
final Map<String, String> arguments = GetText(Descendant(
......@@ -660,7 +660,7 @@ void main() {
testWidgets('descendant finder firstMatchOnly', (WidgetTester tester) 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 {
final Map<String, String> arguments = GetText(Descendant(
......@@ -694,7 +694,7 @@ void main() {
testWidgets('ancestor finder', (WidgetTester tester) 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 {
final Map<String, String> arguments = GetOffset(Ancestor(
......@@ -764,7 +764,7 @@ void main() {
testWidgets('ancestor finder firstMatchOnly', (WidgetTester tester) 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 {
final Map<String, String> arguments = GetOffset(Ancestor(
......@@ -812,7 +812,7 @@ void main() {
});
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 {
final Map<String, String> arguments = GetDiagnosticsTree(finder, type, subtreeDepth: depth, includeProperties: properties).serialize();
......@@ -882,7 +882,7 @@ void main() {
Map<String, dynamic> result;
setUp(() {
extension = FlutterDriverExtension((String arg) async => '', true, <FinderExtension>[]);
extension = FlutterDriverExtension((String arg) async => '', true);
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