Remove unnecessary null checks in flutter_driver (#118864)
This commit is contained in:
parent
83720015a4
commit
288a7733e5
@ -28,8 +28,7 @@ class GetDiagnosticsTree extends CommandWithTarget {
|
|||||||
this.subtreeDepth = 0,
|
this.subtreeDepth = 0,
|
||||||
this.includeProperties = true,
|
this.includeProperties = true,
|
||||||
super.timeout,
|
super.timeout,
|
||||||
}) : assert(subtreeDepth != null),
|
});
|
||||||
assert(includeProperties != null);
|
|
||||||
|
|
||||||
/// Deserializes this command from the value generated by [serialize].
|
/// Deserializes this command from the value generated by [serialize].
|
||||||
GetDiagnosticsTree.deserialize(super.json, super.finderFactory)
|
GetDiagnosticsTree.deserialize(super.json, super.finderFactory)
|
||||||
|
@ -23,9 +23,7 @@ DriverError _createInvalidKeyValueTypeError(String invalidType) {
|
|||||||
/// and add more keys to the returned map.
|
/// and add more keys to the returned map.
|
||||||
abstract class CommandWithTarget extends Command {
|
abstract class CommandWithTarget extends Command {
|
||||||
/// Constructs this command given a [finder].
|
/// Constructs this command given a [finder].
|
||||||
CommandWithTarget(this.finder, {super.timeout}) {
|
CommandWithTarget(this.finder, {super.timeout});
|
||||||
assert(finder != null, '$runtimeType target cannot be null');
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Deserializes this command from the value generated by [serialize].
|
/// Deserializes this command from the value generated by [serialize].
|
||||||
CommandWithTarget.deserialize(super.json, DeserializeFinderFactory finderFactory)
|
CommandWithTarget.deserialize(super.json, DeserializeFinderFactory finderFactory)
|
||||||
|
@ -260,7 +260,6 @@ mixin CommandHandlerFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<Result> _waitForCondition(Command command) async {
|
Future<Result> _waitForCondition(Command command) async {
|
||||||
assert(command != null);
|
|
||||||
final WaitForCondition waitForConditionCommand = command as WaitForCondition;
|
final WaitForCondition waitForConditionCommand = command as WaitForCondition;
|
||||||
final WaitCondition condition = deserializeCondition(waitForConditionCommand.condition);
|
final WaitCondition condition = deserializeCondition(waitForConditionCommand.condition);
|
||||||
await condition.wait();
|
await condition.wait();
|
||||||
|
@ -36,8 +36,7 @@ final EnumIndex<HealthStatus> _healthStatusIndex =
|
|||||||
/// [FlutterDriver.checkHealth] test.
|
/// [FlutterDriver.checkHealth] test.
|
||||||
class Health extends Result {
|
class Health extends Result {
|
||||||
/// Creates a [Health] object with the given [status].
|
/// Creates a [Health] object with the given [status].
|
||||||
const Health(this.status)
|
const Health(this.status);
|
||||||
: assert(status != null);
|
|
||||||
|
|
||||||
/// The status represented by this object.
|
/// The status represented by this object.
|
||||||
///
|
///
|
||||||
|
@ -11,15 +11,13 @@ class WaitForCondition extends Command {
|
|||||||
/// Creates a command that waits for the given [condition] is met.
|
/// Creates a command that waits for the given [condition] is met.
|
||||||
///
|
///
|
||||||
/// The [condition] argument must not be null.
|
/// The [condition] argument must not be null.
|
||||||
const WaitForCondition(this.condition, {super.timeout})
|
const WaitForCondition(this.condition, {super.timeout});
|
||||||
: assert(condition != null);
|
|
||||||
|
|
||||||
/// Deserializes this command from the value generated by [serialize].
|
/// Deserializes this command from the value generated by [serialize].
|
||||||
///
|
///
|
||||||
/// The [json] argument cannot be null.
|
/// The [json] argument cannot be null.
|
||||||
WaitForCondition.deserialize(super.json)
|
WaitForCondition.deserialize(super.json)
|
||||||
: assert(json != null),
|
: condition = _deserialize(json),
|
||||||
condition = _deserialize(json),
|
|
||||||
super.deserialize();
|
super.deserialize();
|
||||||
|
|
||||||
/// The condition that this command shall wait for.
|
/// The condition that this command shall wait for.
|
||||||
@ -94,7 +92,6 @@ class NoTransientCallbacks extends SerializableWaitCondition {
|
|||||||
///
|
///
|
||||||
/// The [json] argument must not be null.
|
/// The [json] argument must not be null.
|
||||||
factory NoTransientCallbacks.deserialize(Map<String, String> json) {
|
factory NoTransientCallbacks.deserialize(Map<String, String> json) {
|
||||||
assert(json != null);
|
|
||||||
if (json['conditionName'] != 'NoTransientCallbacksCondition') {
|
if (json['conditionName'] != 'NoTransientCallbacksCondition') {
|
||||||
throw SerializationException('Error occurred during deserializing the NoTransientCallbacksCondition JSON string: $json');
|
throw SerializationException('Error occurred during deserializing the NoTransientCallbacksCondition JSON string: $json');
|
||||||
}
|
}
|
||||||
@ -115,7 +112,6 @@ class NoPendingFrame extends SerializableWaitCondition {
|
|||||||
///
|
///
|
||||||
/// The [json] argument must not be null.
|
/// The [json] argument must not be null.
|
||||||
factory NoPendingFrame.deserialize(Map<String, String> json) {
|
factory NoPendingFrame.deserialize(Map<String, String> json) {
|
||||||
assert(json != null);
|
|
||||||
if (json['conditionName'] != 'NoPendingFrameCondition') {
|
if (json['conditionName'] != 'NoPendingFrameCondition') {
|
||||||
throw SerializationException('Error occurred during deserializing the NoPendingFrameCondition JSON string: $json');
|
throw SerializationException('Error occurred during deserializing the NoPendingFrameCondition JSON string: $json');
|
||||||
}
|
}
|
||||||
@ -136,7 +132,6 @@ class FirstFrameRasterized extends SerializableWaitCondition {
|
|||||||
///
|
///
|
||||||
/// The [json] argument must not be null.
|
/// The [json] argument must not be null.
|
||||||
factory FirstFrameRasterized.deserialize(Map<String, String> json) {
|
factory FirstFrameRasterized.deserialize(Map<String, String> json) {
|
||||||
assert(json != null);
|
|
||||||
if (json['conditionName'] != 'FirstFrameRasterizedCondition') {
|
if (json['conditionName'] != 'FirstFrameRasterizedCondition') {
|
||||||
throw SerializationException('Error occurred during deserializing the FirstFrameRasterizedCondition JSON string: $json');
|
throw SerializationException('Error occurred during deserializing the FirstFrameRasterizedCondition JSON string: $json');
|
||||||
}
|
}
|
||||||
@ -160,7 +155,6 @@ class NoPendingPlatformMessages extends SerializableWaitCondition {
|
|||||||
///
|
///
|
||||||
/// The [json] argument must not be null.
|
/// The [json] argument must not be null.
|
||||||
factory NoPendingPlatformMessages.deserialize(Map<String, String> json) {
|
factory NoPendingPlatformMessages.deserialize(Map<String, String> json) {
|
||||||
assert(json != null);
|
|
||||||
if (json['conditionName'] != 'NoPendingPlatformMessagesCondition') {
|
if (json['conditionName'] != 'NoPendingPlatformMessagesCondition') {
|
||||||
throw SerializationException('Error occurred during deserializing the NoPendingPlatformMessagesCondition JSON string: $json');
|
throw SerializationException('Error occurred during deserializing the NoPendingPlatformMessagesCondition JSON string: $json');
|
||||||
}
|
}
|
||||||
@ -176,15 +170,13 @@ class CombinedCondition extends SerializableWaitCondition {
|
|||||||
/// Creates a [CombinedCondition] condition.
|
/// Creates a [CombinedCondition] condition.
|
||||||
///
|
///
|
||||||
/// The [conditions] argument must not be null.
|
/// The [conditions] argument must not be null.
|
||||||
const CombinedCondition(this.conditions)
|
const CombinedCondition(this.conditions);
|
||||||
: assert(conditions != null);
|
|
||||||
|
|
||||||
/// Factory constructor to parse a [CombinedCondition] instance from the
|
/// Factory constructor to parse a [CombinedCondition] instance from the
|
||||||
/// given JSON map.
|
/// given JSON map.
|
||||||
///
|
///
|
||||||
/// The [jsonMap] argument must not be null.
|
/// The [jsonMap] argument must not be null.
|
||||||
factory CombinedCondition.deserialize(Map<String, String> jsonMap) {
|
factory CombinedCondition.deserialize(Map<String, String> jsonMap) {
|
||||||
assert(jsonMap != null);
|
|
||||||
if (jsonMap['conditionName'] != 'CombinedCondition') {
|
if (jsonMap['conditionName'] != 'CombinedCondition') {
|
||||||
throw SerializationException('Error occurred during deserializing the CombinedCondition JSON string: $jsonMap');
|
throw SerializationException('Error occurred during deserializing the CombinedCondition JSON string: $jsonMap');
|
||||||
}
|
}
|
||||||
@ -210,7 +202,6 @@ class CombinedCondition extends SerializableWaitCondition {
|
|||||||
final Map<String, String> jsonMap = super.serialize();
|
final Map<String, String> jsonMap = super.serialize();
|
||||||
final List<Map<String, String>> jsonConditions = conditions.map(
|
final List<Map<String, String>> jsonConditions = conditions.map(
|
||||||
(SerializableWaitCondition condition) {
|
(SerializableWaitCondition condition) {
|
||||||
assert(condition != null);
|
|
||||||
return condition.serialize();
|
return condition.serialize();
|
||||||
}).toList();
|
}).toList();
|
||||||
jsonMap['conditions'] = json.encode(jsonConditions);
|
jsonMap['conditions'] = json.encode(jsonConditions);
|
||||||
@ -222,7 +213,6 @@ class CombinedCondition extends SerializableWaitCondition {
|
|||||||
///
|
///
|
||||||
/// The [json] argument must not be null.
|
/// The [json] argument must not be null.
|
||||||
SerializableWaitCondition _deserialize(Map<String, String> json) {
|
SerializableWaitCondition _deserialize(Map<String, String> json) {
|
||||||
assert(json != null);
|
|
||||||
final String conditionName = json['conditionName']!;
|
final String conditionName = json['conditionName']!;
|
||||||
switch (conditionName) {
|
switch (conditionName) {
|
||||||
case 'NoTransientCallbacksCondition':
|
case 'NoTransientCallbacksCondition':
|
||||||
|
@ -432,11 +432,6 @@ abstract class FlutterDriver {
|
|||||||
double dyScroll = 0.0,
|
double dyScroll = 0.0,
|
||||||
Duration? timeout,
|
Duration? timeout,
|
||||||
}) async {
|
}) async {
|
||||||
assert(scrollable != null);
|
|
||||||
assert(item != null);
|
|
||||||
assert(alignment != null);
|
|
||||||
assert(dxScroll != null);
|
|
||||||
assert(dyScroll != null);
|
|
||||||
assert(dxScroll != 0.0 || dyScroll != 0.0);
|
assert(dxScroll != 0.0 || dyScroll != 0.0);
|
||||||
|
|
||||||
// Kick off an (unawaited) waitFor that will complete when the item we're
|
// Kick off an (unawaited) waitFor that will complete when the item we're
|
||||||
@ -509,7 +504,6 @@ abstract class FlutterDriver {
|
|||||||
/// invoked when the widget is focused, as the [SystemChannels.textInput]
|
/// invoked when the widget is focused, as the [SystemChannels.textInput]
|
||||||
/// channel will be mocked out.
|
/// channel will be mocked out.
|
||||||
Future<void> setTextEntryEmulation({ required bool enabled, Duration? timeout }) async {
|
Future<void> setTextEntryEmulation({ required bool enabled, Duration? timeout }) async {
|
||||||
assert(enabled != null);
|
|
||||||
await sendCommand(SetTextEntryEmulation(enabled, timeout: timeout));
|
await sendCommand(SetTextEntryEmulation(enabled, timeout: timeout));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,7 +531,6 @@ abstract class FlutterDriver {
|
|||||||
///
|
///
|
||||||
Future<void> sendTextInputAction(TextInputAction action,
|
Future<void> sendTextInputAction(TextInputAction action,
|
||||||
{Duration? timeout}) async {
|
{Duration? timeout}) async {
|
||||||
assert(action != null);
|
|
||||||
await sendCommand(SendTextInputAction(action, timeout: timeout));
|
await sendCommand(SendTextInputAction(action, timeout: timeout));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ class VMServiceFlutterDriver extends FlutterDriver {
|
|||||||
// Let subsequent isolates start automatically.
|
// Let subsequent isolates start automatically.
|
||||||
try {
|
try {
|
||||||
final vms.Response result = await client.setFlag('pause_isolates_on_start', 'false');
|
final vms.Response result = await client.setFlag('pause_isolates_on_start', 'false');
|
||||||
if (result == null || result.type != 'Success') {
|
if (result.type != 'Success') {
|
||||||
_log('setFlag failure: $result');
|
_log('setFlag failure: $result');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -348,7 +348,6 @@ class VMServiceFlutterDriver extends FlutterDriver {
|
|||||||
_log(message);
|
_log(message);
|
||||||
}
|
}
|
||||||
if (_logCommunicationToFile) {
|
if (_logCommunicationToFile) {
|
||||||
assert(_logFilePathName != null);
|
|
||||||
final f.File file = fs.file(_logFilePathName);
|
final f.File file = fs.file(_logFilePathName);
|
||||||
file.createSync(recursive: true); // no-op if file exists
|
file.createSync(recursive: true); // no-op if file exists
|
||||||
file.writeAsStringSync('${DateTime.now()} $message\n', mode: f.FileMode.append, flush: true);
|
file.writeAsStringSync('${DateTime.now()} $message\n', mode: f.FileMode.append, flush: true);
|
||||||
@ -380,8 +379,7 @@ class VMServiceFlutterDriver extends FlutterDriver {
|
|||||||
List<TimelineStream> streams = const <TimelineStream>[TimelineStream.all],
|
List<TimelineStream> streams = const <TimelineStream>[TimelineStream.all],
|
||||||
Duration timeout = kUnusuallyLongTimeout,
|
Duration timeout = kUnusuallyLongTimeout,
|
||||||
}) async {
|
}) async {
|
||||||
assert(streams != null && streams.isNotEmpty);
|
assert(streams.isNotEmpty);
|
||||||
assert(timeout != null);
|
|
||||||
try {
|
try {
|
||||||
await _warnIfSlow<vms.Success>(
|
await _warnIfSlow<vms.Success>(
|
||||||
future: _serviceClient.setVMTimelineFlags(
|
future: _serviceClient.setVMTimelineFlags(
|
||||||
@ -405,7 +403,6 @@ class VMServiceFlutterDriver extends FlutterDriver {
|
|||||||
int? startTime,
|
int? startTime,
|
||||||
int? endTime,
|
int? endTime,
|
||||||
}) async {
|
}) async {
|
||||||
assert(timeout != null);
|
|
||||||
assert((startTime == null && endTime == null) ||
|
assert((startTime == null && endTime == null) ||
|
||||||
(startTime != null && endTime != null));
|
(startTime != null && endTime != null));
|
||||||
|
|
||||||
@ -497,7 +494,6 @@ class VMServiceFlutterDriver extends FlutterDriver {
|
|||||||
Future<void> clearTimeline({
|
Future<void> clearTimeline({
|
||||||
Duration timeout = kUnusuallyLongTimeout,
|
Duration timeout = kUnusuallyLongTimeout,
|
||||||
}) async {
|
}) async {
|
||||||
assert(timeout != null);
|
|
||||||
try {
|
try {
|
||||||
await _warnIfSlow<vms.Success>(
|
await _warnIfSlow<vms.Success>(
|
||||||
future: _serviceClient.clearVMTimeline(),
|
future: _serviceClient.clearVMTimeline(),
|
||||||
@ -630,9 +626,6 @@ Future<T> _warnIfSlow<T>({
|
|||||||
required Duration timeout,
|
required Duration timeout,
|
||||||
required String message,
|
required String message,
|
||||||
}) async {
|
}) async {
|
||||||
assert(future != null);
|
|
||||||
assert(timeout != null);
|
|
||||||
assert(message != null);
|
|
||||||
final Completer<void> completer = Completer<void>();
|
final Completer<void> completer = Completer<void>();
|
||||||
completer.future.timeout(timeout, onTimeout: () {
|
completer.future.timeout(timeout, onTimeout: () {
|
||||||
_log(message);
|
_log(message);
|
||||||
|
@ -174,7 +174,6 @@ class WebFlutterDriver extends FlutterDriver {
|
|||||||
driverLog('WebFlutterDriver', message);
|
driverLog('WebFlutterDriver', message);
|
||||||
}
|
}
|
||||||
if (_logCommunicationToFile) {
|
if (_logCommunicationToFile) {
|
||||||
assert(_logFilePathName != null);
|
|
||||||
final File file = fs.file(_logFilePathName);
|
final File file = fs.file(_logFilePathName);
|
||||||
file.createSync(recursive: true); // no-op if file exists
|
file.createSync(recursive: true); // no-op if file exists
|
||||||
file.writeAsStringSync('${DateTime.now()} $message\n', mode: FileMode.append, flush: true);
|
file.writeAsStringSync('${DateTime.now()} $message\n', mode: FileMode.append, flush: true);
|
||||||
|
@ -319,7 +319,7 @@ class FlutterDriverExtension with DeserializeFinderFactory, CreateFinderFactory,
|
|||||||
this._enableTextEntryEmulation, {
|
this._enableTextEntryEmulation, {
|
||||||
List<FinderExtension> finders = const <FinderExtension>[],
|
List<FinderExtension> finders = const <FinderExtension>[],
|
||||||
List<CommandExtension> commands = const <CommandExtension>[],
|
List<CommandExtension> commands = const <CommandExtension>[],
|
||||||
}) : assert(finders != null) {
|
}) {
|
||||||
if (_enableTextEntryEmulation) {
|
if (_enableTextEntryEmulation) {
|
||||||
registerTextInput();
|
registerTextInput();
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,6 @@ class _InternalNoTransientCallbacksCondition implements WaitCondition {
|
|||||||
///
|
///
|
||||||
/// The [condition] argument must not be null.
|
/// The [condition] argument must not be null.
|
||||||
factory _InternalNoTransientCallbacksCondition.deserialize(SerializableWaitCondition condition) {
|
factory _InternalNoTransientCallbacksCondition.deserialize(SerializableWaitCondition condition) {
|
||||||
assert(condition != null);
|
|
||||||
if (condition.conditionName != 'NoTransientCallbacksCondition') {
|
if (condition.conditionName != 'NoTransientCallbacksCondition') {
|
||||||
throw SerializationException('Error occurred during deserializing from the given condition: ${condition.serialize()}');
|
throw SerializationException('Error occurred during deserializing from the given condition: ${condition.serialize()}');
|
||||||
}
|
}
|
||||||
@ -71,7 +70,6 @@ class _InternalNoPendingFrameCondition implements WaitCondition {
|
|||||||
///
|
///
|
||||||
/// The [condition] argument must not be null.
|
/// The [condition] argument must not be null.
|
||||||
factory _InternalNoPendingFrameCondition.deserialize(SerializableWaitCondition condition) {
|
factory _InternalNoPendingFrameCondition.deserialize(SerializableWaitCondition condition) {
|
||||||
assert(condition != null);
|
|
||||||
if (condition.conditionName != 'NoPendingFrameCondition') {
|
if (condition.conditionName != 'NoPendingFrameCondition') {
|
||||||
throw SerializationException('Error occurred during deserializing from the given condition: ${condition.serialize()}');
|
throw SerializationException('Error occurred during deserializing from the given condition: ${condition.serialize()}');
|
||||||
}
|
}
|
||||||
@ -100,7 +98,6 @@ class _InternalFirstFrameRasterizedCondition implements WaitCondition {
|
|||||||
///
|
///
|
||||||
/// The [condition] argument must not be null.
|
/// The [condition] argument must not be null.
|
||||||
factory _InternalFirstFrameRasterizedCondition.deserialize(SerializableWaitCondition condition) {
|
factory _InternalFirstFrameRasterizedCondition.deserialize(SerializableWaitCondition condition) {
|
||||||
assert(condition != null);
|
|
||||||
if (condition.conditionName != 'FirstFrameRasterizedCondition') {
|
if (condition.conditionName != 'FirstFrameRasterizedCondition') {
|
||||||
throw SerializationException('Error occurred during deserializing from the given condition: ${condition.serialize()}');
|
throw SerializationException('Error occurred during deserializing from the given condition: ${condition.serialize()}');
|
||||||
}
|
}
|
||||||
@ -127,7 +124,6 @@ class _InternalNoPendingPlatformMessagesCondition implements WaitCondition {
|
|||||||
///
|
///
|
||||||
/// The [condition] argument must not be null.
|
/// The [condition] argument must not be null.
|
||||||
factory _InternalNoPendingPlatformMessagesCondition.deserialize(SerializableWaitCondition condition) {
|
factory _InternalNoPendingPlatformMessagesCondition.deserialize(SerializableWaitCondition condition) {
|
||||||
assert(condition != null);
|
|
||||||
if (condition.conditionName != 'NoPendingPlatformMessagesCondition') {
|
if (condition.conditionName != 'NoPendingPlatformMessagesCondition') {
|
||||||
throw SerializationException('Error occurred during deserializing from the given condition: ${condition.serialize()}');
|
throw SerializationException('Error occurred during deserializing from the given condition: ${condition.serialize()}');
|
||||||
}
|
}
|
||||||
@ -156,15 +152,13 @@ class _InternalCombinedCondition implements WaitCondition {
|
|||||||
/// [conditions].
|
/// [conditions].
|
||||||
///
|
///
|
||||||
/// The [conditions] argument must not be null.
|
/// The [conditions] argument must not be null.
|
||||||
const _InternalCombinedCondition(this.conditions)
|
const _InternalCombinedCondition(this.conditions);
|
||||||
: assert(conditions != null);
|
|
||||||
|
|
||||||
/// Factory constructor to parse an [_InternalCombinedCondition] instance from
|
/// Factory constructor to parse an [_InternalCombinedCondition] instance from
|
||||||
/// the given [SerializableWaitCondition] instance.
|
/// the given [SerializableWaitCondition] instance.
|
||||||
///
|
///
|
||||||
/// The [condition] argument must not be null.
|
/// The [condition] argument must not be null.
|
||||||
factory _InternalCombinedCondition.deserialize(SerializableWaitCondition condition) {
|
factory _InternalCombinedCondition.deserialize(SerializableWaitCondition condition) {
|
||||||
assert(condition != null);
|
|
||||||
if (condition.conditionName != 'CombinedCondition') {
|
if (condition.conditionName != 'CombinedCondition') {
|
||||||
throw SerializationException('Error occurred during deserializing from the given condition: ${condition.serialize()}');
|
throw SerializationException('Error occurred during deserializing from the given condition: ${condition.serialize()}');
|
||||||
}
|
}
|
||||||
@ -185,7 +179,6 @@ class _InternalCombinedCondition implements WaitCondition {
|
|||||||
Future<void> wait() async {
|
Future<void> wait() async {
|
||||||
while (!condition) {
|
while (!condition) {
|
||||||
for (final WaitCondition condition in conditions) {
|
for (final WaitCondition condition in conditions) {
|
||||||
assert (condition != null);
|
|
||||||
await condition.wait();
|
await condition.wait();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -197,7 +190,6 @@ class _InternalCombinedCondition implements WaitCondition {
|
|||||||
///
|
///
|
||||||
/// The [waitCondition] argument must not be null.
|
/// The [waitCondition] argument must not be null.
|
||||||
WaitCondition deserializeCondition(SerializableWaitCondition waitCondition) {
|
WaitCondition deserializeCondition(SerializableWaitCondition waitCondition) {
|
||||||
assert(waitCondition != null);
|
|
||||||
final String conditionName = waitCondition.conditionName;
|
final String conditionName = waitCondition.conditionName;
|
||||||
switch (conditionName) {
|
switch (conditionName) {
|
||||||
case 'NoTransientCallbacksCondition':
|
case 'NoTransientCallbacksCondition':
|
||||||
|
@ -1193,9 +1193,9 @@ class FakeVmService extends Fake implements vms.VmService {
|
|||||||
commandLog.add('$method $args');
|
commandLog.add('$method $args');
|
||||||
await artificialExtensionDelay;
|
await artificialExtensionDelay;
|
||||||
|
|
||||||
final vms.Response response = responses[args!['command']]!;
|
final vms.Response? response = responses[args!['command']];
|
||||||
assert(response != null, 'Failed to create a response for ${args['command']}');
|
assert(response != null, 'Failed to create a response for ${args['command']}');
|
||||||
return response;
|
return response!;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -1243,9 +1243,9 @@ class FakeVmService extends Fake implements vms.VmService {
|
|||||||
@override
|
@override
|
||||||
Future<vms.Timeline> getVMTimeline({int? timeOriginMicros, int? timeExtentMicros}) async {
|
Future<vms.Timeline> getVMTimeline({int? timeOriginMicros, int? timeExtentMicros}) async {
|
||||||
connectionLog.add('getVMTimeline $timeOriginMicros $timeExtentMicros');
|
connectionLog.add('getVMTimeline $timeOriginMicros $timeExtentMicros');
|
||||||
final vms.Timeline timeline = timelineResponses[timeOriginMicros ?? 1]!;
|
final vms.Timeline? timeline = timelineResponses[timeOriginMicros ?? 1];
|
||||||
assert(timeline != null, 'Missing entry in timelineResponses[$timeOriginMicros]');
|
assert(timeline != null, 'Missing entry in timelineResponses[$timeOriginMicros]');
|
||||||
return timeline;
|
return timeline!;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user