Repository: flutter
Issue: GestureDetector.onTap is triggered instead of onLongPress inside tester.runAsync
Labels: a: tests,framework,f: gestures,has reproducible steps,P3,found in release: 2.6,found in release: 2.8,team-framework,triaged-framework

## Steps to Reproduce

I have a `GestureDetector` with a `onLongPress` callback to open an `AlertDialog`. My `Dialog` contains a `Timer` so I have to wrap my test code inside `tester.runAsync` but I discovered that the `onTap` callback is triggered instead of `onLongPress`.

This is a simplified example. Same behavior between stable and master channels

<details>
<summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(home: MyApp()));
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: GestureDetector(
        child: Icon(Icons.settings),
        onTap: () {
          print("tap");
        },
        onLongPress: () {
          print("long press");
        },
      ),
    );
  }
}
```
```dart
import 'package:flutter/material.dart';
import 'package:flutter_playground/main.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
  testWidgets('without runasync', (WidgetTester tester) async {
    await tester.pumpWidget(MaterialApp(home: MyApp()));
    await tester.longPress(find.byIcon(Icons.settings)); // onLongPress triggered
  });

  testWidgets('with runasync', (WidgetTester tester) async {
    await tester.runAsync(() async {
      await tester.pumpWidget(MaterialApp(home: MyApp()));
      await tester.longPress(find.byIcon(Icons.settings)); // onTap triggered !
    });
  });
}
```

</details>

<details>
  <summary>Logs</summary>

<!--
      Run your application with `flutter run --verbose` and attach all the
      log output below between the lines with the backticks. If there is an
      exception, please see if the error message includes enough information
      to explain how to solve the issue.
-->

```
$ flutter test test/test_widget.dart
00:02 +0: without runasync                                                                                                                                                                                                                   
long press
00:02 +1: with runasync                                                                                                                                                                                                                      
tap
00:02 +2: All tests passed!   
```

```
$ flutter analyze                   
Analyzing flutter_playground...                                         
No issues found! (ran in 16.8s)
```


```
flutter doctor -v
[✓] Flutter (Channel master, 2.6.0-12.0.pre.1006, on Fedora Linux 35 (KDE Plasma) 5.15.6-200.fc35.x86_64, locale fr_FR.UTF-8)
    • Flutter version 2.6.0-12.0.pre.1006 at /home/william/Documents/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 08f779a328 (il y a 14 minutes), 2021-12-13 17:44:07 +0000
    • Engine revision f16c96c31f
    • Dart version 2.16.0 (build 2.16.0-85.0.dev)
    • DevTools version 2.9.1

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /home/william/Android/Sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 13.0.0 (Fedora 13.0.0-3.fc35)
    • cmake version 3.22.0
    • ninja version 1.10.2
    • pkg-config version 1.8.0

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[☠] IntelliJ IDEA Community Edition (the doctor check crashed)
    ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues.
    ✗ FormatException: Unexpected extension byte (at offset 5)
    • #0      _Utf8Decoder.convertSingle (dart:convert-patch/convert_patch.dart:1789:7)
      #1      Utf8Decoder.convert (dart:convert/utf.dart:351:42)
      #2      InputStream.readString (package:archive/src/util/input_stream.dart:207:30)
      #3      new ZipDirectory.read (package:archive/src/zip/zip_directory.dart:40:30)
      #4      ZipDecoder.decodeBuffer (package:archive/src/zip_decoder.dart:19:30)
      #5      ZipDecoder.decodeBytes (package:archive/src/zip_decoder.dart:14:12)
      #6      IntelliJPlugins._findPluginXml (package:flutter_tools/src/intellij/intellij.dart:130:44)
      #7      IntelliJPlugins._readPackageVersion (package:flutter_tools/src/intellij/intellij.dart:141:40)
      #8      IntelliJPlugins.validatePackage (package:flutter_tools/src/intellij/intellij.dart:63:35)
      #9      IntelliJValidator.validate (package:flutter_tools/src/intellij/intellij_validator.dart:103:15)
      #10     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:111:32)
      #11     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:109:18)
      #12     _rootRun (dart:async/zone.dart:1426:13)
      #13     _CustomZone.run (dart:async/zone.dart:1328:19)
      #14     _runZoned (dart:async/zone.dart:1861:10)
      #15     runZonedGuarded (dart:async/zone.dart:1849:12)
      #16     runZoned (dart:async/zone.dart:1780:12)
      #17     asyncGuard (package:flutter_tools/src/base/async_guard.dart:109:3)
      #18     Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:198:9)
      #19     Doctor.diagnose (package:flutter_tools/src/doctor.dart:302:47)
      #20     DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:50:48)
      #21     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1320:12)
      <asynchronous suspension>
      #22     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1161:27)
      <asynchronous suspension>
      #23     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #24     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
      <asynchronous suspension>
      #25     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
      <asynchronous suspension>
      #26     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #27     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
      <asynchronous suspension>
      #28     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
      <asynchronous suspension>
      #29     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #30     main (package:flutter_tools/executable.dart:94:3)
      <asynchronous suspension>


[✓] IntelliJ IDEA Ultimate Edition (version 2021.3)
    • IntelliJ at /home/william/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/213.5744.223
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.63.0)
    • VS Code at /usr/share/code
    • Flutter extension version 3.29.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Fedora Linux 35 (KDE Plasma) 5.15.6-200.fc35.x86_64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 96.0.4664.93

! Doctor found issues in 3 categories.
```

</details>