[flutter_tools] migrate some integration tests to null safety (#103560)
This commit is contained in:
parent
42b6fbad26
commit
9f28b83c19
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io' hide Directory;
|
import 'dart:io' hide Directory;
|
||||||
@ -17,8 +15,8 @@ import 'test_driver.dart';
|
|||||||
import 'test_utils.dart';
|
import 'test_utils.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
Directory tempDir;
|
late Directory tempDir;
|
||||||
Process daemonProcess;
|
late Process daemonProcess;
|
||||||
|
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
tempDir = createResolvedTempDirectorySync('daemon_mode_test.');
|
tempDir = createResolvedTempDirectorySync('daemon_mode_test.');
|
||||||
@ -26,7 +24,7 @@ void main() {
|
|||||||
|
|
||||||
tearDown(() async {
|
tearDown(() async {
|
||||||
tryToDelete(tempDir);
|
tryToDelete(tempDir);
|
||||||
daemonProcess?.kill();
|
daemonProcess.kill();
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('device.getDevices', () async {
|
testWithoutContext('device.getDevices', () async {
|
||||||
@ -43,12 +41,12 @@ void main() {
|
|||||||
|
|
||||||
final StreamController<String> stdout = StreamController<String>.broadcast();
|
final StreamController<String> stdout = StreamController<String>.broadcast();
|
||||||
transformToLines(daemonProcess.stdout).listen((String line) => stdout.add(line));
|
transformToLines(daemonProcess.stdout).listen((String line) => stdout.add(line));
|
||||||
final Stream<Map<String, dynamic>> stream = stdout
|
final Stream<Map<String, Object?>?> stream = stdout
|
||||||
.stream
|
.stream
|
||||||
.map<Map<String, dynamic>>(parseFlutterResponse)
|
.map<Map<String, Object?>?>(parseFlutterResponse)
|
||||||
.where((Map<String, dynamic> value) => value != null);
|
.where((Map<String, Object?>? value) => value != null);
|
||||||
|
|
||||||
Map<String, dynamic> response = await stream.first;
|
Map<String, Object?> response = (await stream.first)!;
|
||||||
expect(response['event'], 'daemon.connected');
|
expect(response['event'], 'daemon.connected');
|
||||||
|
|
||||||
// start listening for devices
|
// start listening for devices
|
||||||
@ -56,13 +54,13 @@ void main() {
|
|||||||
'id': 1,
|
'id': 1,
|
||||||
'method': 'device.enable',
|
'method': 'device.enable',
|
||||||
})}]');
|
})}]');
|
||||||
response = await stream.firstWhere((Map<String, Object> json) => json['id'] == 1);
|
response = (await stream.firstWhere((Map<String, Object?>? json) => json!['id'] == 1))!;
|
||||||
expect(response['id'], 1);
|
expect(response['id'], 1);
|
||||||
expect(response['error'], isNull);
|
expect(response['error'], isNull);
|
||||||
|
|
||||||
// [{"event":"device.added","params":{"id":"flutter-tester","name":
|
// [{"event":"device.added","params":{"id":"flutter-tester","name":
|
||||||
// "Flutter test device","platform":"flutter-tester","emulator":false}}]
|
// "Flutter test device","platform":"flutter-tester","emulator":false}}]
|
||||||
response = await stream.first;
|
response = (await stream.first)!;
|
||||||
expect(response['event'], 'device.added');
|
expect(response['event'], 'device.added');
|
||||||
|
|
||||||
// get the list of all devices
|
// get the list of all devices
|
||||||
@ -71,7 +69,7 @@ void main() {
|
|||||||
'method': 'device.getDevices',
|
'method': 'device.getDevices',
|
||||||
})}]');
|
})}]');
|
||||||
// Skip other device.added events that may fire (desktop/web devices).
|
// Skip other device.added events that may fire (desktop/web devices).
|
||||||
response = await stream.firstWhere((Map<String, dynamic> response) => response['event'] != 'device.added');
|
response = (await stream.firstWhere((Map<String, Object?>? response) => response!['event'] != 'device.added'))!;
|
||||||
expect(response['id'], 2);
|
expect(response['id'], 2);
|
||||||
expect(response['error'], isNull);
|
expect(response['error'], isNull);
|
||||||
|
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:file_testing/file_testing.dart';
|
import 'package:file_testing/file_testing.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
|
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
@ -29,7 +27,7 @@ final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', platform
|
|||||||
|
|
||||||
/// A test for flutter upgrade & downgrade that checks out a parallel flutter repo.
|
/// A test for flutter upgrade & downgrade that checks out a parallel flutter repo.
|
||||||
void main() {
|
void main() {
|
||||||
Directory parentDirectory;
|
late Directory parentDirectory;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
parentDirectory = fileSystem.systemTempDirectory
|
parentDirectory = fileSystem.systemTempDirectory
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
|
|
||||||
@ -12,7 +10,7 @@ import 'test_utils.dart';
|
|||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
final String dartBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'dart');
|
final String dartBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'dart');
|
||||||
Directory tempDir;
|
late Directory tempDir;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
tempDir = createResolvedTempDirectorySync('exit_code_test.');
|
tempDir = createResolvedTempDirectorySync('exit_code_test.');
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:vm_service/vm_service.dart';
|
import 'package:vm_service/vm_service.dart';
|
||||||
|
|
||||||
@ -13,9 +11,9 @@ import 'test_driver.dart';
|
|||||||
import 'test_utils.dart';
|
import 'test_utils.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
FlutterRunTestDriver flutterRun, flutterAttach;
|
late FlutterRunTestDriver flutterRun, flutterAttach;
|
||||||
final BasicProject project = BasicProject();
|
final BasicProject project = BasicProject();
|
||||||
Directory tempDir;
|
late Directory tempDir;
|
||||||
|
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
tempDir = createResolvedTempDirectorySync('attach_test.');
|
tempDir = createResolvedTempDirectorySync('attach_test.');
|
||||||
@ -39,28 +37,28 @@ void main() {
|
|||||||
|
|
||||||
testWithoutContext('can hot reload', () async {
|
testWithoutContext('can hot reload', () async {
|
||||||
await flutterRun.run(withDebugger: true);
|
await flutterRun.run(withDebugger: true);
|
||||||
await flutterAttach.attach(flutterRun.vmServicePort);
|
await flutterAttach.attach(flutterRun.vmServicePort!);
|
||||||
await flutterAttach.hotReload();
|
await flutterAttach.hotReload();
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('can detach, reattach, hot reload', () async {
|
testWithoutContext('can detach, reattach, hot reload', () async {
|
||||||
await flutterRun.run(withDebugger: true);
|
await flutterRun.run(withDebugger: true);
|
||||||
await flutterAttach.attach(flutterRun.vmServicePort);
|
await flutterAttach.attach(flutterRun.vmServicePort!);
|
||||||
await flutterAttach.detach();
|
await flutterAttach.detach();
|
||||||
await flutterAttach.attach(flutterRun.vmServicePort);
|
await flutterAttach.attach(flutterRun.vmServicePort!);
|
||||||
await flutterAttach.hotReload();
|
await flutterAttach.hotReload();
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('killing process behaves the same as detach ', () async {
|
testWithoutContext('killing process behaves the same as detach ', () async {
|
||||||
await flutterRun.run(withDebugger: true);
|
await flutterRun.run(withDebugger: true);
|
||||||
await flutterAttach.attach(flutterRun.vmServicePort);
|
await flutterAttach.attach(flutterRun.vmServicePort!);
|
||||||
await flutterAttach.quit();
|
await flutterAttach.quit();
|
||||||
flutterAttach = FlutterRunTestDriver(
|
flutterAttach = FlutterRunTestDriver(
|
||||||
tempDir,
|
tempDir,
|
||||||
logPrefix: 'ATTACH-2',
|
logPrefix: 'ATTACH-2',
|
||||||
spawnDdsInstance: false,
|
spawnDdsInstance: false,
|
||||||
);
|
);
|
||||||
await flutterAttach.attach(flutterRun.vmServicePort);
|
await flutterAttach.attach(flutterRun.vmServicePort!);
|
||||||
await flutterAttach.hotReload();
|
await flutterAttach.hotReload();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -85,11 +83,11 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final Response response = await flutterRun.callServiceExtension('ext.flutter.connectedVmServiceUri');
|
final Response response = await flutterRun.callServiceExtension('ext.flutter.connectedVmServiceUri');
|
||||||
final String vmServiceUri = response.json['value'] as String;
|
final String vmServiceUri = response.json!['value'] as String;
|
||||||
|
|
||||||
// Attach with a different DevTools server address.
|
// Attach with a different DevTools server address.
|
||||||
await flutterAttach.attach(
|
await flutterAttach.attach(
|
||||||
flutterRun.vmServicePort,
|
flutterRun.vmServicePort!,
|
||||||
additionalCommandArgs: <String>['--devtools-server-address', 'http://127.0.0.1:9110'],
|
additionalCommandArgs: <String>['--devtools-server-address', 'http://127.0.0.1:9110'],
|
||||||
);
|
);
|
||||||
await pollForServiceExtensionValue<String>(
|
await pollForServiceExtensionValue<String>(
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:file_testing/file_testing.dart';
|
import 'package:file_testing/file_testing.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
|
|
||||||
@ -17,9 +15,9 @@ import 'test_utils.dart';
|
|||||||
// `flutter build` command inside the `example` directory, so we create a plugin
|
// `flutter build` command inside the `example` directory, so we create a plugin
|
||||||
// project in the test.
|
// project in the test.
|
||||||
void main() {
|
void main() {
|
||||||
Directory tempDir;
|
late Directory tempDir;
|
||||||
String flutterBin;
|
late String flutterBin;
|
||||||
Directory exampleAppDir;
|
late Directory exampleAppDir;
|
||||||
|
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
tempDir = createResolvedTempDirectorySync('flutter_plugin_test.');
|
tempDir = createResolvedTempDirectorySync('flutter_plugin_test.');
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
|
|
||||||
@ -11,9 +9,9 @@ import '../src/common.dart';
|
|||||||
import 'test_utils.dart';
|
import 'test_utils.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
Directory tempDir;
|
late Directory tempDir;
|
||||||
Directory projectRoot;
|
late Directory projectRoot;
|
||||||
String flutterBin;
|
late String flutterBin;
|
||||||
final List<String> targetPlatforms = <String>[
|
final List<String> targetPlatforms = <String>[
|
||||||
'apk',
|
'apk',
|
||||||
'web',
|
'web',
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
|
|
||||||
@ -11,9 +9,9 @@ import '../src/common.dart';
|
|||||||
import 'test_utils.dart';
|
import 'test_utils.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
Directory tempDir;
|
late Directory tempDir;
|
||||||
Directory projectRoot;
|
late Directory projectRoot;
|
||||||
String flutterBin;
|
late String flutterBin;
|
||||||
final List<String> targetPlatforms = <String>[
|
final List<String> targetPlatforms = <String>[
|
||||||
'apk',
|
'apk',
|
||||||
'web',
|
'web',
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
@ -14,9 +12,9 @@ import 'test_driver.dart';
|
|||||||
import 'test_utils.dart';
|
import 'test_utils.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
Directory tempDir;
|
late Directory tempDir;
|
||||||
final BasicProjectWithFlutterGen project = BasicProjectWithFlutterGen();
|
final BasicProjectWithFlutterGen project = BasicProjectWithFlutterGen();
|
||||||
FlutterRunTestDriver flutter;
|
late FlutterRunTestDriver flutter;
|
||||||
|
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
tempDir = createResolvedTempDirectorySync('run_test.');
|
tempDir = createResolvedTempDirectorySync('run_test.');
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
import 'package:process/process.dart';
|
import 'package:process/process.dart';
|
||||||
@ -14,9 +12,9 @@ import 'test_driver.dart';
|
|||||||
import 'test_utils.dart';
|
import 'test_utils.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
Directory tempDir;
|
late Directory tempDir;
|
||||||
final BasicProject project = BasicProject();
|
final BasicProject project = BasicProject();
|
||||||
FlutterRunTestDriver flutter;
|
late FlutterRunTestDriver flutter;
|
||||||
|
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
tempDir = createResolvedTempDirectorySync('run_test.');
|
tempDir = createResolvedTempDirectorySync('run_test.');
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
@ -17,10 +15,10 @@ import 'test_driver.dart';
|
|||||||
import 'test_utils.dart';
|
import 'test_utils.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
Directory tempDir;
|
late Directory tempDir;
|
||||||
final ProjectWithEarlyError project = ProjectWithEarlyError();
|
final ProjectWithEarlyError project = ProjectWithEarlyError();
|
||||||
const String exceptionStart = '══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞══════════════════';
|
const String exceptionStart = '══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞══════════════════';
|
||||||
FlutterRunTestDriver flutter;
|
late FlutterRunTestDriver flutter;
|
||||||
|
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
tempDir = createResolvedTempDirectorySync('run_test.');
|
tempDir = createResolvedTempDirectorySync('run_test.');
|
||||||
@ -56,14 +54,14 @@ void main() {
|
|||||||
|
|
||||||
if (line.startsWith('An Observatory debugger')) {
|
if (line.startsWith('An Observatory debugger')) {
|
||||||
final RegExp exp = RegExp(r'http://127.0.0.1:(\d+)/');
|
final RegExp exp = RegExp(r'http://127.0.0.1:(\d+)/');
|
||||||
final RegExpMatch match = exp.firstMatch(line);
|
final RegExpMatch match = exp.firstMatch(line)!;
|
||||||
final String port = match.group(1);
|
final String port = match.group(1)!;
|
||||||
if (port != null) {
|
if (port != null) {
|
||||||
final VmService vmService =
|
final VmService vmService =
|
||||||
await vmServiceConnectUri('ws://localhost:$port/ws');
|
await vmServiceConnectUri('ws://localhost:$port/ws');
|
||||||
final VM vm = await vmService.getVM();
|
final VM vm = await vmService.getVM();
|
||||||
for (final IsolateRef isolate in vm.isolates) {
|
for (final IsolateRef isolate in vm.isolates!) {
|
||||||
await vmService.resume(isolate.id);
|
await vmService.resume(isolate.id!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
|
|
||||||
import '../src/common.dart';
|
import '../src/common.dart';
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
@ -19,8 +17,8 @@ final GenL10nProject project = GenL10nProject();
|
|||||||
// It can fail if gen_l10n produces a lib/l10n/app_localizations.dart that
|
// It can fail if gen_l10n produces a lib/l10n/app_localizations.dart that
|
||||||
// does not analyze cleanly.
|
// does not analyze cleanly.
|
||||||
void main() {
|
void main() {
|
||||||
Directory tempDir;
|
late Directory tempDir;
|
||||||
FlutterRunTestDriver flutter;
|
late FlutterRunTestDriver flutter;
|
||||||
|
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
tempDir = createResolvedTempDirectorySync('gen_l10n_test.');
|
tempDir = createResolvedTempDirectorySync('gen_l10n_test.');
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:file_testing/file_testing.dart';
|
import 'package:file_testing/file_testing.dart';
|
||||||
|
|
||||||
@ -11,7 +9,7 @@ import '../src/common.dart';
|
|||||||
import 'test_utils.dart';
|
import 'test_utils.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
Directory tempDir;
|
late Directory tempDir;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
tempDir = createResolvedTempDirectorySync('flutter_plugin_test.');
|
tempDir = createResolvedTempDirectorySync('flutter_plugin_test.');
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
|
|
||||||
import '../src/common.dart';
|
import '../src/common.dart';
|
||||||
@ -12,9 +10,9 @@ import 'test_driver.dart';
|
|||||||
import 'test_utils.dart';
|
import 'test_utils.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
Directory tempDir;
|
late Directory tempDir;
|
||||||
final HotReloadConstProject project = HotReloadConstProject();
|
final HotReloadConstProject project = HotReloadConstProject();
|
||||||
FlutterRunTestDriver flutter;
|
late FlutterRunTestDriver flutter;
|
||||||
|
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
tempDir = createResolvedTempDirectorySync('hot_reload_test.');
|
tempDir = createResolvedTempDirectorySync('hot_reload_test.');
|
||||||
@ -23,7 +21,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tearDown(() async {
|
tearDown(() async {
|
||||||
await flutter?.stop();
|
await flutter.stop();
|
||||||
tryToDelete(tempDir);
|
tryToDelete(tempDir);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
@ -15,9 +13,9 @@ import 'test_driver.dart';
|
|||||||
import 'test_utils.dart';
|
import 'test_utils.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
Directory tempDir;
|
late Directory tempDir;
|
||||||
final HotReloadProject project = HotReloadProject();
|
final HotReloadProject project = HotReloadProject();
|
||||||
FlutterRunTestDriver flutter;
|
late FlutterRunTestDriver flutter;
|
||||||
|
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
tempDir = createResolvedTempDirectorySync('hot_reload_test.');
|
tempDir = createResolvedTempDirectorySync('hot_reload_test.');
|
||||||
@ -26,7 +24,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tearDown(() async {
|
tearDown(() async {
|
||||||
await flutter?.stop();
|
await flutter.stop();
|
||||||
tryToDelete(tempDir);
|
tryToDelete(tempDir);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -123,7 +121,7 @@ void main() {
|
|||||||
await Future<void>.delayed(const Duration(seconds: 2));
|
await Future<void>.delayed(const Duration(seconds: 2));
|
||||||
await flutter.hotReload(); // reload triggers code which eventually hits the breakpoint
|
await flutter.hotReload(); // reload triggers code which eventually hits the breakpoint
|
||||||
isolate = await flutter.waitForPause();
|
isolate = await flutter.waitForPause();
|
||||||
expect(isolate.pauseEvent.kind, equals(EventKind.kPauseBreakpoint));
|
expect(isolate.pauseEvent?.kind, equals(EventKind.kPauseBreakpoint));
|
||||||
await flutter.resume();
|
await flutter.resume();
|
||||||
await flutter.addBreakpoint(
|
await flutter.addBreakpoint(
|
||||||
project.buildBreakpointUri,
|
project.buildBreakpointUri,
|
||||||
@ -133,7 +131,7 @@ void main() {
|
|||||||
final Future<void> reloadFuture = flutter.hotReload().then((void value) { reloaded = true; });
|
final Future<void> reloadFuture = flutter.hotReload().then((void value) { reloaded = true; });
|
||||||
printOnFailure('waiting for pause...');
|
printOnFailure('waiting for pause...');
|
||||||
isolate = await flutter.waitForPause();
|
isolate = await flutter.waitForPause();
|
||||||
expect(isolate.pauseEvent.kind, equals(EventKind.kPauseBreakpoint));
|
expect(isolate.pauseEvent?.kind, equals(EventKind.kPauseBreakpoint));
|
||||||
printOnFailure('waiting for debugger message...');
|
printOnFailure('waiting for debugger message...');
|
||||||
await sawDebuggerPausedMessage.future;
|
await sawDebuggerPausedMessage.future;
|
||||||
expect(reloaded, isFalse);
|
expect(reloaded, isFalse);
|
||||||
@ -179,7 +177,7 @@ void main() {
|
|||||||
await Future<void>.delayed(const Duration(seconds: 1));
|
await Future<void>.delayed(const Duration(seconds: 1));
|
||||||
final Future<void> reloadFuture = flutter.hotReload().then((void value) { reloaded = true; });
|
final Future<void> reloadFuture = flutter.hotReload().then((void value) { reloaded = true; });
|
||||||
final Isolate isolate = await flutter.waitForPause();
|
final Isolate isolate = await flutter.waitForPause();
|
||||||
expect(isolate.pauseEvent.kind, equals(EventKind.kPauseBreakpoint));
|
expect(isolate.pauseEvent?.kind, equals(EventKind.kPauseBreakpoint));
|
||||||
expect(reloaded, isFalse);
|
expect(reloaded, isFalse);
|
||||||
await sawDebuggerPausedMessage1.future; // this is the one where it say "uh, you broke into the debugger while reloading"
|
await sawDebuggerPausedMessage1.future; // this is the one where it say "uh, you broke into the debugger while reloading"
|
||||||
await reloadFuture; // this is the one where it times out because you're in the debugger
|
await reloadFuture; // this is the one where it times out because you're in the debugger
|
||||||
@ -191,10 +189,10 @@ void main() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _isHotReloadCompletionEvent(Map<String, dynamic> event) {
|
bool _isHotReloadCompletionEvent(Map<String, Object?>? event) {
|
||||||
return event != null &&
|
return event != null &&
|
||||||
event['event'] == 'app.progress' &&
|
event['event'] == 'app.progress' &&
|
||||||
event['params'] != null &&
|
event['params'] != null &&
|
||||||
(event['params'] as Map<String, dynamic>)['progressId'] == 'hot.reload' &&
|
(event['params'] as Map<String, Object?>?)!['progressId'] == 'hot.reload' &&
|
||||||
(event['params'] as Map<String, dynamic>)['finished'] == true;
|
(event['params'] as Map<String, Object?>?)!['finished'] == true;
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
@ -14,9 +12,9 @@ import 'test_driver.dart';
|
|||||||
import 'test_utils.dart';
|
import 'test_utils.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
Directory tempDir;
|
late Directory tempDir;
|
||||||
final HotReloadWithAssetProject project = HotReloadWithAssetProject();
|
final HotReloadWithAssetProject project = HotReloadWithAssetProject();
|
||||||
FlutterRunTestDriver flutter;
|
late FlutterRunTestDriver flutter;
|
||||||
|
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
tempDir = createResolvedTempDirectorySync('hot_reload_test.');
|
tempDir = createResolvedTempDirectorySync('hot_reload_test.');
|
||||||
@ -25,7 +23,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tearDown(() async {
|
tearDown(() async {
|
||||||
await flutter?.stop();
|
await flutter.stop();
|
||||||
tryToDelete(tempDir);
|
tryToDelete(tempDir);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
|
|
||||||
import '../src/common.dart';
|
import '../src/common.dart';
|
||||||
@ -18,8 +16,8 @@ const Duration requiredLifespan = Duration(seconds: 5);
|
|||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
final BasicProject project = BasicProject();
|
final BasicProject project = BasicProject();
|
||||||
FlutterRunTestDriver flutter;
|
late FlutterRunTestDriver flutter;
|
||||||
Directory tempDir;
|
late Directory tempDir;
|
||||||
|
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
tempDir = createResolvedTempDirectorySync('lifetime_test.');
|
tempDir = createResolvedTempDirectorySync('lifetime_test.');
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
@ -14,12 +12,12 @@ import 'package:flutter_tools/src/migrate/migrate_utils.dart';
|
|||||||
import '../src/common.dart';
|
import '../src/common.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
BufferLogger logger;
|
late BufferLogger logger;
|
||||||
FileSystem fileSystem;
|
late FileSystem fileSystem;
|
||||||
Directory projectRoot;
|
late Directory projectRoot;
|
||||||
String projectRootPath;
|
late String projectRootPath;
|
||||||
MigrateUtils utils;
|
late MigrateUtils utils;
|
||||||
ProcessUtils processUtils;
|
late ProcessUtils processUtils;
|
||||||
|
|
||||||
setUpAll(() async {
|
setUpAll(() async {
|
||||||
fileSystem = globals.localFileSystem;
|
fileSystem = globals.localFileSystem;
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
|
|
||||||
@ -13,8 +11,8 @@ import 'test_driver.dart';
|
|||||||
import 'test_utils.dart';
|
import 'test_utils.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
Directory tempDir;
|
late Directory tempDir;
|
||||||
FlutterRunTestDriver flutter;
|
late FlutterRunTestDriver flutter;
|
||||||
|
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
tempDir = createResolvedTempDirectorySync('run_test.');
|
tempDir = createResolvedTempDirectorySync('run_test.');
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
@ -43,7 +41,7 @@ Future<void> waitForObservatoryMessage(Process process, int port) async {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
Directory tempDir;
|
late Directory tempDir;
|
||||||
final BasicProject project = BasicProject();
|
final BasicProject project = BasicProject();
|
||||||
|
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
|
@ -22,9 +22,6 @@
|
|||||||
// To aid in debugging, consider passing the `debug: true` argument
|
// To aid in debugging, consider passing the `debug: true` argument
|
||||||
// to the runFlutter function.
|
// to the runFlutter function.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
// This file is ready to transition, just uncomment /*?*/, /*!*/, and /*late*/.
|
|
||||||
|
|
||||||
// This file intentionally assumes the tests run in order.
|
// This file intentionally assumes the tests run in order.
|
||||||
@Tags(<String>['no-shuffle'])
|
@Tags(<String>['no-shuffle'])
|
||||||
|
|
||||||
@ -49,7 +46,7 @@ void debugPrint(String message) {
|
|||||||
print(message);
|
print(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef LineHandler = String/*?*/ Function(String line);
|
typedef LineHandler = String? Function(String line);
|
||||||
|
|
||||||
abstract class Transition {
|
abstract class Transition {
|
||||||
const Transition({this.handler, this.logging});
|
const Transition({this.handler, this.logging});
|
||||||
@ -59,12 +56,12 @@ abstract class Transition {
|
|||||||
/// This should not throw, even if the test is failing. (For example, don't use "expect"
|
/// This should not throw, even if the test is failing. (For example, don't use "expect"
|
||||||
/// in these callbacks.) Throwing here would prevent the [runFlutter] function from running
|
/// in these callbacks.) Throwing here would prevent the [runFlutter] function from running
|
||||||
/// to completion, which would leave zombie `flutter` processes around.
|
/// to completion, which would leave zombie `flutter` processes around.
|
||||||
final LineHandler/*?*/ handler;
|
final LineHandler? handler;
|
||||||
|
|
||||||
/// Whether to enable or disable logging when this transition is matched.
|
/// Whether to enable or disable logging when this transition is matched.
|
||||||
///
|
///
|
||||||
/// The default value, null, leaves the logging state unaffected.
|
/// The default value, null, leaves the logging state unaffected.
|
||||||
final bool/*?*/ logging;
|
final bool? logging;
|
||||||
|
|
||||||
bool matches(String line);
|
bool matches(String line);
|
||||||
|
|
||||||
@ -89,7 +86,7 @@ abstract class Transition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Barrier extends Transition {
|
class Barrier extends Transition {
|
||||||
const Barrier(this.pattern, {LineHandler/*?*/ handler, bool/*?*/ logging}) : super(handler: handler, logging: logging);
|
const Barrier(this.pattern, {super.handler, super.logging});
|
||||||
final Pattern pattern;
|
final Pattern pattern;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -101,11 +98,10 @@ class Barrier extends Transition {
|
|||||||
|
|
||||||
class Multiple extends Transition {
|
class Multiple extends Transition {
|
||||||
Multiple(List<Pattern> patterns, {
|
Multiple(List<Pattern> patterns, {
|
||||||
LineHandler/*?*/ handler,
|
super.handler,
|
||||||
bool/*?*/ logging,
|
super.logging,
|
||||||
}) : _originalPatterns = patterns,
|
}) : _originalPatterns = patterns,
|
||||||
patterns = patterns.toList(),
|
patterns = patterns.toList();
|
||||||
super(handler: handler, logging: logging);
|
|
||||||
|
|
||||||
final List<Pattern> _originalPatterns;
|
final List<Pattern> _originalPatterns;
|
||||||
final List<Pattern> patterns;
|
final List<Pattern> patterns;
|
||||||
@ -159,7 +155,7 @@ class LogLine {
|
|||||||
case 0x0D: return '<CR>';
|
case 0x0D: return '<CR>';
|
||||||
}
|
}
|
||||||
return '<${rune.toRadixString(16).padLeft(rune <= 0xFF ? 2 : rune <= 0xFFFF ? 4 : 5, '0')}>';
|
return '<${rune.toRadixString(16).padLeft(rune <= 0xFF ? 2 : rune <= 0xFFFF ? 4 : 5, '0')}>';
|
||||||
}).join('');
|
}).join();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +218,7 @@ Future<ProcessTestResult> runFlutter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool streamingLogs = false;
|
bool streamingLogs = false;
|
||||||
Timer/*?*/ timeout;
|
Timer? timeout;
|
||||||
void processTimeout() {
|
void processTimeout() {
|
||||||
if (!streamingLogs) {
|
if (!streamingLogs) {
|
||||||
streamingLogs = true;
|
streamingLogs = true;
|
||||||
@ -235,7 +231,7 @@ Future<ProcessTestResult> runFlutter(
|
|||||||
debugPrint('(taking a long time...)');
|
debugPrint('(taking a long time...)');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String stamp() => '[${(clock.elapsed.inMilliseconds / 1000.0).toStringAsFixed(1).padLeft(5, " ")}s]';
|
String stamp() => '[${(clock.elapsed.inMilliseconds / 1000.0).toStringAsFixed(1).padLeft(5)}s]';
|
||||||
void processStdout(String line) {
|
void processStdout(String line) {
|
||||||
final LogLine log = LogLine('stdout', stamp(), line);
|
final LogLine log = LogLine('stdout', stamp(), line);
|
||||||
if (logging) {
|
if (logging) {
|
||||||
@ -249,10 +245,10 @@ Future<ProcessTestResult> runFlutter(
|
|||||||
debugPrint('(matched ${transitions[nextTransition]})');
|
debugPrint('(matched ${transitions[nextTransition]})');
|
||||||
}
|
}
|
||||||
if (transitions[nextTransition].logging != null) {
|
if (transitions[nextTransition].logging != null) {
|
||||||
if (!logging && transitions[nextTransition].logging/*!*/) {
|
if (!logging && transitions[nextTransition].logging!) {
|
||||||
logs.add(log);
|
logs.add(log);
|
||||||
}
|
}
|
||||||
logging = transitions[nextTransition].logging/*!*/;
|
logging = transitions[nextTransition].logging!;
|
||||||
if (streamingLogs) {
|
if (streamingLogs) {
|
||||||
if (logging) {
|
if (logging) {
|
||||||
debugPrint('(enabled logging)');
|
debugPrint('(enabled logging)');
|
||||||
@ -262,7 +258,7 @@ Future<ProcessTestResult> runFlutter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (transitions[nextTransition].handler != null) {
|
if (transitions[nextTransition].handler != null) {
|
||||||
final String/*?*/ command = transitions[nextTransition].handler/*!*/(line);
|
final String? command = transitions[nextTransition].handler!(line);
|
||||||
if (command != null) {
|
if (command != null) {
|
||||||
final LogLine inLog = LogLine('stdin', stamp(), command);
|
final LogLine inLog = LogLine('stdin', stamp(), command);
|
||||||
logs.add(inLog);
|
logs.add(inLog);
|
||||||
@ -333,7 +329,7 @@ void main() {
|
|||||||
final String tempDirectory = fileSystem.systemTempDirectory.createTempSync('flutter_overall_experience_test.').resolveSymbolicLinksSync();
|
final String tempDirectory = fileSystem.systemTempDirectory.createTempSync('flutter_overall_experience_test.').resolveSymbolicLinksSync();
|
||||||
final String pidFile = fileSystem.path.join(tempDirectory, 'flutter.pid');
|
final String pidFile = fileSystem.path.join(tempDirectory, 'flutter.pid');
|
||||||
final String testDirectory = fileSystem.path.join(flutterRoot, 'examples', 'hello_world');
|
final String testDirectory = fileSystem.path.join(flutterRoot, 'examples', 'hello_world');
|
||||||
bool/*?*/ existsDuringTest;
|
bool? existsDuringTest;
|
||||||
try {
|
try {
|
||||||
expect(fileSystem.file(pidFile).existsSync(), isFalse);
|
expect(fileSystem.file(pidFile).existsSync(), isFalse);
|
||||||
final ProcessTestResult result = await runFlutter(
|
final ProcessTestResult result = await runFlutter(
|
||||||
@ -367,7 +363,7 @@ void main() {
|
|||||||
final String pidFile = fileSystem.path.join(tempDirectory, 'flutter.pid');
|
final String pidFile = fileSystem.path.join(tempDirectory, 'flutter.pid');
|
||||||
final String testDirectory = fileSystem.path.join(flutterRoot, 'dev', 'integration_tests', 'ui');
|
final String testDirectory = fileSystem.path.join(flutterRoot, 'dev', 'integration_tests', 'ui');
|
||||||
final String testScript = fileSystem.path.join('lib', 'commands.dart');
|
final String testScript = fileSystem.path.join('lib', 'commands.dart');
|
||||||
/*late*/ int pid;
|
late int pid;
|
||||||
try {
|
try {
|
||||||
final ProcessTestResult result = await runFlutter(
|
final ProcessTestResult result = await runFlutter(
|
||||||
<String>['run', '-dflutter-tester', '--report-ready', '--pid-file', pidFile, '--no-devtools', testScript],
|
<String>['run', '-dflutter-tester', '--report-ready', '--pid-file', pidFile, '--no-devtools', testScript],
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
@ -52,9 +50,9 @@ void main() {
|
|||||||
// `ProcessManager` because doing so wouldn't actually test what we want to
|
// `ProcessManager` because doing so wouldn't actually test what we want to
|
||||||
// test, which is that the underlying tool we're using to parse Plist files
|
// test, which is that the underlying tool we're using to parse Plist files
|
||||||
// works with the way we're calling it.
|
// works with the way we're calling it.
|
||||||
File file;
|
late File file;
|
||||||
PlistParser parser;
|
late PlistParser parser;
|
||||||
BufferLogger logger;
|
late BufferLogger logger;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
logger = BufferLogger(
|
logger = BufferLogger(
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
@ -14,9 +12,9 @@ import 'test_driver.dart';
|
|||||||
import 'test_utils.dart';
|
import 'test_utils.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
Directory tempDir;
|
late Directory tempDir;
|
||||||
final SingleWidgetReloadProject project = SingleWidgetReloadProject();
|
final SingleWidgetReloadProject project = SingleWidgetReloadProject();
|
||||||
FlutterRunTestDriver flutter;
|
late FlutterRunTestDriver flutter;
|
||||||
|
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
tempDir = createResolvedTempDirectorySync('hot_reload_test.');
|
tempDir = createResolvedTempDirectorySync('hot_reload_test.');
|
||||||
@ -25,7 +23,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tearDown(() async {
|
tearDown(() async {
|
||||||
await flutter?.stop();
|
await flutter.stop();
|
||||||
tryToDelete(tempDir);
|
tryToDelete(tempDir);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
@ -16,9 +14,9 @@ import 'test_utils.dart';
|
|||||||
// This test verifies that we can hot reload a stateless widget into a
|
// This test verifies that we can hot reload a stateless widget into a
|
||||||
// stateful one and back.
|
// stateful one and back.
|
||||||
void main() {
|
void main() {
|
||||||
Directory tempDir;
|
late Directory tempDir;
|
||||||
final HotReloadProject project = HotReloadProject();
|
final HotReloadProject project = HotReloadProject();
|
||||||
FlutterRunTestDriver flutter;
|
late FlutterRunTestDriver flutter;
|
||||||
|
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
tempDir = createResolvedTempDirectorySync('hot_reload_test.');
|
tempDir = createResolvedTempDirectorySync('hot_reload_test.');
|
||||||
@ -27,7 +25,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tearDown(() async {
|
tearDown(() async {
|
||||||
await flutter?.stop();
|
await flutter.stop();
|
||||||
tryToDelete(tempDir);
|
tryToDelete(tempDir);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:flutter_tools/src/convert.dart';
|
import 'package:flutter_tools/src/convert.dart';
|
||||||
import '../src/common.dart';
|
import '../src/common.dart';
|
||||||
@ -12,11 +10,11 @@ import 'test_utils.dart';
|
|||||||
/// Checks that all active template files are defined in the template_manifest.json file.
|
/// Checks that all active template files are defined in the template_manifest.json file.
|
||||||
void main() {
|
void main() {
|
||||||
testWithoutContext('Check template manifest is up to date', () {
|
testWithoutContext('Check template manifest is up to date', () {
|
||||||
final Map<String, Object> manifest = json.decode(
|
final Map<String, Object?> manifest = json.decode(
|
||||||
fileSystem.file('templates/template_manifest.json').readAsStringSync(),
|
fileSystem.file('templates/template_manifest.json').readAsStringSync(),
|
||||||
) as Map<String, Object>;
|
) as Map<String, Object?>;
|
||||||
final Set<Uri> declaredFileList = Set<Uri>.from(
|
final Set<Uri> declaredFileList = Set<Uri>.from(
|
||||||
(manifest['files'] as List<Object>).cast<String>().map<Uri>(fileSystem.path.toUri));
|
(manifest['files'] as List<Object?>?)!.cast<String>().map<Uri>(fileSystem.path.toUri));
|
||||||
|
|
||||||
final Set<Uri> activeTemplateList = fileSystem.directory('templates')
|
final Set<Uri> activeTemplateList = fileSystem.directory('templates')
|
||||||
.listSync(recursive: true)
|
.listSync(recursive: true)
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
// TODO(gspencergoog): Remove this tag once this test's state leaks/test
|
// TODO(gspencergoog): Remove this tag once this test's state leaks/test
|
||||||
// dependencies have been fixed.
|
// dependencies have been fixed.
|
||||||
// https://github.com/flutter/flutter/issues/85160
|
// https://github.com/flutter/flutter/issues/85160
|
||||||
@ -205,7 +203,7 @@ Future<void> _testFile(
|
|||||||
String testName,
|
String testName,
|
||||||
String workingDirectory,
|
String workingDirectory,
|
||||||
String testDirectory, {
|
String testDirectory, {
|
||||||
Matcher exitCode,
|
Matcher? exitCode,
|
||||||
List<String> extraArguments = const <String>[],
|
List<String> extraArguments = const <String>[],
|
||||||
}) async {
|
}) async {
|
||||||
exitCode ??= isNonZero;
|
exitCode ??= isNonZero;
|
||||||
@ -287,7 +285,7 @@ Future<void> _testFile(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<ProcessResult> _runFlutterTest(
|
Future<ProcessResult> _runFlutterTest(
|
||||||
String testName,
|
String? testName,
|
||||||
String workingDirectory,
|
String workingDirectory,
|
||||||
String testDirectory, {
|
String testDirectory, {
|
||||||
List<String> extraArguments = const <String>[],
|
List<String> extraArguments = const <String>[],
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
@ -16,9 +14,9 @@ import 'test_driver.dart';
|
|||||||
import 'test_utils.dart';
|
import 'test_utils.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
Directory tempDir;
|
late Directory tempDir;
|
||||||
FlutterRunTestDriver flutter;
|
late FlutterRunTestDriver flutter;
|
||||||
VmService vmService;
|
late VmService vmService;
|
||||||
|
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
tempDir = createResolvedTempDirectorySync('vmservice_integration_test.');
|
tempDir = createResolvedTempDirectorySync('vmservice_integration_test.');
|
||||||
@ -28,12 +26,12 @@ void main() {
|
|||||||
|
|
||||||
flutter = FlutterRunTestDriver(tempDir);
|
flutter = FlutterRunTestDriver(tempDir);
|
||||||
await flutter.run(withDebugger: true);
|
await flutter.run(withDebugger: true);
|
||||||
final int port = flutter.vmServicePort;
|
final int? port = flutter.vmServicePort;
|
||||||
vmService = await vmServiceConnectUri('ws://localhost:$port/ws');
|
vmService = await vmServiceConnectUri('ws://localhost:$port/ws');
|
||||||
});
|
});
|
||||||
|
|
||||||
tearDown(() async {
|
tearDown(() async {
|
||||||
await flutter?.stop();
|
await flutter.stop();
|
||||||
tryToDelete(tempDir);
|
tryToDelete(tempDir);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -78,16 +76,16 @@ void main() {
|
|||||||
'ext.flutter.brightnessOverride',
|
'ext.flutter.brightnessOverride',
|
||||||
isolateId: isolate.id,
|
isolateId: isolate.id,
|
||||||
);
|
);
|
||||||
expect(response.json['value'], 'Brightness.light');
|
expect(response.json!['value'], 'Brightness.light');
|
||||||
}
|
}
|
||||||
timer.cancel();
|
timer.cancel();
|
||||||
|
|
||||||
// Verify that all duration events on the timeline are properly nested.
|
// Verify that all duration events on the timeline are properly nested.
|
||||||
final Response response = await vmService.callServiceExtension('getVMTimeline');
|
final Response response = await vmService.callServiceExtension('getVMTimeline');
|
||||||
final List<TimelineEvent> events = (response as Timeline).traceEvents;
|
final List<TimelineEvent>? events = (response as Timeline).traceEvents;
|
||||||
final Map<int, List<String>> threadDurationEventStack = <int, List<String>>{};
|
final Map<int, List<String>> threadDurationEventStack = <int, List<String>>{};
|
||||||
for (final TimelineEvent e in events) {
|
for (final TimelineEvent e in events!) {
|
||||||
final Map<String, dynamic> event = e.json;
|
final Map<String, dynamic> event = e.json!;
|
||||||
final String phase = event['ph'] as String;
|
final String phase = event['ph'] as String;
|
||||||
final int tid = event['tid'] as int;
|
final int tid = event['tid'] as int;
|
||||||
final String name = event['name'] as String;
|
final String name = event['name'] as String;
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
|
|
||||||
import '../src/common.dart';
|
import '../src/common.dart';
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
import 'package:process/process.dart';
|
import 'package:process/process.dart';
|
||||||
@ -12,7 +10,7 @@ import '../src/common.dart';
|
|||||||
import 'test_utils.dart';
|
import 'test_utils.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
Directory tempDir;
|
late Directory tempDir;
|
||||||
|
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
tempDir = createResolvedTempDirectorySync('unit_coverage_test.');
|
tempDir = createResolvedTempDirectorySync('unit_coverage_test.');
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
|
|
||||||
import '../src/common.dart';
|
import '../src/common.dart';
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:io' as io;
|
import 'dart:io' as io;
|
||||||
|
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
@ -69,8 +67,8 @@ void main() {
|
|||||||
}, skip: !io.Platform.isMacOS); // [intended] requires macos toolchain.
|
}, skip: !io.Platform.isMacOS); // [intended] requires macos toolchain.
|
||||||
|
|
||||||
group('observatory Bonjour service keys', () {
|
group('observatory Bonjour service keys', () {
|
||||||
Directory buildDirectory;
|
late Directory buildDirectory;
|
||||||
File infoPlist;
|
late File infoPlist;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
buildDirectory = globals.fs.systemTempDirectory.createTempSync('flutter_tools_xcode_backend_test.');
|
buildDirectory = globals.fs.systemTempDirectory.createTempSync('flutter_tools_xcode_backend_test.');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user