mirror of
https://github.com/flutter/flutter
synced 2024-10-13 11:42:54 +00:00
This reverts commit 8e2ca93f52
.
Fixes https://github.com/flutter/flutter/issues/23172
This commit is contained in:
parent
b357b55904
commit
bb0290a4dc
|
@ -93,7 +93,9 @@ abstract class BindingBase {
|
||||||
/// Implementations of this method must call their superclass
|
/// Implementations of this method must call their superclass
|
||||||
/// implementation.
|
/// implementation.
|
||||||
///
|
///
|
||||||
/// {@macro flutter.foundation.bindingBase.registerServiceExtension}
|
/// Service extensions are only exposed when the observatory is
|
||||||
|
/// included in the build, which should only happen in checked mode
|
||||||
|
/// and in profile mode.
|
||||||
///
|
///
|
||||||
/// See also:
|
/// See also:
|
||||||
///
|
///
|
||||||
|
@ -102,23 +104,18 @@ abstract class BindingBase {
|
||||||
@mustCallSuper
|
@mustCallSuper
|
||||||
void initServiceExtensions() {
|
void initServiceExtensions() {
|
||||||
assert(!_debugServiceExtensionsRegistered);
|
assert(!_debugServiceExtensionsRegistered);
|
||||||
|
registerSignalServiceExtension(
|
||||||
assert(() {
|
name: 'reassemble',
|
||||||
registerSignalServiceExtension(
|
callback: reassembleApplication,
|
||||||
name: 'reassemble',
|
);
|
||||||
callback: reassembleApplication,
|
registerSignalServiceExtension(
|
||||||
);
|
name: 'exit',
|
||||||
return true;
|
callback: _exitApplication,
|
||||||
}());
|
);
|
||||||
|
registerSignalServiceExtension(
|
||||||
const bool isReleaseMode = bool.fromEnvironment('dart.vm.product');
|
name: 'frameworkPresent',
|
||||||
if (!isReleaseMode) {
|
callback: () => Future<void>.value(),
|
||||||
registerSignalServiceExtension(
|
);
|
||||||
name: 'exit',
|
|
||||||
callback: _exitApplication,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(() {
|
assert(() {
|
||||||
registerServiceExtension(
|
registerServiceExtension(
|
||||||
name: 'platformOverride',
|
name: 'platformOverride',
|
||||||
|
@ -242,8 +239,6 @@ abstract class BindingBase {
|
||||||
/// no value.
|
/// no value.
|
||||||
///
|
///
|
||||||
/// Calls the `callback` callback when the service extension is called.
|
/// Calls the `callback` callback when the service extension is called.
|
||||||
///
|
|
||||||
/// {@macro flutter.foundation.bindingBase.registerServiceExtension}
|
|
||||||
@protected
|
@protected
|
||||||
void registerSignalServiceExtension({
|
void registerSignalServiceExtension({
|
||||||
@required String name,
|
@required String name,
|
||||||
|
@ -272,8 +267,6 @@ abstract class BindingBase {
|
||||||
///
|
///
|
||||||
/// Calls the `setter` callback with the new value when the
|
/// Calls the `setter` callback with the new value when the
|
||||||
/// service extension method is called with a new value.
|
/// service extension method is called with a new value.
|
||||||
///
|
|
||||||
/// {@macro flutter.foundation.bindingBase.registerServiceExtension}
|
|
||||||
@protected
|
@protected
|
||||||
void registerBoolServiceExtension({
|
void registerBoolServiceExtension({
|
||||||
@required String name,
|
@required String name,
|
||||||
|
@ -304,8 +297,6 @@ abstract class BindingBase {
|
||||||
///
|
///
|
||||||
/// Calls the `setter` callback with the new value when the
|
/// Calls the `setter` callback with the new value when the
|
||||||
/// service extension method is called with a new value.
|
/// service extension method is called with a new value.
|
||||||
///
|
|
||||||
/// {@macro flutter.foundation.bindingBase.registerServiceExtension}
|
|
||||||
@protected
|
@protected
|
||||||
void registerNumericServiceExtension({
|
void registerNumericServiceExtension({
|
||||||
@required String name,
|
@required String name,
|
||||||
|
@ -335,8 +326,6 @@ abstract class BindingBase {
|
||||||
///
|
///
|
||||||
/// Calls the `setter` callback with the new value when the
|
/// Calls the `setter` callback with the new value when the
|
||||||
/// service extension method is called with a new value.
|
/// service extension method is called with a new value.
|
||||||
///
|
|
||||||
/// {@macro flutter.foundation.bindingBase.registerServiceExtension}
|
|
||||||
@protected
|
@protected
|
||||||
void registerStringServiceExtension({
|
void registerStringServiceExtension({
|
||||||
@required String name,
|
@required String name,
|
||||||
|
@ -356,51 +345,16 @@ abstract class BindingBase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Registers a service extension method with the given name (full name
|
/// Registers a service extension method with the given name (full
|
||||||
/// "ext.flutter.name").
|
/// name "ext.flutter.name"). The given callback is called when the
|
||||||
///
|
/// extension method is called. The callback must return a [Future]
|
||||||
/// The given callback is called when the extension method is called. The
|
/// that either eventually completes to a return value in the form
|
||||||
/// callback must return a [Future] that either eventually completes to a
|
/// of a name/value map where the values can all be converted to
|
||||||
/// return value in the form of a name/value map where the values can all be
|
/// JSON using `json.encode()` (see [JsonEncoder]), or fails. In case of failure, the
|
||||||
/// converted to JSON using `json.encode()` (see [JsonEncoder]), or fails. In
|
/// failure is reported to the remote caller and is dumped to the
|
||||||
/// case of failure, the failure is reported to the remote caller and is
|
/// logs.
|
||||||
/// dumped to the logs.
|
|
||||||
///
|
///
|
||||||
/// The returned map will be mutated.
|
/// The returned map will be mutated.
|
||||||
///
|
|
||||||
/// {@template flutter.foundation.bindingBase.registerServiceExtension}
|
|
||||||
/// A registered service extension can only be activated if the vm-service
|
|
||||||
/// is included in the build, which only happens in debug and profile mode.
|
|
||||||
/// Although a service extension cannot be used in release mode its code may
|
|
||||||
/// still be included in the Dart snapshot and blow up binary size if it is
|
|
||||||
/// not wrapped in a guard that allows the tree shaker to remove it (see
|
|
||||||
/// sample code below).
|
|
||||||
///
|
|
||||||
/// ## Sample Code
|
|
||||||
///
|
|
||||||
/// The following code registers a service extension that is only included in
|
|
||||||
/// debug builds:
|
|
||||||
///
|
|
||||||
/// ```dart
|
|
||||||
/// assert(() {
|
|
||||||
/// // Register your service extension here.
|
|
||||||
/// return true;
|
|
||||||
/// }());
|
|
||||||
///
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// A service extension registered with the following code snippet is
|
|
||||||
/// available in debug and profile mode:
|
|
||||||
///
|
|
||||||
/// ```dart
|
|
||||||
/// if (!const bool.fromEnvironment('dart.vm.product')) {
|
|
||||||
// // Register your service extension here.
|
|
||||||
// }
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// Both guards ensure that Dart's tree shaker can remove the code for the
|
|
||||||
/// service extension in release builds.
|
|
||||||
/// {@endTemplate}
|
|
||||||
@protected
|
@protected
|
||||||
void registerServiceExtension({
|
void registerServiceExtension({
|
||||||
@required String name,
|
@required String name,
|
||||||
|
|
|
@ -51,7 +51,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Semanti
|
||||||
super.initServiceExtensions();
|
super.initServiceExtensions();
|
||||||
|
|
||||||
assert(() {
|
assert(() {
|
||||||
// these service extensions only work in debug mode
|
// these service extensions only work in checked mode
|
||||||
registerBoolServiceExtension(
|
registerBoolServiceExtension(
|
||||||
name: 'debugPaint',
|
name: 'debugPaint',
|
||||||
getter: () async => debugPaintSizeEnabled,
|
getter: () async => debugPaintSizeEnabled,
|
||||||
|
@ -60,17 +60,17 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Semanti
|
||||||
return Future<void>.value();
|
return Future<void>.value();
|
||||||
debugPaintSizeEnabled = value;
|
debugPaintSizeEnabled = value;
|
||||||
return _forceRepaint();
|
return _forceRepaint();
|
||||||
},
|
}
|
||||||
);
|
);
|
||||||
registerBoolServiceExtension(
|
registerBoolServiceExtension(
|
||||||
name: 'debugPaintBaselinesEnabled',
|
name: 'debugPaintBaselinesEnabled',
|
||||||
getter: () async => debugPaintBaselinesEnabled,
|
getter: () async => debugPaintBaselinesEnabled,
|
||||||
setter: (bool value) {
|
setter: (bool value) {
|
||||||
if (debugPaintBaselinesEnabled == value)
|
if (debugPaintBaselinesEnabled == value)
|
||||||
return Future<void>.value();
|
return Future<void>.value();
|
||||||
debugPaintBaselinesEnabled = value;
|
debugPaintBaselinesEnabled = value;
|
||||||
return _forceRepaint();
|
return _forceRepaint();
|
||||||
},
|
}
|
||||||
);
|
);
|
||||||
registerBoolServiceExtension(
|
registerBoolServiceExtension(
|
||||||
name: 'repaintRainbow',
|
name: 'repaintRainbow',
|
||||||
|
@ -83,43 +83,28 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Semanti
|
||||||
return Future<void>.value();
|
return Future<void>.value();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
registerSignalServiceExtension(
|
|
||||||
name: 'debugDumpLayerTree',
|
|
||||||
callback: () {
|
|
||||||
debugDumpLayerTree();
|
|
||||||
return debugPrintDone;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
return true;
|
return true;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
const bool isReleaseMode = bool.fromEnvironment('dart.vm.product');
|
registerSignalServiceExtension(
|
||||||
if (!isReleaseMode) {
|
name: 'debugDumpRenderTree',
|
||||||
// these service extensions work in debug or profile mode
|
callback: () { debugDumpRenderTree(); return debugPrintDone; }
|
||||||
registerSignalServiceExtension(
|
);
|
||||||
name: 'debugDumpRenderTree',
|
|
||||||
callback: () {
|
|
||||||
debugDumpRenderTree();
|
|
||||||
return debugPrintDone;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
registerSignalServiceExtension(
|
registerSignalServiceExtension(
|
||||||
name: 'debugDumpSemanticsTreeInTraversalOrder',
|
name: 'debugDumpLayerTree',
|
||||||
callback: () {
|
callback: () { debugDumpLayerTree(); return debugPrintDone; }
|
||||||
debugDumpSemanticsTree(DebugSemanticsDumpOrder.traversalOrder);
|
);
|
||||||
return debugPrintDone;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
registerSignalServiceExtension(
|
registerSignalServiceExtension(
|
||||||
name: 'debugDumpSemanticsTreeInInverseHitTestOrder',
|
name: 'debugDumpSemanticsTreeInTraversalOrder',
|
||||||
callback: () {
|
callback: () { debugDumpSemanticsTree(DebugSemanticsDumpOrder.traversalOrder); return debugPrintDone; }
|
||||||
debugDumpSemanticsTree(DebugSemanticsDumpOrder.inverseHitTest);
|
);
|
||||||
return debugPrintDone;
|
|
||||||
},
|
registerSignalServiceExtension(
|
||||||
);
|
name: 'debugDumpSemanticsTreeInInverseHitTestOrder',
|
||||||
}
|
callback: () { debugDumpSemanticsTree(DebugSemanticsDumpOrder.inverseHitTest); return debugPrintDone; }
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a [RenderView] object to be the root of the
|
/// Creates a [RenderView] object to be the root of the
|
||||||
|
|
|
@ -203,17 +203,13 @@ mixin SchedulerBinding on BindingBase, ServicesBinding {
|
||||||
@override
|
@override
|
||||||
void initServiceExtensions() {
|
void initServiceExtensions() {
|
||||||
super.initServiceExtensions();
|
super.initServiceExtensions();
|
||||||
|
registerNumericServiceExtension(
|
||||||
const bool isReleaseMode = bool.fromEnvironment('dart.vm.product');
|
name: 'timeDilation',
|
||||||
if (!isReleaseMode) {
|
getter: () async => timeDilation,
|
||||||
registerNumericServiceExtension(
|
setter: (double value) async {
|
||||||
name: 'timeDilation',
|
timeDilation = value;
|
||||||
getter: () async => timeDilation,
|
}
|
||||||
setter: (double value) async {
|
);
|
||||||
timeDilation = value;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Whether the application is visible, and if so, whether it is currently
|
/// Whether the application is visible, and if so, whether it is currently
|
||||||
|
|
|
@ -86,21 +86,17 @@ mixin ServicesBinding on BindingBase {
|
||||||
@override
|
@override
|
||||||
void initServiceExtensions() {
|
void initServiceExtensions() {
|
||||||
super.initServiceExtensions();
|
super.initServiceExtensions();
|
||||||
|
registerStringServiceExtension(
|
||||||
assert(() {
|
// ext.flutter.evict value=foo.png will cause foo.png to be evicted from
|
||||||
registerStringServiceExtension(
|
// the rootBundle cache and cause the entire image cache to be cleared.
|
||||||
// ext.flutter.evict value=foo.png will cause foo.png to be evicted from
|
// This is used by hot reload mode to clear out the cache of resources
|
||||||
// the rootBundle cache and cause the entire image cache to be cleared.
|
// that have changed.
|
||||||
// This is used by hot reload mode to clear out the cache of resources
|
name: 'evict',
|
||||||
// that have changed.
|
getter: () async => '',
|
||||||
name: 'evict',
|
setter: (String value) async {
|
||||||
getter: () async => '',
|
evict(value);
|
||||||
setter: (String value) async {
|
}
|
||||||
evict(value);
|
);
|
||||||
},
|
|
||||||
);
|
|
||||||
return true;
|
|
||||||
}());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Called in response to the `ext.flutter.evict` service extension.
|
/// Called in response to the `ext.flutter.evict` service extension.
|
||||||
|
|
|
@ -265,41 +265,37 @@ mixin WidgetsBinding on BindingBase, SchedulerBinding, GestureBinding, RendererB
|
||||||
void initServiceExtensions() {
|
void initServiceExtensions() {
|
||||||
super.initServiceExtensions();
|
super.initServiceExtensions();
|
||||||
|
|
||||||
const bool isReleaseMode = bool.fromEnvironment('dart.vm.product');
|
registerSignalServiceExtension(
|
||||||
if (!isReleaseMode) {
|
name: 'debugDumpApp',
|
||||||
registerSignalServiceExtension(
|
callback: () {
|
||||||
name: 'debugDumpApp',
|
debugDumpApp();
|
||||||
callback: () {
|
return debugPrintDone;
|
||||||
debugDumpApp();
|
}
|
||||||
return debugPrintDone;
|
);
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
registerBoolServiceExtension(
|
registerBoolServiceExtension(
|
||||||
name: 'showPerformanceOverlay',
|
name: 'showPerformanceOverlay',
|
||||||
getter: () =>
|
getter: () => Future<bool>.value(WidgetsApp.showPerformanceOverlayOverride),
|
||||||
Future<bool>.value(WidgetsApp.showPerformanceOverlayOverride),
|
setter: (bool value) {
|
||||||
setter: (bool value) {
|
if (WidgetsApp.showPerformanceOverlayOverride == value)
|
||||||
if (WidgetsApp.showPerformanceOverlayOverride == value)
|
return Future<void>.value();
|
||||||
return Future<void>.value();
|
WidgetsApp.showPerformanceOverlayOverride = value;
|
||||||
WidgetsApp.showPerformanceOverlayOverride = value;
|
return _forceRebuild();
|
||||||
return _forceRebuild();
|
}
|
||||||
},
|
);
|
||||||
);
|
|
||||||
}
|
registerBoolServiceExtension(
|
||||||
|
name: 'debugAllowBanner',
|
||||||
|
getter: () => Future<bool>.value(WidgetsApp.debugAllowBannerOverride),
|
||||||
|
setter: (bool value) {
|
||||||
|
if (WidgetsApp.debugAllowBannerOverride == value)
|
||||||
|
return Future<void>.value();
|
||||||
|
WidgetsApp.debugAllowBannerOverride = value;
|
||||||
|
return _forceRebuild();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
assert(() {
|
assert(() {
|
||||||
registerBoolServiceExtension(
|
|
||||||
name: 'debugAllowBanner',
|
|
||||||
getter: () => Future<bool>.value(WidgetsApp.debugAllowBannerOverride),
|
|
||||||
setter: (bool value) {
|
|
||||||
if (WidgetsApp.debugAllowBannerOverride == value)
|
|
||||||
return Future<void>.value();
|
|
||||||
WidgetsApp.debugAllowBannerOverride = value;
|
|
||||||
return _forceRebuild();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
// Expose the ability to send Widget rebuilds as [Timeline] events.
|
// Expose the ability to send Widget rebuilds as [Timeline] events.
|
||||||
registerBoolServiceExtension(
|
registerBoolServiceExtension(
|
||||||
name: 'profileWidgetBuilds',
|
name: 'profileWidgetBuilds',
|
||||||
|
@ -307,13 +303,25 @@ mixin WidgetsBinding on BindingBase, SchedulerBinding, GestureBinding, RendererB
|
||||||
setter: (bool value) async {
|
setter: (bool value) async {
|
||||||
if (debugProfileBuildsEnabled != value)
|
if (debugProfileBuildsEnabled != value)
|
||||||
debugProfileBuildsEnabled = value;
|
debugProfileBuildsEnabled = value;
|
||||||
},
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
WidgetInspectorService.instance.initServiceExtensions(registerServiceExtension);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
// This service extension is deprecated and will be removed by 7/1/2018.
|
||||||
|
// Use ext.flutter.inspector.show instead.
|
||||||
|
registerBoolServiceExtension(
|
||||||
|
name: 'debugWidgetInspector',
|
||||||
|
getter: () async => WidgetsApp.debugShowWidgetInspectorOverride,
|
||||||
|
setter: (bool value) {
|
||||||
|
if (WidgetsApp.debugShowWidgetInspectorOverride == value)
|
||||||
|
return Future<void>.value();
|
||||||
|
WidgetsApp.debugShowWidgetInspectorOverride = value;
|
||||||
|
return _forceRebuild();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
WidgetInspectorService.instance.initServiceExtensions(registerServiceExtension);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _forceRebuild() {
|
Future<void> _forceRebuild() {
|
||||||
|
|
|
@ -917,11 +917,13 @@ mixin WidgetInspectorService {
|
||||||
|
|
||||||
/// Called to register service extensions.
|
/// Called to register service extensions.
|
||||||
///
|
///
|
||||||
|
/// Service extensions are only exposed when the observatory is
|
||||||
|
/// included in the build, which should only happen in checked mode
|
||||||
|
/// and in profile mode.
|
||||||
|
///
|
||||||
/// See also:
|
/// See also:
|
||||||
///
|
///
|
||||||
/// * <https://github.com/dart-lang/sdk/blob/master/runtime/vm/service/service.md#rpcs-requests-and-responses>
|
/// * <https://github.com/dart-lang/sdk/blob/master/runtime/vm/service/service.md#rpcs-requests-and-responses>
|
||||||
/// * [BindingBase.initServiceExtensions], which explains when service
|
|
||||||
/// extensions can be used.
|
|
||||||
void initServiceExtensions(
|
void initServiceExtensions(
|
||||||
_RegisterServiceExtensionCallback registerServiceExtensionCallback) {
|
_RegisterServiceExtensionCallback registerServiceExtensionCallback) {
|
||||||
_registerServiceExtensionCallback = registerServiceExtensionCallback;
|
_registerServiceExtensionCallback = registerServiceExtensionCallback;
|
||||||
|
@ -1021,33 +1023,36 @@ mixin WidgetInspectorService {
|
||||||
name: 'isWidgetCreationTracked',
|
name: 'isWidgetCreationTracked',
|
||||||
callback: isWidgetCreationTracked,
|
callback: isWidgetCreationTracked,
|
||||||
);
|
);
|
||||||
registerServiceExtension(
|
assert(() {
|
||||||
name: 'screenshot',
|
registerServiceExtension(
|
||||||
callback: (Map<String, String> parameters) async {
|
name: 'screenshot',
|
||||||
assert(parameters.containsKey('id'));
|
callback: (Map<String, String> parameters) async {
|
||||||
assert(parameters.containsKey('width'));
|
assert(parameters.containsKey('id'));
|
||||||
assert(parameters.containsKey('height'));
|
assert(parameters.containsKey('width'));
|
||||||
|
assert(parameters.containsKey('height'));
|
||||||
|
|
||||||
final ui.Image image = await screenshot(
|
final ui.Image image = await screenshot(
|
||||||
toObject(parameters['id']),
|
toObject(parameters['id']),
|
||||||
width: double.parse(parameters['width']),
|
width: double.parse(parameters['width']),
|
||||||
height: double.parse(parameters['height']),
|
height: double.parse(parameters['height']),
|
||||||
margin: parameters.containsKey('margin') ?
|
margin: parameters.containsKey('margin') ?
|
||||||
double.parse(parameters['margin']) : 0.0,
|
double.parse(parameters['margin']) : 0.0,
|
||||||
maxPixelRatio: parameters.containsKey('maxPixelRatio') ?
|
maxPixelRatio: parameters.containsKey('maxPixelRatio') ?
|
||||||
double.parse(parameters['maxPixelRatio']) : 1.0,
|
double.parse(parameters['maxPixelRatio']) : 1.0,
|
||||||
debugPaint: parameters['debugPaint'] == 'true',
|
debugPaint: parameters['debugPaint'] == 'true',
|
||||||
);
|
);
|
||||||
if (image == null) {
|
if (image == null) {
|
||||||
return <String, Object>{'result': null};
|
return <String, Object>{'result': null};
|
||||||
}
|
}
|
||||||
final ByteData byteData = await image.toByteData(format:ui.ImageByteFormat.png);
|
final ByteData byteData = await image.toByteData(format:ui.ImageByteFormat.png);
|
||||||
|
|
||||||
return <String, Object>{
|
return <String, Object>{
|
||||||
'result': base64.encoder.convert(Uint8List.view(byteData.buffer)),
|
'result': base64.encoder.convert(Uint8List.view(byteData.buffer)),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Clear all InspectorService object references.
|
/// Clear all InspectorService object references.
|
||||||
|
|
|
@ -359,6 +359,13 @@ void main() {
|
||||||
expect(binding.extensions.containsKey('exit'), isTrue);
|
expect(binding.extensions.containsKey('exit'), isTrue);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Service extensions - frameworkPresent', () async {
|
||||||
|
Map<String, dynamic> result;
|
||||||
|
|
||||||
|
result = await binding.testExtension('frameworkPresent', <String, String>{});
|
||||||
|
expect(result, <String, String>{});
|
||||||
|
});
|
||||||
|
|
||||||
test('Service extensions - platformOverride', () async {
|
test('Service extensions - platformOverride', () async {
|
||||||
Map<String, dynamic> result;
|
Map<String, dynamic> result;
|
||||||
|
|
||||||
|
@ -482,6 +489,29 @@ void main() {
|
||||||
expect(binding.frameScheduled, isFalse);
|
expect(binding.frameScheduled, isFalse);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Service extensions - debugWidgetInspector', () async {
|
||||||
|
Map<String, dynamic> result;
|
||||||
|
|
||||||
|
expect(binding.frameScheduled, isFalse);
|
||||||
|
expect(WidgetsApp.debugShowWidgetInspectorOverride, false);
|
||||||
|
result = await binding.testExtension('debugWidgetInspector', <String, String>{});
|
||||||
|
expect(result, <String, String>{ 'enabled': 'false' });
|
||||||
|
expect(WidgetsApp.debugShowWidgetInspectorOverride, false);
|
||||||
|
result = await binding.testExtension('debugWidgetInspector', <String, String>{ 'enabled': 'true' });
|
||||||
|
expect(result, <String, String>{ 'enabled': 'true' });
|
||||||
|
expect(WidgetsApp.debugShowWidgetInspectorOverride, true);
|
||||||
|
result = await binding.testExtension('debugWidgetInspector', <String, String>{});
|
||||||
|
expect(result, <String, String>{ 'enabled': 'true' });
|
||||||
|
expect(WidgetsApp.debugShowWidgetInspectorOverride, true);
|
||||||
|
result = await binding.testExtension('debugWidgetInspector', <String, String>{ 'enabled': 'false' });
|
||||||
|
expect(result, <String, String>{ 'enabled': 'false' });
|
||||||
|
expect(WidgetsApp.debugShowWidgetInspectorOverride, false);
|
||||||
|
result = await binding.testExtension('debugWidgetInspector', <String, String>{});
|
||||||
|
expect(result, <String, String>{ 'enabled': 'false' });
|
||||||
|
expect(WidgetsApp.debugShowWidgetInspectorOverride, false);
|
||||||
|
expect(binding.frameScheduled, isFalse);
|
||||||
|
});
|
||||||
|
|
||||||
test('Service extensions - timeDilation', () async {
|
test('Service extensions - timeDilation', () async {
|
||||||
Map<String, dynamic> result;
|
Map<String, dynamic> result;
|
||||||
|
|
||||||
|
@ -511,7 +541,7 @@ void main() {
|
||||||
|
|
||||||
// If you add a service extension... TEST IT! :-)
|
// If you add a service extension... TEST IT! :-)
|
||||||
// ...then increment this number.
|
// ...then increment this number.
|
||||||
expect(binding.extensions.length, 37);
|
expect(binding.extensions.length, 39);
|
||||||
|
|
||||||
expect(console, isEmpty);
|
expect(console, isEmpty);
|
||||||
debugPrint = debugPrintThrottled;
|
debugPrint = debugPrintThrottled;
|
||||||
|
|
|
@ -1296,6 +1296,10 @@ class Isolate extends ServiceObjectOwner {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> flutterFrameworkPresent() async {
|
||||||
|
return await invokeFlutterExtensionRpcRaw('ext.flutter.frameworkPresent') != null;
|
||||||
|
}
|
||||||
|
|
||||||
Future<Map<String, dynamic>> uiWindowScheduleFrame() async {
|
Future<Map<String, dynamic>> uiWindowScheduleFrame() async {
|
||||||
return await invokeFlutterExtensionRpcRaw('ext.ui.window.scheduleFrame');
|
return await invokeFlutterExtensionRpcRaw('ext.ui.window.scheduleFrame');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue