Prepare packages (minus tools,framework) for use_super_parameters (#100510)

This commit is contained in:
Michael Goderbauer
2022-03-30 15:31:59 -07:00
committed by GitHub
parent ca2d60e8e2
commit 3e406c6781
37 changed files with 147 additions and 183 deletions

View File

@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'deserialization_factory.dart';
import 'enum_util.dart';
import 'find.dart';
import 'message.dart';
@@ -25,20 +24,19 @@ EnumIndex<DiagnosticsType> _diagnosticsTypeIndex = EnumIndex<DiagnosticsType>(Di
/// [diagnosticsType].
class GetDiagnosticsTree extends CommandWithTarget {
/// Creates a [GetDiagnosticsTree] Flutter Driver command.
GetDiagnosticsTree(SerializableFinder finder, this.diagnosticsType, {
GetDiagnosticsTree(super.finder, this.diagnosticsType, {
this.subtreeDepth = 0,
this.includeProperties = true,
Duration? timeout,
super.timeout,
}) : assert(subtreeDepth != null),
assert(includeProperties != null),
super(finder, timeout: timeout);
assert(includeProperties != null);
/// Deserializes this command from the value generated by [serialize].
GetDiagnosticsTree.deserialize(Map<String, String> json, DeserializeFinderFactory finderFactory)
GetDiagnosticsTree.deserialize(super.json, super.finderFactory)
: subtreeDepth = int.parse(json['subtreeDepth']!),
includeProperties = json['includeProperties'] == 'true',
diagnosticsType = _diagnosticsTypeIndex.lookupBySimpleName(json['diagnosticsType']!),
super.deserialize(json, finderFactory);
super.deserialize();
/// How many levels of children to include in the JSON result.
///

View File

@@ -23,14 +23,14 @@ DriverError _createInvalidKeyValueTypeError(String invalidType) {
/// and add more keys to the returned map.
abstract class CommandWithTarget extends Command {
/// Constructs this command given a [finder].
CommandWithTarget(this.finder, {Duration? timeout}) : super(timeout: timeout) {
CommandWithTarget(this.finder, {super.timeout}) {
assert(finder != null, '$runtimeType target cannot be null');
}
/// Deserializes this command from the value generated by [serialize].
CommandWithTarget.deserialize(Map<String, String> json, DeserializeFinderFactory finderFactory)
CommandWithTarget.deserialize(super.json, DeserializeFinderFactory finderFactory)
: finder = finderFactory.deserializeFinder(json),
super.deserialize(json);
super.deserialize();
/// Locates the object or objects targeted by this command.
final SerializableFinder finder;
@@ -54,11 +54,10 @@ class WaitFor extends CommandWithTarget {
/// appear within the [timeout] amount of time.
///
/// If [timeout] is not specified, the command defaults to no timeout.
WaitFor(SerializableFinder finder, {Duration? timeout})
: super(finder, timeout: timeout);
WaitFor(super.finder, {super.timeout});
/// Deserializes this command from the value generated by [serialize].
WaitFor.deserialize(Map<String, String> json, DeserializeFinderFactory finderFactory) : super.deserialize(json, finderFactory);
WaitFor.deserialize(super.json, super.finderFactory) : super.deserialize();
@override
String get kind => 'waitFor';
@@ -70,11 +69,10 @@ class WaitForAbsent extends CommandWithTarget {
/// disappear within the [timeout] amount of time.
///
/// If [timeout] is not specified, the command defaults to no timeout.
WaitForAbsent(SerializableFinder finder, {Duration? timeout})
: super(finder, timeout: timeout);
WaitForAbsent(super.finder, {super.timeout});
/// Deserializes this command from the value generated by [serialize].
WaitForAbsent.deserialize(Map<String, String> json, DeserializeFinderFactory finderFactory) : super.deserialize(json, finderFactory);
WaitForAbsent.deserialize(super.json, super.finderFactory) : super.deserialize();
@override
String get kind => 'waitForAbsent';
@@ -86,13 +84,12 @@ class WaitForTappable extends CommandWithTarget {
/// be tappable within the [timeout] amount of time.
///
/// If [timeout] is not specified, the command defaults to no timeout.
WaitForTappable(SerializableFinder finder, {Duration? timeout})
: super(finder, timeout: timeout);
WaitForTappable(super.finder, {super.timeout});
/// Deserialized this command from the value generated by [serialize].
WaitForTappable.deserialize(
Map<String, String> json, DeserializeFinderFactory finderFactory)
: super.deserialize(json, finderFactory);
super.json, super.finderFactory)
: super.deserialize();
@override
String get kind => 'waitForTappable';
@@ -408,11 +405,11 @@ class Ancestor extends SerializableFinder {
class GetSemanticsId extends CommandWithTarget {
/// Creates a command which finds a Widget and then looks up the semantic id.
GetSemanticsId(SerializableFinder finder, {Duration? timeout}) : super(finder, timeout: timeout);
GetSemanticsId(super.finder, {super.timeout});
/// Creates a command from a JSON map.
GetSemanticsId.deserialize(Map<String, String> json, DeserializeFinderFactory finderFactory)
: super.deserialize(json, finderFactory);
GetSemanticsId.deserialize(super.json, super.finderFactory)
: super.deserialize();
@override
String get kind => 'get_semantics_id';

View File

@@ -7,12 +7,12 @@ import 'message.dart';
/// A Flutter Driver command that enables or disables the FrameSync mechanism.
class SetFrameSync extends Command {
/// Creates a command to toggle the FrameSync mechanism.
const SetFrameSync(this.enabled, { Duration? timeout }) : super(timeout: timeout);
const SetFrameSync(this.enabled, { super.timeout });
/// Deserializes this command from the value generated by [serialize].
SetFrameSync.deserialize(Map<String, String> params)
SetFrameSync.deserialize(super.params)
: enabled = params['enabled']!.toLowerCase() == 'true',
super.deserialize(params);
super.deserialize();
/// Whether frameSync should be enabled or disabled.
final bool enabled;

View File

@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'deserialization_factory.dart';
import 'enum_util.dart';
import 'find.dart';
import 'message.dart';
@@ -34,12 +33,12 @@ EnumIndex<OffsetType> _offsetTypeIndex = EnumIndex<OffsetType>(OffsetType.values
/// to device pixels via [dart:ui.FlutterView.devicePixelRatio].
class GetOffset extends CommandWithTarget {
/// The `finder` looks for an element to get its rect.
GetOffset(SerializableFinder finder, this.offsetType, { Duration? timeout }) : super(finder, timeout: timeout);
GetOffset(super.finder, this.offsetType, { super.timeout });
/// Deserializes this command from the value generated by [serialize].
GetOffset.deserialize(Map<String, String> json, DeserializeFinderFactory finderFactory)
GetOffset.deserialize(super.json, super.finderFactory)
: offsetType = _offsetTypeIndex.lookupBySimpleName(json['offsetType']!),
super.deserialize(json, finderFactory);
super.deserialize();
@override
Map<String, String> serialize() => super.serialize()..addAll(<String, String>{

View File

@@ -2,16 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'deserialization_factory.dart';
import 'find.dart';
/// A Flutter Driver command that taps on a target widget located by [finder].
class Tap extends CommandWithTarget {
/// Creates a tap command to tap on a widget located by [finder].
Tap(SerializableFinder finder, { Duration? timeout }) : super(finder, timeout: timeout);
Tap(super.finder, { super.timeout });
/// Deserializes this command from the value generated by [serialize].
Tap.deserialize(Map<String, String> json, DeserializeFinderFactory finderFactory) : super.deserialize(json, finderFactory);
Tap.deserialize(super.json, super.finderFactory) : super.deserialize();
@override
String get kind => 'tap';
@@ -22,21 +21,21 @@ class Scroll extends CommandWithTarget {
/// Creates a scroll command that will attempt to scroll a scrollable view by
/// dragging a widget located by the given [finder].
Scroll(
SerializableFinder finder,
super.finder,
this.dx,
this.dy,
this.duration,
this.frequency, {
Duration? timeout,
}) : super(finder, timeout: timeout);
super.timeout,
});
/// Deserializes this command from the value generated by [serialize].
Scroll.deserialize(Map<String, String> json, DeserializeFinderFactory finderFactory)
Scroll.deserialize(super.json, super.finderFactory)
: dx = double.parse(json['dx']!),
dy = double.parse(json['dy']!),
duration = Duration(microseconds: int.parse(json['duration']!)),
frequency = int.parse(json['frequency']!),
super.deserialize(json, finderFactory);
super.deserialize();
/// Delta X offset per move event.
final double dx;
@@ -67,12 +66,12 @@ class Scroll extends CommandWithTarget {
class ScrollIntoView extends CommandWithTarget {
/// Creates this command given a [finder] used to locate the widget to be
/// scrolled into view.
ScrollIntoView(SerializableFinder finder, { this.alignment = 0.0, Duration? timeout }) : super(finder, timeout: timeout);
ScrollIntoView(super.finder, { this.alignment = 0.0, super.timeout });
/// Deserializes this command from the value generated by [serialize].
ScrollIntoView.deserialize(Map<String, String> json, DeserializeFinderFactory finderFactory)
ScrollIntoView.deserialize(super.json, super.finderFactory)
: alignment = double.parse(json['alignment']!),
super.deserialize(json, finderFactory);
super.deserialize();
/// How the widget should be aligned.
///

View File

@@ -8,10 +8,10 @@ import 'message.dart';
/// A Flutter Driver command that requests an application health check.
class GetHealth extends Command {
/// Create a health check command.
const GetHealth({ Duration? timeout }) : super(timeout: timeout);
const GetHealth({ super.timeout });
/// Deserializes this command from the value generated by [serialize].
GetHealth.deserialize(Map<String, String> json) : super.deserialize(json);
GetHealth.deserialize(super.json) : super.deserialize();
@override
String get kind => 'get_health';

View File

@@ -7,10 +7,10 @@ import 'message.dart';
/// A Flutter Driver command that requests a string representation of the layer tree.
class GetLayerTree extends Command {
/// Create a command to request a string representation of the layer tree.
const GetLayerTree({ Duration? timeout }) : super(timeout: timeout);
const GetLayerTree({ super.timeout });
/// Deserializes this command from the value generated by [serialize].
GetLayerTree.deserialize(Map<String, String> json) : super.deserialize(json);
GetLayerTree.deserialize(super.json) : super.deserialize();
@override
String get kind => 'get_layer_tree';

View File

@@ -7,10 +7,10 @@ import 'message.dart';
/// A Flutter Driver command that requests a string representation of the render tree.
class GetRenderTree extends Command {
/// Create a command to request a string representation of the render tree.
const GetRenderTree({ Duration? timeout }) : super(timeout: timeout);
const GetRenderTree({ super.timeout });
/// Deserializes this command from the value generated by [serialize].
GetRenderTree.deserialize(Map<String, String> json) : super.deserialize(json);
GetRenderTree.deserialize(super.json) : super.deserialize();
@override
String get kind => 'get_render_tree';

View File

@@ -8,12 +8,12 @@ import 'message.dart';
/// string response.
class RequestData extends Command {
/// Create a command that sends a message.
const RequestData(this.message, { Duration? timeout }) : super(timeout: timeout);
const RequestData(this.message, { super.timeout });
/// Deserializes this command from the value generated by [serialize].
RequestData.deserialize(Map<String, String> params)
RequestData.deserialize(super.params)
: message = params['message'],
super.deserialize(params);
super.deserialize();
/// The message being sent from the test to the application.
final String? message;

View File

@@ -7,12 +7,12 @@ import 'message.dart';
/// A Flutter Driver command that enables or disables semantics.
class SetSemantics extends Command {
/// Creates a command that enables or disables semantics.
const SetSemantics(this.enabled, { Duration? timeout }) : super(timeout: timeout);
const SetSemantics(this.enabled, { super.timeout });
/// Deserializes this command from the value generated by [serialize].
SetSemantics.deserialize(Map<String, String> params)
SetSemantics.deserialize(super.params)
: enabled = params['enabled']!.toLowerCase() == 'true',
super.deserialize(params);
super.deserialize();
/// Whether semantics should be enabled (true) or disabled (false).
final bool enabled;

View File

@@ -2,17 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'deserialization_factory.dart';
import 'find.dart';
import 'message.dart';
/// A Flutter Driver command that reads the text from a given element.
class GetText extends CommandWithTarget {
/// [finder] looks for an element that contains a piece of text.
GetText(SerializableFinder finder, { Duration? timeout }) : super(finder, timeout: timeout);
GetText(super.finder, { super.timeout });
/// Deserializes this command from the value generated by [serialize].
GetText.deserialize(Map<String, String> json, DeserializeFinderFactory finderFactory) : super.deserialize(json, finderFactory);
GetText.deserialize(super.json, super.finderFactory) : super.deserialize();
@override
String get kind => 'get_text';
@@ -40,12 +39,12 @@ class GetTextResult extends Result {
/// A Flutter Driver command that enters text into the currently focused widget.
class EnterText extends Command {
/// Creates a command that enters text into the currently focused widget.
const EnterText(this.text, { Duration? timeout }) : super(timeout: timeout);
const EnterText(this.text, { super.timeout });
/// Deserializes this command from the value generated by [serialize].
EnterText.deserialize(Map<String, String> json)
EnterText.deserialize(super.json)
: text = json['text']!,
super.deserialize(json);
super.deserialize();
/// The text extracted by the [GetText] command.
final String text;
@@ -62,12 +61,12 @@ class EnterText extends Command {
/// A Flutter Driver command that enables and disables text entry emulation.
class SetTextEntryEmulation extends Command {
/// Creates a command that enables and disables text entry emulation.
const SetTextEntryEmulation(this.enabled, { Duration? timeout }) : super(timeout: timeout);
const SetTextEntryEmulation(this.enabled, { super.timeout });
/// Deserializes this command from the value generated by [serialize].
SetTextEntryEmulation.deserialize(Map<String, String> json)
SetTextEntryEmulation.deserialize(super.json)
: enabled = json['enabled'] == 'true',
super.deserialize(json);
super.deserialize();
/// Whether text entry emulation should be enabled.
final bool enabled;

View File

@@ -11,17 +11,16 @@ class WaitForCondition extends Command {
/// Creates a command that waits for the given [condition] is met.
///
/// The [condition] argument must not be null.
const WaitForCondition(this.condition, {Duration? timeout})
: assert(condition != null),
super(timeout: timeout);
const WaitForCondition(this.condition, {super.timeout})
: assert(condition != null);
/// Deserializes this command from the value generated by [serialize].
///
/// The [json] argument cannot be null.
WaitForCondition.deserialize(Map<String, String> json)
WaitForCondition.deserialize(super.json)
: assert(json != null),
condition = _deserialize(json),
super.deserialize(json);
super.deserialize();
/// The condition that this command shall wait for.
final SerializableWaitCondition condition;

View File

@@ -3,7 +3,7 @@ description: Integration and performance test API for Flutter applications
homepage: https://flutter.dev
environment:
sdk: ">=2.12.0-0 <3.0.0"
sdk: ">=2.17.0-0 <3.0.0"
dependencies:
file: 6.1.2

View File

@@ -5,13 +5,12 @@
import 'package:flutter_driver/flutter_driver.dart';
class StubNestedCommand extends CommandWithTarget {
StubNestedCommand(SerializableFinder finder, this.times, {Duration? timeout})
: super(finder, timeout: timeout);
StubNestedCommand(super.finder, this.times, {super.timeout});
StubNestedCommand.deserialize(
Map<String, String> json, DeserializeFinderFactory finderFactory)
super.json, super.finderFactory)
: times = int.parse(json['times']!),
super.deserialize(json, finderFactory);
super.deserialize();
@override
Map<String, String> serialize() {
@@ -25,12 +24,11 @@ class StubNestedCommand extends CommandWithTarget {
}
class StubProberCommand extends CommandWithTarget {
StubProberCommand(SerializableFinder finder, this.times, {Duration? timeout})
: super(finder, timeout: timeout);
StubProberCommand(super.finder, this.times, {super.timeout});
StubProberCommand.deserialize(Map<String, String> json, DeserializeFinderFactory finderFactory)
StubProberCommand.deserialize(super.json, super.finderFactory)
: times = int.parse(json['times']!),
super.deserialize(json, finderFactory);
super.deserialize();
@override
Map<String, String> serialize() {