mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
* preserve Window callback zones Run Window callbacks in the zone they are registered in. This is consistent with how other native API work, such as `scheduleMicrotask`, `Timer`, and `dart:io`. This also enables the developers to use the `Zone` API to capture and log unhandled Dart errors. * refactor wrapping * new line * fewer if checks; group getters/setters/fields * inline _invokeOnPointerDataPacket
23 lines
670 B
Dart
23 lines
670 B
Dart
// Copyright 2017 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
import 'dart:async';
|
|
import 'dart:typed_data';
|
|
import 'dart:ui';
|
|
|
|
import 'package:test/test.dart';
|
|
|
|
void main() {
|
|
test('window.sendPlatformMessage preserves callback zone', () {
|
|
runZoned(() {
|
|
final Zone innerZone = Zone.current;
|
|
window.sendPlatformMessage('test', new ByteData.view(new Uint8List(0).buffer), expectAsync((ByteData data) {
|
|
final Zone runZone = Zone.current;
|
|
expect(runZone, isNotNull);
|
|
expect(runZone, same(innerZone));
|
|
}));
|
|
});
|
|
});
|
|
}
|