Unverified Commit e1538d1b authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] last pass on general.shard unit tests (#60263)

Last batch of test fixes for general shard.
parent 7518a146
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// 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.
import 'dart:async';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
...@@ -32,9 +33,10 @@ String _globalPackagesPath; ...@@ -32,9 +33,10 @@ String _globalPackagesPath;
Future<PackageConfig> loadPackageConfigWithLogging(File file, { Future<PackageConfig> loadPackageConfigWithLogging(File file, {
@required Logger logger, @required Logger logger,
bool throwOnError = true, bool throwOnError = true,
}) { }) async {
final FileSystem fileSystem = file.fileSystem; final FileSystem fileSystem = file.fileSystem;
return loadPackageConfigUri( bool didError = false;
final PackageConfig result = await loadPackageConfigUri(
file.absolute.uri, file.absolute.uri,
loader: (Uri uri) { loader: (Uri uri) {
final File configFile = fileSystem.file(uri); final File configFile = fileSystem.file(uri);
...@@ -56,7 +58,11 @@ Future<PackageConfig> loadPackageConfigWithLogging(File file, { ...@@ -56,7 +58,11 @@ Future<PackageConfig> loadPackageConfigWithLogging(File file, {
message += '\nDid you run this command from the same directory as your pubspec.yaml file?'; message += '\nDid you run this command from the same directory as your pubspec.yaml file?';
} }
logger.printError(message); logger.printError(message);
throwToolExit(file.path); didError = true;
} }
); );
if (didError) {
throwToolExit(null);
}
return result;
} }
...@@ -66,13 +66,11 @@ FileSystem get fs => ErrorHandlingFileSystem( ...@@ -66,13 +66,11 @@ FileSystem get fs => ErrorHandlingFileSystem(
platform: platform, platform: platform,
); );
final FileSystemUtils _defaultFileSystemUtils = FileSystemUtils( FileSystemUtils get fsUtils => context.get<FileSystemUtils>() ?? FileSystemUtils(
fileSystem: fs, fileSystem: fs,
platform: platform, platform: platform,
); );
FileSystemUtils get fsUtils => context.get<FileSystemUtils>() ?? _defaultFileSystemUtils;
const ProcessManager _kLocalProcessManager = LocalProcessManager(); const ProcessManager _kLocalProcessManager = LocalProcessManager();
/// The active process manager. /// The active process manager.
......
...@@ -26,8 +26,7 @@ import 'reporting/reporting.dart'; ...@@ -26,8 +26,7 @@ import 'reporting/reporting.dart';
import 'resident_runner.dart'; import 'resident_runner.dart';
import 'vmservice.dart'; import 'vmservice.dart';
ProjectFileInvalidator get projectFileInvalidator => context.get<ProjectFileInvalidator>() ?? _defaultInvalidator; ProjectFileInvalidator get projectFileInvalidator => context.get<ProjectFileInvalidator>() ?? ProjectFileInvalidator(
final ProjectFileInvalidator _defaultInvalidator = ProjectFileInvalidator(
fileSystem: globals.fs, fileSystem: globals.fs,
platform: globals.platform, platform: globals.platform,
logger: globals.logger, logger: globals.logger,
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter_tools/src/base/common.dart'; import 'package:flutter_tools/src/base/common.dart';
import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/commands/logs.dart'; import 'package:flutter_tools/src/commands/logs.dart';
import '../../src/common.dart'; import '../../src/common.dart';
...@@ -11,6 +12,14 @@ import '../../src/mocks.dart'; ...@@ -11,6 +12,14 @@ import '../../src/mocks.dart';
void main() { void main() {
group('logs', () { group('logs', () {
setUp(() {
Cache.disableLocking();
});
tearDown(() {
Cache.enableLocking();
});
testUsingContext('fail with a bad device id', () async { testUsingContext('fail with a bad device id', () async {
final LogsCommand command = LogsCommand(); final LogsCommand command = LogsCommand();
applyMocksToCommand(command); applyMocksToCommand(command);
......
...@@ -12,7 +12,6 @@ import 'package:flutter_tools/src/build_system/build_system.dart'; ...@@ -12,7 +12,6 @@ import 'package:flutter_tools/src/build_system/build_system.dart';
import 'package:flutter_tools/src/build_system/targets/assets.dart'; import 'package:flutter_tools/src/build_system/targets/assets.dart';
import 'package:flutter_tools/src/build_system/targets/common.dart'; import 'package:flutter_tools/src/build_system/targets/common.dart';
import 'package:flutter_tools/src/build_system/targets/macos.dart'; import 'package:flutter_tools/src/build_system/targets/macos.dart';
import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/convert.dart'; import 'package:flutter_tools/src/convert.dart';
import 'package:flutter_tools/src/globals.dart' as globals; import 'package:flutter_tools/src/globals.dart' as globals;
import 'package:flutter_tools/src/macos/xcode.dart'; import 'package:flutter_tools/src/macos/xcode.dart';
...@@ -26,26 +25,26 @@ import '../../../src/testbed.dart'; ...@@ -26,26 +25,26 @@ import '../../../src/testbed.dart';
const String _kInputPrefix = 'bin/cache/artifacts/engine/darwin-x64/FlutterMacOS.framework'; const String _kInputPrefix = 'bin/cache/artifacts/engine/darwin-x64/FlutterMacOS.framework';
const String _kOutputPrefix = 'FlutterMacOS.framework'; const String _kOutputPrefix = 'FlutterMacOS.framework';
final List<File> inputs = <File>[ final List<String> inputs = <String>[
globals.fs.file('$_kInputPrefix/FlutterMacOS'), '$_kInputPrefix/FlutterMacOS',
// Headers // Headers
globals.fs.file('$_kInputPrefix/Headers/FlutterDartProject.h'), '$_kInputPrefix/Headers/FlutterDartProject.h',
globals.fs.file('$_kInputPrefix/Headers/FlutterEngine.h'), '$_kInputPrefix/Headers/FlutterEngine.h',
globals.fs.file('$_kInputPrefix/Headers/FlutterViewController.h'), '$_kInputPrefix/Headers/FlutterViewController.h',
globals.fs.file('$_kInputPrefix/Headers/FlutterBinaryMessenger.h'), '$_kInputPrefix/Headers/FlutterBinaryMessenger.h',
globals.fs.file('$_kInputPrefix/Headers/FlutterChannels.h'), '$_kInputPrefix/Headers/FlutterChannels.h',
globals.fs.file('$_kInputPrefix/Headers/FlutterCodecs.h'), '$_kInputPrefix/Headers/FlutterCodecs.h',
globals.fs.file('$_kInputPrefix/Headers/FlutterMacros.h'), '$_kInputPrefix/Headers/FlutterMacros.h',
globals.fs.file('$_kInputPrefix/Headers/FlutterPluginMacOS.h'), '$_kInputPrefix/Headers/FlutterPluginMacOS.h',
globals.fs.file('$_kInputPrefix/Headers/FlutterPluginRegistrarMacOS.h'), '$_kInputPrefix/Headers/FlutterPluginRegistrarMacOS.h',
globals.fs.file('$_kInputPrefix/Headers/FlutterMacOS.h'), '$_kInputPrefix/Headers/FlutterMacOS.h',
// Modules // Modules
globals.fs.file('$_kInputPrefix/Modules/module.modulemap'), '$_kInputPrefix/Modules/module.modulemap',
// Resources // Resources
globals.fs.file('$_kInputPrefix/Resources/icudtl.dat'), '$_kInputPrefix/Resources/icudtl.dat',
globals.fs.file('$_kInputPrefix/Resources/Info.plist'), '$_kInputPrefix/Resources/Info.plist',
// Ignore Versions folder for now // Ignore Versions folder for now
globals.fs.file('packages/flutter_tools/lib/src/build_system/targets/macos.dart'), 'packages/flutter_tools/lib/src/build_system/targets/macos.dart',
]; ];
void main() { void main() {
...@@ -53,11 +52,6 @@ void main() { ...@@ -53,11 +52,6 @@ void main() {
Environment environment; Environment environment;
Platform platform; Platform platform;
setUpAll(() {
Cache.disableLocking();
Cache.flutterRoot = '';
});
setUp(() { setUp(() {
platform = FakePlatform(operatingSystem: 'macos', environment: <String, String>{}); platform = FakePlatform(operatingSystem: 'macos', environment: <String, String>{});
testbed = Testbed(setup: () { testbed = Testbed(setup: () {
...@@ -82,8 +76,8 @@ void main() { ...@@ -82,8 +76,8 @@ void main() {
}); });
test('Copies files to correct cache directory', () => testbed.run(() async { test('Copies files to correct cache directory', () => testbed.run(() async {
for (final File input in inputs) { for (final String input in inputs) {
input.createSync(recursive: true); globals.fs.file(input).createSync(recursive: true);
} }
// Create output directory so we can test that it is deleted. // Create output directory so we can test that it is deleted.
environment.outputDir.childDirectory(_kOutputPrefix) environment.outputDir.childDirectory(_kOutputPrefix)
...@@ -111,8 +105,8 @@ void main() { ...@@ -111,8 +105,8 @@ void main() {
await const DebugUnpackMacOS().build(environment); await const DebugUnpackMacOS().build(environment);
expect(globals.fs.directory(_kOutputPrefix).existsSync(), true); expect(globals.fs.directory(_kOutputPrefix).existsSync(), true);
for (final File file in inputs) { for (final String path in inputs) {
expect(globals.fs.file(file.path.replaceFirst(_kInputPrefix, _kOutputPrefix)), exists); expect(globals.fs.file(path.replaceFirst(_kInputPrefix, _kOutputPrefix)), exists);
} }
})); }));
......
...@@ -538,6 +538,7 @@ void main() { ...@@ -538,6 +538,7 @@ void main() {
expect(fakeProcessManager.hasRemainingExpectations, isFalse); expect(fakeProcessManager.hasRemainingExpectations, isFalse);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => macPlatform, Platform: () => macPlatform,
Artifacts: () => Artifacts.test(),
}); });
testWithoutContext('uses timeout', () async { testWithoutContext('uses timeout', () async {
...@@ -596,6 +597,7 @@ void main() { ...@@ -596,6 +597,7 @@ void main() {
expect(fakeProcessManager.hasRemainingExpectations, isFalse); expect(fakeProcessManager.hasRemainingExpectations, isFalse);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => macPlatform, Platform: () => macPlatform,
Artifacts: () => Artifacts.test(),
}); });
testUsingContext('handles unknown architectures', () async { testUsingContext('handles unknown architectures', () async {
...@@ -644,6 +646,7 @@ void main() { ...@@ -644,6 +646,7 @@ void main() {
expect(fakeProcessManager.hasRemainingExpectations, isFalse); expect(fakeProcessManager.hasRemainingExpectations, isFalse);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => macPlatform, Platform: () => macPlatform,
Artifacts: () => Artifacts.test(),
}); });
}); });
......
...@@ -7,7 +7,9 @@ import 'dart:convert'; ...@@ -7,7 +7,9 @@ import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:dwds/dwds.dart'; import 'package:dwds/dwds.dart';
import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/common.dart'; import 'package:flutter_tools/src/base/common.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';
import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/base/platform.dart';
...@@ -78,8 +80,6 @@ const List<VmServiceExpectation> kAttachExpectations = <VmServiceExpectation>[ ...@@ -78,8 +80,6 @@ const List<VmServiceExpectation> kAttachExpectations = <VmServiceExpectation>[
]; ];
void main() { void main() {
Testbed testbed;
ResidentWebRunner residentWebRunner;
MockDebugConnection mockDebugConnection; MockDebugConnection mockDebugConnection;
MockChromeDevice mockChromeDevice; MockChromeDevice mockChromeDevice;
MockAppConnection mockAppConnection; MockAppConnection mockAppConnection;
...@@ -94,8 +94,12 @@ void main() { ...@@ -94,8 +94,12 @@ void main() {
MockWebServerDevice mockWebServerDevice; MockWebServerDevice mockWebServerDevice;
MockDevice mockDevice; MockDevice mockDevice;
FakeVmServiceHost fakeVmServiceHost; FakeVmServiceHost fakeVmServiceHost;
FileSystem fileSystem;
ProcessManager processManager;
setUp(() { setUp(() {
fileSystem = MemoryFileSystem.test();
processManager = FakeProcessManager.any();
mockDebugConnection = MockDebugConnection(); mockDebugConnection = MockDebugConnection();
mockDevice = MockDevice(); mockDevice = MockDevice();
mockAppConnection = MockAppConnection(); mockAppConnection = MockAppConnection();
...@@ -113,30 +117,13 @@ void main() { ...@@ -113,30 +117,13 @@ void main() {
when(mockWebDevFS.connect(any)).thenAnswer((Invocation invocation) async { when(mockWebDevFS.connect(any)).thenAnswer((Invocation invocation) async {
return ConnectionResult(mockAppConnection, mockDebugConnection); return ConnectionResult(mockAppConnection, mockDebugConnection);
}); });
testbed = Testbed( fileSystem.file('.packages').writeAsStringSync('\n');
setup: () {
globals.fs.file('.packages')
..createSync(recursive: true)
..writeAsStringSync('\n');
residentWebRunner = DwdsWebRunnerFactory().createWebRunner(
mockFlutterDevice,
flutterProject: FlutterProject.current(),
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
ipv6: true,
stayResident: true,
urlTunneller: null,
) as ResidentWebRunner;
},
overrides: <Type, Generator>{
Pub: () => MockPub(),
}
);
}); });
void _setupMocks() { void _setupMocks() {
globals.fs.file('pubspec.yaml').createSync(); fileSystem.file('pubspec.yaml').createSync();
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true); fileSystem.file('lib/main.dart').createSync(recursive: true);
globals.fs.file(globals.fs.path.join('web', 'index.html')).createSync(recursive: true); fileSystem.file('web/index.html').createSync(recursive: true);
when(mockWebDevFS.update( when(mockWebDevFS.update(
mainUri: anyNamed('mainUri'), mainUri: anyNamed('mainUri'),
target: anyNamed('target'), target: anyNamed('target'),
...@@ -175,7 +162,8 @@ void main() { ...@@ -175,7 +162,8 @@ void main() {
when(mockWipConnection.debugger).thenReturn(mockWipDebugger); when(mockWipConnection.debugger).thenReturn(mockWipDebugger);
} }
test('runner with web server device does not support debugging without --start-paused', () => testbed.run(() { testUsingContext('runner with web server device does not support debugging without --start-paused', () {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
when(mockFlutterDevice.device).thenReturn(WebServerDevice( when(mockFlutterDevice.device).thenReturn(WebServerDevice(
logger: BufferLogger.test(), logger: BufferLogger.test(),
)); ));
...@@ -192,11 +180,20 @@ void main() { ...@@ -192,11 +180,20 @@ void main() {
expect(profileResidentWebRunner.debuggingEnabled, false); expect(profileResidentWebRunner.debuggingEnabled, false);
when(mockFlutterDevice.device).thenReturn(MockChromeDevice()); when(mockFlutterDevice.device).thenReturn(MockChromeDevice());
expect(residentWebRunner.debuggingEnabled, true); expect(residentWebRunner.debuggingEnabled, true);
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('runner with web server device supports debugging with --start-paused', () => testbed.run(() { testUsingContext('runner with web server device supports debugging with --start-paused', () {
fileSystem.file('.packages')
..createSync(recursive: true)
..writeAsStringSync('\n');
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]); fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
_setupMocks(); _setupMocks();
when(mockFlutterDevice.device).thenReturn(WebServerDevice( when(mockFlutterDevice.device).thenReturn(WebServerDevice(
...@@ -213,9 +210,24 @@ void main() { ...@@ -213,9 +210,24 @@ void main() {
expect(profileResidentWebRunner.uri, mockWebDevFS.baseUri); expect(profileResidentWebRunner.uri, mockWebDevFS.baseUri);
expect(profileResidentWebRunner.debuggingEnabled, true); expect(profileResidentWebRunner.debuggingEnabled, true);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
test('profile does not supportsServiceProtocol', () => testbed.run(() { ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
testUsingContext('profile does not supportsServiceProtocol', () {
fileSystem.file('.packages')
..createSync(recursive: true)
..writeAsStringSync('\n');
final ResidentRunner residentWebRunner = DwdsWebRunnerFactory().createWebRunner(
mockFlutterDevice,
flutterProject: FlutterProject.current(),
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
ipv6: true,
stayResident: true,
urlTunneller: null,
) as ResidentWebRunner;
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]); fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
when(mockFlutterDevice.device).thenReturn(mockChromeDevice); when(mockFlutterDevice.device).thenReturn(mockChromeDevice);
final ResidentRunner profileResidentWebRunner = DwdsWebRunnerFactory().createWebRunner( final ResidentRunner profileResidentWebRunner = DwdsWebRunnerFactory().createWebRunner(
...@@ -229,20 +241,45 @@ void main() { ...@@ -229,20 +241,45 @@ void main() {
expect(profileResidentWebRunner.supportsServiceProtocol, false); expect(profileResidentWebRunner.supportsServiceProtocol, false);
expect(residentWebRunner.supportsServiceProtocol, true); expect(residentWebRunner.supportsServiceProtocol, true);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Exits on run if target file does not exist', () => testbed.run(() async { testUsingContext('Exits on run if target file does not exist', () async {
fileSystem.file('.packages')
..createSync(recursive: true)
..writeAsStringSync('\n');
final ResidentRunner residentWebRunner = DwdsWebRunnerFactory().createWebRunner(
mockFlutterDevice,
flutterProject: FlutterProject.current(),
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
ipv6: true,
stayResident: true,
urlTunneller: null,
) as ResidentWebRunner;
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]); fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
globals.fs.file('pubspec.yaml').createSync(); fileSystem.file('pubspec.yaml').createSync();
globals.fs.file(globals.fs.path.join('web', 'index.html')) fileSystem.file(fileSystem.path.join('web', 'index.html'))
.createSync(recursive: true); .createSync(recursive: true);
expect(await residentWebRunner.run(), 1); expect(await residentWebRunner.run(), 1);
final String absoluteMain = globals.fs.path.absolute(globals.fs.path.join('lib', 'main.dart')); final String absoluteMain = fileSystem.path.absolute(fileSystem.path.join('lib', 'main.dart'));
expect(testLogger.errorText, contains('Tried to run $absoluteMain, but that file does not exist.')); expect(testLogger.errorText, contains('Tried to run $absoluteMain, but that file does not exist.'));
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Can successfully run and connect to vmservice', () => testbed.run(() async { testUsingContext('Can successfully run and connect to vmservice', () async {
fileSystem.file('.packages')
..createSync(recursive: true)
..writeAsStringSync('\n');
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList()); fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList());
_setupMocks(); _setupMocks();
final DelegateLogger delegateLogger = globals.logger as DelegateLogger; final DelegateLogger delegateLogger = globals.logger as DelegateLogger;
...@@ -259,16 +296,21 @@ void main() { ...@@ -259,16 +296,21 @@ void main() {
verify(status.stop()).called(1); verify(status.stop()).called(1);
verify(pub.get( verify(pub.get(
context: PubContext.pubGet, context: PubContext.pubGet,
directory: globals.fs.path.join('packages', 'flutter_tools') directory: anyNamed('directory'),
)).called(1); )).called(1);
expect(bufferLogger.statusText, contains('Debug service listening on ws://127.0.0.1/abcd/')); expect(bufferLogger.statusText, contains('Debug service listening on ws://127.0.0.1/abcd/'));
expect(debugConnectionInfo.wsUri.toString(), 'ws://127.0.0.1/abcd/'); expect(debugConnectionInfo.wsUri.toString(), 'ws://127.0.0.1/abcd/');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Logger: () => DelegateLogger(BufferLogger.test()), Logger: () => DelegateLogger(BufferLogger.test()),
})); FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('WebRunner copies compiled app.dill to cache during startup', () => testbed.run(() async { testUsingContext('WebRunner copies compiled app.dill to cache during startup', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList()); fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList());
_setupMocks(); _setupMocks();
...@@ -279,32 +321,42 @@ void main() { ...@@ -279,32 +321,42 @@ void main() {
)); ));
await connectionInfoCompleter.future; await connectionInfoCompleter.future;
expect(await globals.fs.file(globals.fs.path.join('build', 'cache.dill')).readAsString(), 'ABC'); expect(await fileSystem.file(fileSystem.path.join('build', 'cache.dill')).readAsString(), 'ABC');
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Can successfully run without an index.html including status warning', () => testbed.run(() async { testUsingContext('Can successfully run without an index.html including status warning', () async {
fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList()); fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList());
_setupMocks(); _setupMocks();
globals.fs.file(globals.fs.path.join('web', 'index.html')) fileSystem.file(fileSystem.path.join('web', 'index.html'))
.deleteSync(); .deleteSync();
residentWebRunner = DwdsWebRunnerFactory().createWebRunner( final ResidentWebRunner residentWebRunner = DwdsWebRunnerFactory().createWebRunner(
mockFlutterDevice, mockFlutterDevice,
flutterProject: FlutterProject.current(), flutterProject: FlutterProject.current(),
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug), debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
ipv6: true, ipv6: true,
stayResident: false, stayResident: false,
urlTunneller: null, urlTunneller: null,
) as ResidentWebRunner; ) as ResidentWebRunner;
expect(await residentWebRunner.run(), 0); expect(await residentWebRunner.run(), 0);
expect(testLogger.statusText, expect(testLogger.statusText,
contains('This application is not configured to build on the web')); contains('This application is not configured to build on the web'));
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Can successfully run and disconnect with --no-resident', () => testbed.run(() async { testUsingContext('Can successfully run and disconnect with --no-resident', () async {
fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList()); fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList());
_setupMocks(); _setupMocks();
residentWebRunner = DwdsWebRunnerFactory().createWebRunner( final ResidentRunner residentWebRunner = DwdsWebRunnerFactory().createWebRunner(
mockFlutterDevice, mockFlutterDevice,
flutterProject: FlutterProject.current(), flutterProject: FlutterProject.current(),
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug), debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
...@@ -314,9 +366,15 @@ void main() { ...@@ -314,9 +366,15 @@ void main() {
) as ResidentWebRunner; ) as ResidentWebRunner;
expect(await residentWebRunner.run(), 0); expect(await residentWebRunner.run(), 0);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Listens to stdout and stderr streams before running main', () => testbed.run(() async { testUsingContext('Listens to stdout and stderr streams before running main', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[ fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
...kAttachLogExpectations, ...kAttachLogExpectations,
FakeVmServiceStreamResponse( FakeVmServiceStreamResponse(
...@@ -346,9 +404,15 @@ void main() { ...@@ -346,9 +404,15 @@ void main() {
expect(testLogger.statusText, contains('THIS MESSAGE IS IMPORTANT')); expect(testLogger.statusText, contains('THIS MESSAGE IS IMPORTANT'));
expect(testLogger.statusText, contains('SO IS THIS')); expect(testLogger.statusText, contains('SO IS THIS'));
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Listens to extension events with structured errors', () => testbed.run(() async { testUsingContext('Listens to extension events with structured errors', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
final Map<String, String> extensionData = <String, String>{ final Map<String, String> extensionData = <String, String>{
'test': 'data', 'test': 'data',
'renderedErrorText': 'error text', 'renderedErrorText': 'error text',
...@@ -408,11 +472,15 @@ void main() { ...@@ -408,11 +472,15 @@ void main() {
expect(testLogger.statusText, contains('\nerror text')); expect(testLogger.statusText, contains('\nerror text'));
expect(testLogger.statusText, isNot(contains('other stuff'))); expect(testLogger.statusText, isNot(contains('other stuff')));
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Does not run main with --start-paused', () => testbed.run(() async { testUsingContext('Does not run main with --start-paused', () async {
fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList()); final ResidentRunner residentWebRunner = DwdsWebRunnerFactory().createWebRunner(
residentWebRunner = DwdsWebRunnerFactory().createWebRunner(
mockFlutterDevice, mockFlutterDevice,
flutterProject: FlutterProject.current(), flutterProject: FlutterProject.current(),
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug, startPaused: true), debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug, startPaused: true),
...@@ -420,6 +488,7 @@ void main() { ...@@ -420,6 +488,7 @@ void main() {
stayResident: true, stayResident: true,
urlTunneller: null, urlTunneller: null,
) as ResidentWebRunner; ) as ResidentWebRunner;
fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList());
_setupMocks(); _setupMocks();
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>(); final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
...@@ -429,9 +498,15 @@ void main() { ...@@ -429,9 +498,15 @@ void main() {
await connectionInfoCompleter.future; await connectionInfoCompleter.future;
verifyNever(mockAppConnection.runMain()); verifyNever(mockAppConnection.runMain());
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Can hot reload after attaching', () => testbed.run(() async { testUsingContext('Can hot reload after attaching', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[ fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
...kAttachExpectations, ...kAttachExpectations,
const FakeVmServiceRequest( const FakeVmServiceRequest(
...@@ -451,7 +526,7 @@ void main() { ...@@ -451,7 +526,7 @@ void main() {
return mockChrome; return mockChrome;
}); });
when(mockFlutterDevice.device).thenReturn(GoogleChromeDevice( when(mockFlutterDevice.device).thenReturn(GoogleChromeDevice(
fileSystem: globals.fs, fileSystem: fileSystem,
chromiumLauncher: chromiumLauncher, chromiumLauncher: chromiumLauncher,
logger: globals.logger, logger: globals.logger,
platform: FakePlatform(operatingSystem: 'linux'), platform: FakePlatform(operatingSystem: 'linux'),
...@@ -505,9 +580,14 @@ void main() { ...@@ -505,9 +580,14 @@ void main() {
verify(globals.flutterUsage.sendTiming('hot', 'web-incremental-restart', any)).called(1); verify(globals.flutterUsage.sendTiming('hot', 'web-incremental-restart', any)).called(1);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Usage: () => MockFlutterUsage(), Usage: () => MockFlutterUsage(),
})); FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Can hot restart after attaching', () => testbed.run(() async { testUsingContext('Can hot restart after attaching', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[ fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
...kAttachExpectations, ...kAttachExpectations,
const FakeVmServiceRequest( const FakeVmServiceRequest(
...@@ -528,7 +608,7 @@ void main() { ...@@ -528,7 +608,7 @@ void main() {
}); });
when(chromiumLauncher.canFindExecutable()).thenReturn(true); when(chromiumLauncher.canFindExecutable()).thenReturn(true);
when(mockFlutterDevice.device).thenReturn(GoogleChromeDevice( when(mockFlutterDevice.device).thenReturn(GoogleChromeDevice(
fileSystem: globals.fs, fileSystem: fileSystem,
chromiumLauncher: chromiumLauncher, chromiumLauncher: chromiumLauncher,
logger: globals.logger, logger: globals.logger,
platform: FakePlatform(operatingSystem: 'linux'), platform: FakePlatform(operatingSystem: 'linux'),
...@@ -564,7 +644,7 @@ void main() { ...@@ -564,7 +644,7 @@ void main() {
// Ensure that generated entrypoint is generated correctly. // Ensure that generated entrypoint is generated correctly.
expect(entrypointFileUri, isNotNull); expect(entrypointFileUri, isNotNull);
final String entrypointContents = globals.fs.file(entrypointFileUri).readAsStringSync(); final String entrypointContents = fileSystem.file(entrypointFileUri).readAsStringSync();
expect(entrypointContents, contains('// Flutter web bootstrap script')); expect(entrypointContents, contains('// Flutter web bootstrap script'));
expect(entrypointContents, contains("import 'dart:ui' as ui;")); expect(entrypointContents, contains("import 'dart:ui' as ui;"));
expect(entrypointContents, contains('await ui.webOnlyInitializePlatform();')); expect(entrypointContents, contains('await ui.webOnlyInitializePlatform();'));
...@@ -585,9 +665,14 @@ void main() { ...@@ -585,9 +665,14 @@ void main() {
verify(globals.flutterUsage.sendTiming('hot', 'web-incremental-restart', any)).called(1); verify(globals.flutterUsage.sendTiming('hot', 'web-incremental-restart', any)).called(1);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Usage: () => MockFlutterUsage(), Usage: () => MockFlutterUsage(),
})); FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Can hot restart after attaching with web-server device', () => testbed.run(() async { testUsingContext('Can hot restart after attaching with web-server device', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests :kAttachExpectations); fakeVmServiceHost = FakeVmServiceHost(requests :kAttachExpectations);
_setupMocks(); _setupMocks();
when(mockFlutterDevice.device).thenReturn(mockWebServerDevice); when(mockFlutterDevice.device).thenReturn(mockWebServerDevice);
...@@ -623,15 +708,26 @@ void main() { ...@@ -623,15 +708,26 @@ void main() {
verifyNever(globals.flutterUsage.sendTiming('hot', 'web-incremental-restart', any)); verifyNever(globals.flutterUsage.sendTiming('hot', 'web-incremental-restart', any));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Usage: () => MockFlutterUsage(), Usage: () => MockFlutterUsage(),
})); FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('web resident runner is debuggable', () => testbed.run(() { testUsingContext('web resident runner is debuggable', () {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList()); fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList());
expect(residentWebRunner.debuggingEnabled, true); expect(residentWebRunner.debuggingEnabled, true);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('web resident runner can toggle CanvasKit', () => testbed.run(() async { testUsingContext('web resident runner can toggle CanvasKit', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]); fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
final WebAssetServer webAssetServer = WebAssetServer(null, null, null, null, null); final WebAssetServer webAssetServer = WebAssetServer(null, null, null, null, null);
when(mockWebDevFS.webAssetServer).thenReturn(webAssetServer); when(mockWebDevFS.webAssetServer).thenReturn(webAssetServer);
...@@ -643,9 +739,15 @@ void main() { ...@@ -643,9 +739,15 @@ void main() {
expect(webAssetServer.canvasKitRendering, true); expect(webAssetServer.canvasKitRendering, true);
expect(toggleResult, true); expect(toggleResult, true);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Exits when initial compile fails', () => testbed.run(() async { testUsingContext('Exits when initial compile fails', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]); fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
_setupMocks(); _setupMocks();
when(mockWebDevFS.update( when(mockWebDevFS.update(
...@@ -674,9 +776,14 @@ void main() { ...@@ -674,9 +776,14 @@ void main() {
verifyNever(globals.flutterUsage.sendTiming('hot', 'web-restart', any)); verifyNever(globals.flutterUsage.sendTiming('hot', 'web-restart', any));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Usage: () => MockFlutterUsage(), Usage: () => MockFlutterUsage(),
})); FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Faithfully displays stdout messages with leading/trailing spaces', () => testbed.run(() async { testUsingContext('Faithfully displays stdout messages with leading/trailing spaces', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[ fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
...kAttachLogExpectations, ...kAttachLogExpectations,
FakeVmServiceStreamResponse( FakeVmServiceStreamResponse(
...@@ -701,9 +808,15 @@ void main() { ...@@ -701,9 +808,15 @@ void main() {
expect(testLogger.statusText, expect(testLogger.statusText,
contains(' This is a message with 4 leading and trailing spaces ')); contains(' This is a message with 4 leading and trailing spaces '));
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Fails on compilation errors in hot restart', () => testbed.run(() async { testUsingContext('Fails on compilation errors in hot restart', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList()); fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList());
_setupMocks(); _setupMocks();
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>(); final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
...@@ -736,9 +849,14 @@ void main() { ...@@ -736,9 +849,14 @@ void main() {
verifyNever(globals.flutterUsage.sendTiming('hot', 'web-restart', any)); verifyNever(globals.flutterUsage.sendTiming('hot', 'web-restart', any));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Usage: () => MockFlutterUsage(), Usage: () => MockFlutterUsage(),
})); FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Fails non-fatally on vmservice response error for hot restart', () => testbed.run(() async { testUsingContext('Fails non-fatally on vmservice response error for hot restart', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[ fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
...kAttachExpectations, ...kAttachExpectations,
const FakeVmServiceRequest( const FakeVmServiceRequest(
...@@ -758,9 +876,15 @@ void main() { ...@@ -758,9 +876,15 @@ void main() {
final OperationResult result = await residentWebRunner.restart(fullRestart: false); final OperationResult result = await residentWebRunner.restart(fullRestart: false);
expect(result.code, 0); expect(result.code, 0);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Fails fatally on Vm Service error response', () => testbed.run(() async { testUsingContext('Fails fatally on Vm Service error response', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[ fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
...kAttachExpectations, ...kAttachExpectations,
const FakeVmServiceRequest( const FakeVmServiceRequest(
...@@ -780,18 +904,30 @@ void main() { ...@@ -780,18 +904,30 @@ void main() {
expect(result.code, 1); expect(result.code, 1);
expect(result.message, expect(result.message,
contains(RPCErrorCodes.kInternalError.toString())); contains(RPCErrorCodes.kInternalError.toString()));
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('printHelp without details has web warning', () => testbed.run(() async { testUsingContext('printHelp without details has web warning', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]); fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
residentWebRunner.printHelp(details: false); residentWebRunner.printHelp(details: false);
expect(testLogger.statusText, contains('Warning')); expect(testLogger.statusText, contains('Warning'));
expect(testLogger.statusText, contains('https://flutter.dev/web')); expect(testLogger.statusText, contains('https://flutter.dev/web'));
expect(testLogger.statusText, isNot(contains('https://flutter.dev/web.'))); expect(testLogger.statusText, isNot(contains('https://flutter.dev/web.')));
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('debugDumpApp', () => testbed.run(() async { testUsingContext('debugDumpApp', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[ fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
...kAttachExpectations, ...kAttachExpectations,
const FakeVmServiceRequest( const FakeVmServiceRequest(
...@@ -810,9 +946,15 @@ void main() { ...@@ -810,9 +946,15 @@ void main() {
await residentWebRunner.debugDumpApp(); await residentWebRunner.debugDumpApp();
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('debugDumpLayerTree', () => testbed.run(() async { testUsingContext('debugDumpLayerTree', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[ fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
...kAttachExpectations, ...kAttachExpectations,
const FakeVmServiceRequest( const FakeVmServiceRequest(
...@@ -831,9 +973,15 @@ void main() { ...@@ -831,9 +973,15 @@ void main() {
await residentWebRunner.debugDumpLayerTree(); await residentWebRunner.debugDumpLayerTree();
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('debugDumpRenderTree', () => testbed.run(() async { testUsingContext('debugDumpRenderTree', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[ fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
...kAttachExpectations, ...kAttachExpectations,
const FakeVmServiceRequest( const FakeVmServiceRequest(
...@@ -852,9 +1000,15 @@ void main() { ...@@ -852,9 +1000,15 @@ void main() {
await residentWebRunner.debugDumpRenderTree(); await residentWebRunner.debugDumpRenderTree();
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('debugDumpSemanticsTreeInTraversalOrder', () => testbed.run(() async { testUsingContext('debugDumpSemanticsTreeInTraversalOrder', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[ fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
...kAttachExpectations, ...kAttachExpectations,
const FakeVmServiceRequest( const FakeVmServiceRequest(
...@@ -873,9 +1027,15 @@ void main() { ...@@ -873,9 +1027,15 @@ void main() {
await residentWebRunner.debugDumpSemanticsTreeInTraversalOrder(); await residentWebRunner.debugDumpSemanticsTreeInTraversalOrder();
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('debugDumpSemanticsTreeInInverseHitTestOrder', () => testbed.run(() async { testUsingContext('debugDumpSemanticsTreeInInverseHitTestOrder', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[ fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
...kAttachExpectations, ...kAttachExpectations,
const FakeVmServiceRequest( const FakeVmServiceRequest(
...@@ -895,9 +1055,15 @@ void main() { ...@@ -895,9 +1055,15 @@ void main() {
await residentWebRunner.debugDumpSemanticsTreeInInverseHitTestOrder(); await residentWebRunner.debugDumpSemanticsTreeInInverseHitTestOrder();
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('debugToggleDebugPaintSizeEnabled', () => testbed.run(() async { testUsingContext('debugToggleDebugPaintSizeEnabled', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[ fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
...kAttachExpectations, ...kAttachExpectations,
const FakeVmServiceRequest( const FakeVmServiceRequest(
...@@ -930,10 +1096,15 @@ void main() { ...@@ -930,10 +1096,15 @@ void main() {
await residentWebRunner.debugToggleDebugPaintSizeEnabled(); await residentWebRunner.debugToggleDebugPaintSizeEnabled();
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('debugTogglePerformanceOverlayOverride', () => testbed.run(() async { testUsingContext('debugTogglePerformanceOverlayOverride', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[ fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
...kAttachExpectations, ...kAttachExpectations,
const FakeVmServiceRequest( const FakeVmServiceRequest(
...@@ -966,9 +1137,15 @@ void main() { ...@@ -966,9 +1137,15 @@ void main() {
await residentWebRunner.debugTogglePerformanceOverlayOverride(); await residentWebRunner.debugTogglePerformanceOverlayOverride();
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('debugToggleWidgetInspector', () => testbed.run(() async { testUsingContext('debugToggleWidgetInspector', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[ fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
...kAttachExpectations, ...kAttachExpectations,
const FakeVmServiceRequest( const FakeVmServiceRequest(
...@@ -1001,9 +1178,15 @@ void main() { ...@@ -1001,9 +1178,15 @@ void main() {
await residentWebRunner.debugToggleWidgetInspector(); await residentWebRunner.debugToggleWidgetInspector();
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('debugToggleProfileWidgetBuilds', () => testbed.run(() async { testUsingContext('debugToggleProfileWidgetBuilds', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[ fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
...kAttachExpectations, ...kAttachExpectations,
const FakeVmServiceRequest( const FakeVmServiceRequest(
...@@ -1036,9 +1219,15 @@ void main() { ...@@ -1036,9 +1219,15 @@ void main() {
await residentWebRunner.debugToggleProfileWidgetBuilds(); await residentWebRunner.debugToggleProfileWidgetBuilds();
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('debugTogglePlatform', () => testbed.run(() async { testUsingContext('debugTogglePlatform', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[ fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
...kAttachExpectations, ...kAttachExpectations,
const FakeVmServiceRequest( const FakeVmServiceRequest(
...@@ -1073,9 +1262,15 @@ void main() { ...@@ -1073,9 +1262,15 @@ void main() {
expect(testLogger.statusText, expect(testLogger.statusText,
contains('Switched operating system to fuchsia')); contains('Switched operating system to fuchsia'));
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('debugToggleBrightness', () => testbed.run(() async { testUsingContext('debugToggleBrightness', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[ fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
...kAttachExpectations, ...kAttachExpectations,
const FakeVmServiceRequest( const FakeVmServiceRequest(
...@@ -1110,9 +1305,15 @@ void main() { ...@@ -1110,9 +1305,15 @@ void main() {
expect(testLogger.statusText, expect(testLogger.statusText,
contains('Changed brightness to Brightness.dark.')); contains('Changed brightness to Brightness.dark.'));
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('cleanup of resources is safe to call multiple times', () => testbed.run(() async { testUsingContext('cleanup of resources is safe to call multiple times', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[ fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
...kAttachExpectations, ...kAttachExpectations,
]); ]);
...@@ -1136,9 +1337,15 @@ void main() { ...@@ -1136,9 +1337,15 @@ void main() {
verifyNever(mockDebugConnection.close()); verifyNever(mockDebugConnection.close());
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('cleans up Chrome if tab is closed', () => testbed.run(() async { testUsingContext('cleans up Chrome if tab is closed', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[ fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
...kAttachExpectations, ...kAttachExpectations,
]); ]);
...@@ -1156,9 +1363,15 @@ void main() { ...@@ -1156,9 +1363,15 @@ void main() {
await result; await result;
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Prints target and device name on run', () => testbed.run(() async { testUsingContext('Prints target and device name on run', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[ fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
...kAttachExpectations, ...kAttachExpectations,
]); ]);
...@@ -1171,13 +1384,18 @@ void main() { ...@@ -1171,13 +1384,18 @@ void main() {
await connectionInfoCompleter.future; await connectionInfoCompleter.future;
expect(testLogger.statusText, contains( expect(testLogger.statusText, contains(
'Launching ${globals.fs.path.join('lib', 'main.dart')} on ' 'Launching ${fileSystem.path.join('lib', 'main.dart')} on '
'Chromez in debug mode', 'Chromez in debug mode',
)); ));
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Sends launched app.webLaunchUrl event for Chrome device', () => testbed.run(() async { testUsingContext('Sends launched app.webLaunchUrl event for Chrome device', () async {
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[ fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
...kAttachLogExpectations, ...kAttachLogExpectations,
...kAttachIsolateExpectations, ...kAttachIsolateExpectations,
...@@ -1192,7 +1410,7 @@ void main() { ...@@ -1192,7 +1410,7 @@ void main() {
return mockChrome; return mockChrome;
}); });
when(mockFlutterDevice.device).thenReturn(GoogleChromeDevice( when(mockFlutterDevice.device).thenReturn(GoogleChromeDevice(
fileSystem: globals.fs, fileSystem: fileSystem,
chromiumLauncher: chromiumLauncher, chromiumLauncher: chromiumLauncher,
logger: globals.logger, logger: globals.logger,
platform: FakePlatform(operatingSystem: 'linux'), platform: FakePlatform(operatingSystem: 'linux'),
...@@ -1246,9 +1464,13 @@ void main() { ...@@ -1246,9 +1464,13 @@ void main() {
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Logger: () => DelegateLogger(BufferLogger.test()), Logger: () => DelegateLogger(BufferLogger.test()),
})); FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Sends unlaunched app.webLaunchUrl event for Web Server device', () => testbed.run(() async { testUsingContext('Sends unlaunched app.webLaunchUrl event for Web Server device', () async {
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]); fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
_setupMocks(); _setupMocks();
when(mockFlutterDevice.device).thenReturn(WebServerDevice( when(mockFlutterDevice.device).thenReturn(WebServerDevice(
...@@ -1288,10 +1510,15 @@ void main() { ...@@ -1288,10 +1510,15 @@ void main() {
))); )));
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Logger: () => DelegateLogger(BufferLogger.test()) Logger: () => DelegateLogger(BufferLogger.test()),
})); FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Successfully turns WebSocketException into ToolExit', () => testbed.run(() async { testUsingContext('Successfully turns WebSocketException into ToolExit', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]); fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
_setupMocks(); _setupMocks();
...@@ -1300,9 +1527,15 @@ void main() { ...@@ -1300,9 +1527,15 @@ void main() {
await expectLater(() => residentWebRunner.run(), throwsToolExit()); await expectLater(() => residentWebRunner.run(), throwsToolExit());
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Successfully turns AppConnectionException into ToolExit', () => testbed.run(() async { testUsingContext('Successfully turns AppConnectionException into ToolExit', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]); fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
_setupMocks(); _setupMocks();
...@@ -1311,9 +1544,15 @@ void main() { ...@@ -1311,9 +1544,15 @@ void main() {
await expectLater(() => residentWebRunner.run(), throwsToolExit()); await expectLater(() => residentWebRunner.run(), throwsToolExit());
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Successfully turns ChromeDebugError into ToolExit', () => testbed.run(() async { testUsingContext('Successfully turns ChromeDebugError into ToolExit', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]); fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
_setupMocks(); _setupMocks();
...@@ -1322,18 +1561,30 @@ void main() { ...@@ -1322,18 +1561,30 @@ void main() {
await expectLater(() => residentWebRunner.run(), throwsToolExit()); await expectLater(() => residentWebRunner.run(), throwsToolExit());
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Rethrows unknown Exception type from dwds', () => testbed.run(() async { testUsingContext('Rethrows unknown Exception type from dwds', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]); fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
_setupMocks(); _setupMocks();
when(mockWebDevFS.connect(any)).thenThrow(Exception()); when(mockWebDevFS.connect(any)).thenThrow(Exception());
await expectLater(() => residentWebRunner.run(), throwsException); await expectLater(() => residentWebRunner.run(), throwsException);
expect(fakeVmServiceHost.hasRemainingExpectations, false); expect(fakeVmServiceHost.hasRemainingExpectations, false);
})); }, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
test('Rethrows unknown Error type from dwds tooling', () => testbed.run(() async { testUsingContext('Rethrows unknown Error type from dwds tooling', () async {
final ResidentRunner residentWebRunner = setUpResidentRunner(mockFlutterDevice);
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]); fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
_setupMocks(); _setupMocks();
final DelegateLogger delegateLogger = globals.logger as DelegateLogger; final DelegateLogger delegateLogger = globals.logger as DelegateLogger;
...@@ -1352,8 +1603,23 @@ void main() { ...@@ -1352,8 +1603,23 @@ void main() {
platform: const LocalPlatform(), platform: const LocalPlatform(),
), ),
outputPreferences: OutputPreferences.test(), outputPreferences: OutputPreferences.test(),
)) )),
})); FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Pub: () => MockPub(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
});
}
ResidentRunner setUpResidentRunner(FlutterDevice flutterDevice) {
return DwdsWebRunnerFactory().createWebRunner(
flutterDevice,
flutterProject: FlutterProject.current(),
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
ipv6: true,
stayResident: true,
urlTunneller: null,
) as ResidentWebRunner;
} }
class MockChromeLauncher extends Mock implements ChromiumLauncher {} class MockChromeLauncher extends Mock implements ChromiumLauncher {}
......
...@@ -31,6 +31,7 @@ void main() { ...@@ -31,6 +31,7 @@ void main() {
List<int> mockTimes; List<int> mockTimes;
setUp(() { setUp(() {
Cache.disableLocking();
cache = MockitoCache(); cache = MockitoCache();
usage = MockitoUsage(); usage = MockitoUsage();
clock = MockClock(); clock = MockClock();
...@@ -43,6 +44,10 @@ void main() { ...@@ -43,6 +44,10 @@ void main() {
when(mockProcessInfo.maxRss).thenReturn(10); when(mockProcessInfo.maxRss).thenReturn(10);
}); });
tearDown(() {
Cache.enableLocking();
});
testUsingContext('help text contains global options', () { testUsingContext('help text contains global options', () {
final FakeDeprecatedCommand fake = FakeDeprecatedCommand(); final FakeDeprecatedCommand fake = FakeDeprecatedCommand();
createTestCommandRunner(fake); createTestCommandRunner(fake);
......
...@@ -40,7 +40,6 @@ void main() { ...@@ -40,7 +40,6 @@ void main() {
testbed = Testbed(overrides: <Type, Generator>{ testbed = Testbed(overrides: <Type, Generator>{
ProcessManager: () { ProcessManager: () {
print('in get process manager');
return mockProcessManager; return mockProcessManager;
} }
}); });
......
...@@ -13,8 +13,8 @@ import 'package:flutter_tools/src/base/terminal.dart'; ...@@ -13,8 +13,8 @@ import 'package:flutter_tools/src/base/terminal.dart';
import 'package:flutter_tools/src/ios/plist_parser.dart'; import 'package:flutter_tools/src/ios/plist_parser.dart';
import 'package:process/process.dart'; import 'package:process/process.dart';
import '../../src/common.dart'; import '../src/common.dart';
import '../../src/context.dart'; import '../src/context.dart';
const String base64PlistXml = const String base64PlistXml =
'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHBsaXN0I' 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHBsaXN0I'
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'dart:io' as io;
import 'package:flutter_tools/src/android/android_workflow.dart'; import 'package:flutter_tools/src/android/android_workflow.dart';
import 'package:flutter_tools/src/base/bot_detector.dart'; import 'package:flutter_tools/src/base/bot_detector.dart';
...@@ -158,8 +157,8 @@ void testUsingContext( ...@@ -158,8 +157,8 @@ void testUsingContext(
rethrow; rethrow;
} }
}, onError: (Object error, StackTrace stackTrace) { // ignore: deprecated_member_use }, onError: (Object error, StackTrace stackTrace) { // ignore: deprecated_member_use
io.stdout.writeln(error); print(error);
io.stdout.writeln(stackTrace); print(stackTrace);
_printBufferedErrors(context); _printBufferedErrors(context);
throw error; throw error;
}); });
......
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