mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Renamed the Driver API waitUntilFrameSync to waitUntilNoPendingFrame. (#36512)
This commit is contained in:
parent
430644912f
commit
4e4b9bd0b1
@ -120,16 +120,16 @@ class WaitUntilNoTransientCallbacks extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A Flutter Driver command that waits until the frame is synced.
|
/// A Flutter Driver command that waits until the frame is synced.
|
||||||
class WaitUntilFrameSync extends Command {
|
class WaitUntilNoPendingFrame extends Command {
|
||||||
/// Creates a command that waits until there's no pending frame scheduled.
|
/// Creates a command that waits until there's no pending frame scheduled.
|
||||||
const WaitUntilFrameSync({ Duration timeout }) : super(timeout: timeout);
|
const WaitUntilNoPendingFrame({ Duration timeout }) : super(timeout: timeout);
|
||||||
|
|
||||||
/// Deserializes this command from the value generated by [serialize].
|
/// Deserializes this command from the value generated by [serialize].
|
||||||
WaitUntilFrameSync.deserialize(Map<String, String> json)
|
WaitUntilNoPendingFrame.deserialize(Map<String, String> json)
|
||||||
: super.deserialize(json);
|
: super.deserialize(json);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get kind => 'waitUntilFrameSync';
|
String get kind => 'waitUntilNoPendingFrame';
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Base class for Flutter Driver finders, objects that describe how the driver
|
/// Base class for Flutter Driver finders, objects that describe how the driver
|
||||||
|
@ -113,7 +113,7 @@ class FlutterDriverExtension {
|
|||||||
'waitFor': _waitFor,
|
'waitFor': _waitFor,
|
||||||
'waitForAbsent': _waitForAbsent,
|
'waitForAbsent': _waitForAbsent,
|
||||||
'waitUntilNoTransientCallbacks': _waitUntilNoTransientCallbacks,
|
'waitUntilNoTransientCallbacks': _waitUntilNoTransientCallbacks,
|
||||||
'waitUntilFrameSync': _waitUntilFrameSync,
|
'waitUntilNoPendingFrame': _waitUntilNoPendingFrame,
|
||||||
'get_semantics_id': _getSemanticsId,
|
'get_semantics_id': _getSemanticsId,
|
||||||
'get_offset': _getOffset,
|
'get_offset': _getOffset,
|
||||||
'get_diagnostics_tree': _getDiagnosticsTree,
|
'get_diagnostics_tree': _getDiagnosticsTree,
|
||||||
@ -134,7 +134,7 @@ class FlutterDriverExtension {
|
|||||||
'waitFor': (Map<String, String> params) => WaitFor.deserialize(params),
|
'waitFor': (Map<String, String> params) => WaitFor.deserialize(params),
|
||||||
'waitForAbsent': (Map<String, String> params) => WaitForAbsent.deserialize(params),
|
'waitForAbsent': (Map<String, String> params) => WaitForAbsent.deserialize(params),
|
||||||
'waitUntilNoTransientCallbacks': (Map<String, String> params) => WaitUntilNoTransientCallbacks.deserialize(params),
|
'waitUntilNoTransientCallbacks': (Map<String, String> params) => WaitUntilNoTransientCallbacks.deserialize(params),
|
||||||
'waitUntilFrameSync': (Map<String, String> params) => WaitUntilFrameSync.deserialize(params),
|
'waitUntilNoPendingFrame': (Map<String, String> params) => WaitUntilNoPendingFrame.deserialize(params),
|
||||||
'get_semantics_id': (Map<String, String> params) => GetSemanticsId.deserialize(params),
|
'get_semantics_id': (Map<String, String> params) => GetSemanticsId.deserialize(params),
|
||||||
'get_offset': (Map<String, String> params) => GetOffset.deserialize(params),
|
'get_offset': (Map<String, String> params) => GetOffset.deserialize(params),
|
||||||
'get_diagnostics_tree': (Map<String, String> params) => GetDiagnosticsTree.deserialize(params),
|
'get_diagnostics_tree': (Map<String, String> params) => GetDiagnosticsTree.deserialize(params),
|
||||||
@ -371,7 +371,7 @@ class FlutterDriverExtension {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a future that waits until frame is synced.
|
/// Returns a future that waits until no pending frame is scheduled (frame is synced).
|
||||||
///
|
///
|
||||||
/// Specifically, it checks:
|
/// Specifically, it checks:
|
||||||
/// * Whether the count of transient callbacks is zero.
|
/// * Whether the count of transient callbacks is zero.
|
||||||
@ -388,7 +388,7 @@ class FlutterDriverExtension {
|
|||||||
/// `set_frame_sync` method. See [FlutterDriver.runUnsynchronized] for more
|
/// `set_frame_sync` method. See [FlutterDriver.runUnsynchronized] for more
|
||||||
/// details on how to do this. Note, disabling frame sync will require the
|
/// details on how to do this. Note, disabling frame sync will require the
|
||||||
/// test author to use some other method to avoid flakiness.
|
/// test author to use some other method to avoid flakiness.
|
||||||
Future<Result> _waitUntilFrameSync(Command command) async {
|
Future<Result> _waitUntilNoPendingFrame(Command command) async {
|
||||||
await _waitUntilFrame(() {
|
await _waitUntilFrame(() {
|
||||||
return SchedulerBinding.instance.transientCallbackCount == 0
|
return SchedulerBinding.instance.transientCallbackCount == 0
|
||||||
&& !SchedulerBinding.instance.hasScheduledFrame;
|
&& !SchedulerBinding.instance.hasScheduledFrame;
|
||||||
|
@ -345,7 +345,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('returns immediately when frame is synced', (
|
testWidgets('returns immediately when frame is synced', (
|
||||||
WidgetTester tester) async {
|
WidgetTester tester) async {
|
||||||
extension.call(const WaitUntilFrameSync().serialize())
|
extension.call(const WaitUntilNoPendingFrame().serialize())
|
||||||
.then<void>(expectAsync1((Map<String, dynamic> r) {
|
.then<void>(expectAsync1((Map<String, dynamic> r) {
|
||||||
result = r;
|
result = r;
|
||||||
}));
|
}));
|
||||||
@ -366,7 +366,7 @@ void main() {
|
|||||||
// Intentionally blank. We only care about existence of a callback.
|
// Intentionally blank. We only care about existence of a callback.
|
||||||
});
|
});
|
||||||
|
|
||||||
extension.call(const WaitUntilFrameSync().serialize())
|
extension.call(const WaitUntilNoPendingFrame().serialize())
|
||||||
.then<void>(expectAsync1((Map<String, dynamic> r) {
|
.then<void>(expectAsync1((Map<String, dynamic> r) {
|
||||||
result = r;
|
result = r;
|
||||||
}));
|
}));
|
||||||
@ -390,7 +390,7 @@ void main() {
|
|||||||
'waits until no pending scheduled frame', (WidgetTester tester) async {
|
'waits until no pending scheduled frame', (WidgetTester tester) async {
|
||||||
SchedulerBinding.instance.scheduleFrame();
|
SchedulerBinding.instance.scheduleFrame();
|
||||||
|
|
||||||
extension.call(const WaitUntilFrameSync().serialize())
|
extension.call(const WaitUntilNoPendingFrame().serialize())
|
||||||
.then<void>(expectAsync1((Map<String, dynamic> r) {
|
.then<void>(expectAsync1((Map<String, dynamic> r) {
|
||||||
result = r;
|
result = r;
|
||||||
}));
|
}));
|
||||||
|
Loading…
Reference in New Issue
Block a user