Unverified Commit 0c796599 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] make most integration tests null safe (#70334)

parent b5a4d089
...@@ -12,7 +12,7 @@ class BackgroundProject extends Project { ...@@ -12,7 +12,7 @@ class BackgroundProject extends Project {
final String pubspec = ''' final String pubspec = '''
name: test name: test
environment: environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0" sdk: ">=2.12.0-0 <3.0.0"
dependencies: dependencies:
flutter: flutter:
...@@ -62,7 +62,7 @@ class RepeatingBackgroundProject extends Project { ...@@ -62,7 +62,7 @@ class RepeatingBackgroundProject extends Project {
final String pubspec = ''' final String pubspec = '''
name: test name: test
environment: environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0" sdk: ">=2.12.0-0 <3.0.0"
dependencies: dependencies:
flutter: flutter:
......
...@@ -10,7 +10,7 @@ class BasicProject extends Project { ...@@ -10,7 +10,7 @@ class BasicProject extends Project {
final String pubspec = ''' final String pubspec = '''
name: test name: test
environment: environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0" sdk: ">=2.12.0-0 <3.0.0"
dependencies: dependencies:
flutter: flutter:
...@@ -63,7 +63,7 @@ class BasicProjectWithFlutterGen extends Project { ...@@ -63,7 +63,7 @@ class BasicProjectWithFlutterGen extends Project {
final String pubspec = ''' final String pubspec = '''
name: test name: test
environment: environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0" sdk: ">=2.12.0-0 <3.0.0"
dependencies: dependencies:
flutter: flutter:
...@@ -75,6 +75,8 @@ class BasicProjectWithFlutterGen extends Project { ...@@ -75,6 +75,8 @@ class BasicProjectWithFlutterGen extends Project {
@override @override
final String main = r''' final String main = r'''
// @dart = 2.8
// generated package does not syupport null safety.
import 'dart:async'; import 'dart:async';
import 'package:flutter_gen/flutter_gen.dart'; import 'package:flutter_gen/flutter_gen.dart';
...@@ -88,7 +90,7 @@ class BasicProjectWithUnaryMain extends Project { ...@@ -88,7 +90,7 @@ class BasicProjectWithUnaryMain extends Project {
final String pubspec = ''' final String pubspec = '''
name: test name: test
environment: environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0" sdk: ">=2.12.0-0 <3.0.0"
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
......
...@@ -47,6 +47,8 @@ dependencies: ...@@ -47,6 +47,8 @@ dependencies:
@override @override
final String main = r''' final String main = r'''
// @dart = 2.8
// generated localizations do not support null safety.
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'l10n/app_localizations.dart'; import 'l10n/app_localizations.dart';
......
...@@ -10,7 +10,7 @@ class HotReloadConstProject extends Project { ...@@ -10,7 +10,7 @@ class HotReloadConstProject extends Project {
final String pubspec = ''' final String pubspec = '''
name: test name: test
environment: environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0" sdk: ">=2.12.0-0 <3.0.0"
dependencies: dependencies:
flutter: flutter:
...@@ -26,8 +26,8 @@ class HotReloadConstProject extends Project { ...@@ -26,8 +26,8 @@ class HotReloadConstProject extends Project {
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
final ByteData message = const StringCodec().encodeMessage('AppLifecycleState.resumed'); final ByteData message = const StringCodec().encodeMessage('AppLifecycleState.resumed')!;
await ServicesBinding.instance.defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) { }); await ServicesBinding.instance!.defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) { });
runApp(const MyApp()); runApp(const MyApp());
} }
......
...@@ -10,7 +10,7 @@ class HotReloadProject extends Project { ...@@ -10,7 +10,7 @@ class HotReloadProject extends Project {
final String pubspec = ''' final String pubspec = '''
name: test name: test
environment: environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0" sdk: ">=2.12.0-0 <3.0.0"
dependencies: dependencies:
flutter: flutter:
...@@ -26,8 +26,8 @@ class HotReloadProject extends Project { ...@@ -26,8 +26,8 @@ class HotReloadProject extends Project {
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
final ByteData message = const StringCodec().encodeMessage('AppLifecycleState.resumed'); final ByteData message = const StringCodec().encodeMessage('AppLifecycleState.resumed')!;
await ServicesBinding.instance.defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) { }); await ServicesBinding.instance!.defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) { });
runApp(MyApp()); runApp(MyApp());
} }
...@@ -51,8 +51,8 @@ class HotReloadProject extends Project { ...@@ -51,8 +51,8 @@ class HotReloadProject extends Project {
// breakpoint. // breakpoint.
// tick 3 = second hot reload warmup reassemble frame (pre breakpoint) // tick 3 = second hot reload warmup reassemble frame (pre breakpoint)
if (count == 2) { if (count == 2) {
SchedulerBinding.instance.scheduleFrameCallback((Duration timestamp) { SchedulerBinding.instance!.scheduleFrameCallback((Duration timestamp) {
SchedulerBinding.instance.scheduleFrameCallback((Duration timestamp) { SchedulerBinding.instance!.scheduleFrameCallback((Duration timestamp) {
print('breakpoint line'); // SCHEDULED BREAKPOINT print('breakpoint line'); // SCHEDULED BREAKPOINT
}); });
}); });
......
...@@ -10,7 +10,7 @@ class HotReloadWithAssetProject extends Project { ...@@ -10,7 +10,7 @@ class HotReloadWithAssetProject extends Project {
final String pubspec = ''' final String pubspec = '''
name: test name: test
environment: environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0" sdk: ">=2.12.0-0 <3.0.0"
dependencies: dependencies:
flutter: flutter:
...@@ -29,8 +29,8 @@ import 'package:flutter/widgets.dart'; ...@@ -29,8 +29,8 @@ import 'package:flutter/widgets.dart';
Future<void> main() async { Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
final ByteData message = const StringCodec().encodeMessage('AppLifecycleState.resumed'); final ByteData message = const StringCodec().encodeMessage('AppLifecycleState.resumed')!;
await ServicesBinding.instance.defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) { }); await ServicesBinding.instance!.defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) { });
runApp(MyApp()); runApp(MyApp());
} }
......
...@@ -10,7 +10,7 @@ class ProjectWithEarlyError extends Project { ...@@ -10,7 +10,7 @@ class ProjectWithEarlyError extends Project {
final String pubspec = ''' final String pubspec = '''
name: test name: test
environment: environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0" sdk: ">=2.12.0-0 <3.0.0"
dependencies: dependencies:
flutter: flutter:
......
...@@ -10,7 +10,7 @@ class ProjectWithImmediateExit extends Project { ...@@ -10,7 +10,7 @@ class ProjectWithImmediateExit extends Project {
final String pubspec = ''' final String pubspec = '''
name: test name: test
environment: environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0" sdk: ">=2.12.0-0 <3.0.0"
dependencies: dependencies:
flutter: flutter:
......
...@@ -10,7 +10,7 @@ class SingleWidgetReloadProject extends Project { ...@@ -10,7 +10,7 @@ class SingleWidgetReloadProject extends Project {
final String pubspec = ''' final String pubspec = '''
name: test name: test
environment: environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0" sdk: ">=2.12.0-0 <3.0.0"
dependencies: dependencies:
flutter: flutter:
...@@ -26,8 +26,8 @@ class SingleWidgetReloadProject extends Project { ...@@ -26,8 +26,8 @@ class SingleWidgetReloadProject extends Project {
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
final ByteData message = const StringCodec().encodeMessage('AppLifecycleState.resumed'); final ByteData message = const StringCodec().encodeMessage('AppLifecycleState.resumed')!;
await ServicesBinding.instance.defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) { }); await ServicesBinding.instance!.defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) { });
runApp(MyApp()); runApp(MyApp());
} }
......
...@@ -10,7 +10,7 @@ class HotReloadProject extends Project { ...@@ -10,7 +10,7 @@ class HotReloadProject extends Project {
final String pubspec = ''' final String pubspec = '''
name: test name: test
environment: environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0" sdk: ">=2.12.0-0 <3.0.0"
dependencies: dependencies:
flutter: flutter:
...@@ -29,8 +29,8 @@ class HotReloadProject extends Project { ...@@ -29,8 +29,8 @@ class HotReloadProject extends Project {
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
final ByteData message = const StringCodec().encodeMessage('AppLifecycleState.resumed'); final ByteData message = const StringCodec().encodeMessage('AppLifecycleState.resumed')!;
await ServicesBinding.instance.defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) { }); await ServicesBinding.instance!.defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) { });
runApp(MyApp()); runApp(MyApp());
} }
......
...@@ -9,7 +9,7 @@ class SteppingProject extends Project { ...@@ -9,7 +9,7 @@ class SteppingProject extends Project {
final String pubspec = ''' final String pubspec = '''
name: test name: test
environment: environment:
sdk: '>=2.10.0 <3.0.0' sdk: '>=2.12.0-0 <3.0.0'
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
......
...@@ -10,7 +10,7 @@ class TestProject extends Project { ...@@ -10,7 +10,7 @@ class TestProject extends Project {
final String pubspec = ''' final String pubspec = '''
name: test name: test
environment: environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0" sdk: ">=2.12.0-0 <3.0.0"
dependencies: dependencies:
flutter: flutter:
......
...@@ -14,7 +14,7 @@ class TestsProject extends Project { ...@@ -14,7 +14,7 @@ class TestsProject extends Project {
final String pubspec = ''' final String pubspec = '''
name: test name: test
environment: environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0" sdk: ">=2.12.0-0 <3.0.0"
dependencies: dependencies:
flutter: flutter:
...@@ -29,7 +29,6 @@ class TestsProject extends Project { ...@@ -29,7 +29,6 @@ class TestsProject extends Project {
String get main => '// Unused'; String get main => '// Unused';
final String testContent = r''' final String testContent = r'''
// @dart = 2.8
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
......
...@@ -369,7 +369,7 @@ abstract class FlutterTestDriver { ...@@ -369,7 +369,7 @@ abstract class FlutterTestDriver {
} else if (!ignoreAppStopEvent && json['event'] == 'app.stop') { } else if (!ignoreAppStopEvent && json['event'] == 'app.stop') {
await subscription.cancel(); await subscription.cancel();
final StringBuffer error = StringBuffer(); final StringBuffer error = StringBuffer();
error.write('Received app.stop event while waiting for $interestingOccurrence\n\n'); error.write('Received app.stop event while waiting for $interestingOccurrence\n\n$_errorBuffer');
if (json['params'] != null && json['params']['error'] != null) { if (json['params'] != null && json['params']['error'] != null) {
error.write('${json['params']['error']}\n\n'); error.write('${json['params']['error']}\n\n');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment