Allow authorized device testing and record Pixel Back verification

This commit is contained in:
2026-10-25 17:04:19 +00:00
parent 2cbdb4de14
commit 7fe106b426
4 changed files with 104 additions and 21 deletions
@@ -31,9 +31,10 @@ class _Gateway extends FakeChatGateway {
void main() {
// Wide windows keep the chat beside its list instead of pushing a page; that
// layout is covered by test/features/chat/chat_list_detail_test.dart.
for (final width in [390.0]) {
for (final predictive in [false, true]) {
const width = 390.0;
testWidgets(
'list → chat → top → bottom → one system Back pops a real route at $width',
'list → chat → top → bottom → one ${predictive ? 'predictive gesture' : 'system Back'} pops a real route at $width',
(tester) async {
SharedPreferences.setMockInitialValues({});
tester.view.physicalSize = Size(width, 844);
@@ -146,7 +147,21 @@ void main() {
gateway.emitEvent(chatStepFrame('running'));
await tester.pump();
await tester.pump();
await tester.binding.handlePopRoute();
if (predictive) {
final route = ModalRoute.of(tester.element(transcript))!;
await _backGesture(tester, 'startBackGesture', progress: 0);
await tester.pump();
expect(route.navigator!.userGestureInProgress, isTrue);
await _backGesture(
tester,
'updateBackGestureProgress',
progress: 0.6,
);
await tester.pump(const Duration(milliseconds: 16));
await _backGesture(tester, 'commitBackGesture');
} else {
await tester.binding.handlePopRoute();
}
await tester.pump();
await tester.pump(const Duration(milliseconds: 500));
await tester.pump();
@@ -165,3 +180,24 @@ void main() {
);
}
}
Future<void> _backGesture(
WidgetTester tester,
String method, {
double? progress,
}) => tester.binding.defaultBinaryMessenger.handlePlatformMessage(
'flutter/backgesture',
const StandardMethodCodec().encodeMethodCall(
MethodCall(
method,
progress == null
? null
: {
'touchOffset': <double>[5 + 300 * progress, 400],
'progress': progress,
'swipeEdge': 0,
},
),
),
(_) {},
);