Migrate some dev/ things to null-safety (#74861)
This commit is contained in:
parent
2e7ab87a4d
commit
15703fb93b
@ -1,7 +1,7 @@
|
|||||||
name: missing_dependency_tests
|
name: missing_dependency_tests
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.0.0-dev.68.0 <3.0.0"
|
sdk: ">=2.12.0-0 <3.0.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
|
@ -2,7 +2,7 @@ name: tracing_tests
|
|||||||
description: Various tests for tracing in flutter/flutter
|
description: Various tests for tracing in flutter/flutter
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.2.2 <3.0.0"
|
sdk: ">=2.12.0-0 <3.0.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
|
@ -12,7 +12,7 @@ import 'package:vm_service/vm_service_io.dart';
|
|||||||
// for "Dart", "Embedder", and "GC" recorded from startup.
|
// for "Dart", "Embedder", and "GC" recorded from startup.
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
VmService vmService;
|
late VmService vmService;
|
||||||
|
|
||||||
setUpAll(() async {
|
setUpAll(() async {
|
||||||
final developer.ServiceProtocolInfo info = await developer.Service.getInfo();
|
final developer.ServiceProtocolInfo info = await developer.Service.getInfo();
|
||||||
@ -22,7 +22,7 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
vmService = await vmServiceConnectUri(
|
vmService = await vmServiceConnectUri(
|
||||||
'ws://localhost:${info.serverUri.port}${info.serverUri.path}ws',
|
'ws://localhost:${info.serverUri!.port}${info.serverUri!.path}ws',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@ import 'package:vm_service/vm_service.dart';
|
|||||||
import 'package:vm_service/vm_service_io.dart';
|
import 'package:vm_service/vm_service_io.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
VmService vmService;
|
late VmService vmService;
|
||||||
String isolateId;
|
late String isolateId;
|
||||||
setUpAll(() async {
|
setUpAll(() async {
|
||||||
final developer.ServiceProtocolInfo info = await developer.Service.getInfo();
|
final developer.ServiceProtocolInfo info = await developer.Service.getInfo();
|
||||||
|
|
||||||
@ -21,9 +21,9 @@ void main() {
|
|||||||
fail('This test _must_ be run with --enable-vmservice.');
|
fail('This test _must_ be run with --enable-vmservice.');
|
||||||
}
|
}
|
||||||
|
|
||||||
vmService = await vmServiceConnectUri('ws://localhost:${info.serverUri.port}${info.serverUri.path}ws');
|
vmService = await vmServiceConnectUri('ws://localhost:${info.serverUri!.port}${info.serverUri!.path}ws');
|
||||||
await vmService.setVMTimelineFlags(<String>['Dart']);
|
await vmService.setVMTimelineFlags(<String>['Dart']);
|
||||||
isolateId = developer.Service.getIsolateID(isolate.Isolate.current);
|
isolateId = developer.Service.getIsolateID(isolate.Isolate.current)!;
|
||||||
|
|
||||||
// Initialize the image cache.
|
// Initialize the image cache.
|
||||||
TestWidgetsFlutterBinding.ensureInitialized();
|
TestWidgetsFlutterBinding.ensureInitialized();
|
||||||
@ -32,22 +32,22 @@ void main() {
|
|||||||
test('Image cache tracing', () async {
|
test('Image cache tracing', () async {
|
||||||
final TestImageStreamCompleter completer1 = TestImageStreamCompleter();
|
final TestImageStreamCompleter completer1 = TestImageStreamCompleter();
|
||||||
final TestImageStreamCompleter completer2 = TestImageStreamCompleter();
|
final TestImageStreamCompleter completer2 = TestImageStreamCompleter();
|
||||||
PaintingBinding.instance.imageCache.putIfAbsent(
|
PaintingBinding.instance!.imageCache!.putIfAbsent(
|
||||||
'Test',
|
'Test',
|
||||||
() => completer1,
|
() => completer1,
|
||||||
);
|
);
|
||||||
PaintingBinding.instance.imageCache.clear();
|
PaintingBinding.instance!.imageCache!.clear();
|
||||||
|
|
||||||
completer2.testSetImage(ImageInfo(image: await createTestImage()));
|
completer2.testSetImage(ImageInfo(image: await createTestImage()));
|
||||||
PaintingBinding.instance.imageCache.putIfAbsent(
|
PaintingBinding.instance!.imageCache!.putIfAbsent(
|
||||||
'Test2',
|
'Test2',
|
||||||
() => completer2,
|
() => completer2,
|
||||||
);
|
);
|
||||||
PaintingBinding.instance.imageCache.evict('Test2');
|
PaintingBinding.instance!.imageCache!.evict('Test2');
|
||||||
|
|
||||||
final Timeline timeline = await vmService.getVMTimeline();
|
final Timeline timeline = await vmService.getVMTimeline();
|
||||||
_expectTimelineEvents(
|
_expectTimelineEvents(
|
||||||
timeline.traceEvents,
|
timeline.traceEvents!,
|
||||||
<Map<String, dynamic>>[
|
<Map<String, dynamic>>[
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'name': 'ImageCache.putIfAbsent',
|
'name': 'ImageCache.putIfAbsent',
|
||||||
@ -83,9 +83,9 @@ void main() {
|
|||||||
void _expectTimelineEvents(List<TimelineEvent> events, List<Map<String, dynamic>> expected) {
|
void _expectTimelineEvents(List<TimelineEvent> events, List<Map<String, dynamic>> expected) {
|
||||||
for (final TimelineEvent event in events) {
|
for (final TimelineEvent event in events) {
|
||||||
for (int index = 0; index < expected.length; index += 1) {
|
for (int index = 0; index < expected.length; index += 1) {
|
||||||
if (expected[index]['name'] == event.json['name']) {
|
if (expected[index]['name'] == event.json!['name']) {
|
||||||
final Map<String, dynamic> expectedArgs = expected[index]['args'] as Map<String, dynamic>;
|
final Map<String, dynamic> expectedArgs = expected[index]['args'] as Map<String, dynamic>;
|
||||||
final Map<String, dynamic> args = event.json['args'] as Map<String, dynamic>;
|
final Map<String, dynamic> args = event.json!['args'] as Map<String, dynamic>;
|
||||||
if (_mapsEqual(expectedArgs, args)) {
|
if (_mapsEqual(expectedArgs, args)) {
|
||||||
expected.removeAt(index);
|
expected.removeAt(index);
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,8 @@ import 'package:vm_service/vm_service.dart';
|
|||||||
import 'package:vm_service/vm_service_io.dart';
|
import 'package:vm_service/vm_service_io.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
VmService vmService;
|
late VmService vmService;
|
||||||
LiveTestWidgetsFlutterBinding binding;
|
late LiveTestWidgetsFlutterBinding binding;
|
||||||
setUpAll(() async {
|
setUpAll(() async {
|
||||||
final developer.ServiceProtocolInfo info =
|
final developer.ServiceProtocolInfo info =
|
||||||
await developer.Service.getInfo();
|
await developer.Service.getInfo();
|
||||||
@ -24,7 +24,7 @@ void main() {
|
|||||||
fail('This test _must_ be run with --enable-vmservice.');
|
fail('This test _must_ be run with --enable-vmservice.');
|
||||||
}
|
}
|
||||||
|
|
||||||
vmService = await vmServiceConnectUri('ws://localhost:${info.serverUri.port}${info.serverUri.path}ws');
|
vmService = await vmServiceConnectUri('ws://localhost:${info.serverUri!.port}${info.serverUri!.path}ws');
|
||||||
await vmService.streamListen(EventStreams.kExtension);
|
await vmService.streamListen(EventStreams.kExtension);
|
||||||
|
|
||||||
// Initialize bindings
|
// Initialize bindings
|
||||||
@ -72,7 +72,7 @@ void main() {
|
|||||||
final Event event = await completer.future;
|
final Event event = await completer.future;
|
||||||
expect(event.extensionKind, 'Flutter.ImageSizesForFrame');
|
expect(event.extensionKind, 'Flutter.ImageSizesForFrame');
|
||||||
expect(
|
expect(
|
||||||
jsonEncode(event.extensionData.data),
|
jsonEncode(event.extensionData!.data),
|
||||||
'{"test.png":{"source":"test.png","displaySize":{"width":200.0,"height":100.0},"imageSize":{"width":300.0,"height":300.0},"displaySizeInBytes":106666,"decodedSizeInBytes":480000}}',
|
'{"test.png":{"source":"test.png","displaySize":{"width":200.0,"height":100.0},"imageSize":{"width":300.0,"height":300.0},"displaySizeInBytes":106666,"decodedSizeInBytes":480000}}',
|
||||||
);
|
);
|
||||||
}, skip: isBrowser); // uses dart:isolate and io
|
}, skip: isBrowser); // uses dart:isolate and io
|
||||||
@ -101,7 +101,7 @@ void main() {
|
|||||||
final Event event = await completer.future;
|
final Event event = await completer.future;
|
||||||
expect(event.extensionKind, 'Flutter.ImageSizesForFrame');
|
expect(event.extensionKind, 'Flutter.ImageSizesForFrame');
|
||||||
expect(
|
expect(
|
||||||
jsonEncode(event.extensionData.data),
|
jsonEncode(event.extensionData!.data),
|
||||||
'{"test.png":{"source":"test.png","displaySize":{"width":300.0,"height":300.0},"imageSize":{"width":300.0,"height":300.0},"displaySizeInBytes":480000,"decodedSizeInBytes":480000}}',
|
'{"test.png":{"source":"test.png","displaySize":{"width":300.0,"height":300.0},"imageSize":{"width":300.0,"height":300.0},"displaySizeInBytes":480000,"decodedSizeInBytes":480000}}',
|
||||||
);
|
);
|
||||||
}, skip: isBrowser); // uses dart:isolate and io
|
}, skip: isBrowser); // uses dart:isolate and io
|
||||||
|
Loading…
x
Reference in New Issue
Block a user