Add benchmark for Mouse region (web) (#59803)

This commit is contained in:
Tong Mu
2020-06-19 13:48:04 -07:00
committed by GitHub
parent e48b7e99cd
commit 65b1956005
4 changed files with 358 additions and 6 deletions

View File

@@ -341,10 +341,10 @@ class TestGesture {
/// Dispatch a pointer down event at the given `downLocation`, caching the
/// hit test result.
Future<void> down(Offset downLocation) async {
Future<void> down(Offset downLocation, { Duration timeStamp = Duration.zero }) async {
return TestAsyncUtils.guard<void>(() async {
_result = _hitTester(downLocation);
return _dispatcher(_pointer.down(downLocation), _result);
return _dispatcher(_pointer.down(downLocation, timeStamp: timeStamp), _result);
});
}
@@ -416,10 +416,10 @@ class TestGesture {
}
/// End the gesture by releasing the pointer.
Future<void> up() {
Future<void> up({ Duration timeStamp = Duration.zero }) {
return TestAsyncUtils.guard<void>(() async {
assert(_pointer._isDown);
await _dispatcher(_pointer.up(), _result);
await _dispatcher(_pointer.up(timeStamp: timeStamp), _result);
assert(!_pointer._isDown);
_result = null;
});
@@ -428,10 +428,10 @@ class TestGesture {
/// End the gesture by canceling the pointer (as would happen if the
/// system showed a modal dialog on top of the Flutter application,
/// for instance).
Future<void> cancel() {
Future<void> cancel({ Duration timeStamp = Duration.zero }) {
return TestAsyncUtils.guard<void>(() async {
assert(_pointer._isDown);
await _dispatcher(_pointer.cancel(), _result);
await _dispatcher(_pointer.cancel(timeStamp: timeStamp), _result);
assert(!_pointer._isDown);
_result = null;
});