|
|
|
@ -42,8 +42,7 @@ import '../src/common.dart';
|
|
|
|
|
import '../src/context.dart';
|
|
|
|
|
import '../src/fake_vm_services.dart';
|
|
|
|
|
|
|
|
|
|
const List<VmServiceExpectation> kAttachLogExpectations =
|
|
|
|
|
<VmServiceExpectation>[
|
|
|
|
|
const List<VmServiceExpectation> kAttachLogExpectations = <VmServiceExpectation>[
|
|
|
|
|
FakeVmServiceRequest(
|
|
|
|
|
method: 'streamListen',
|
|
|
|
|
args: <String, Object>{
|
|
|
|
@ -58,23 +57,34 @@ const List<VmServiceExpectation> kAttachLogExpectations =
|
|
|
|
|
),
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const List<VmServiceExpectation> kAttachIsolateExpectations =
|
|
|
|
|
<VmServiceExpectation>[
|
|
|
|
|
FakeVmServiceRequest(method: 'streamListen', args: <String, Object>{
|
|
|
|
|
const List<VmServiceExpectation> kAttachIsolateExpectations = <VmServiceExpectation>[
|
|
|
|
|
FakeVmServiceRequest(
|
|
|
|
|
method: 'streamListen',
|
|
|
|
|
args: <String, Object>{
|
|
|
|
|
'streamId': 'Isolate',
|
|
|
|
|
}),
|
|
|
|
|
FakeVmServiceRequest(method: 'registerService', args: <String, Object>{
|
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
FakeVmServiceRequest(
|
|
|
|
|
method: 'registerService',
|
|
|
|
|
args: <String, Object>{
|
|
|
|
|
'service': 'reloadSources',
|
|
|
|
|
'alias': 'Flutter Tools',
|
|
|
|
|
}),
|
|
|
|
|
FakeVmServiceRequest(method: 'registerService', args: <String, Object>{
|
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
FakeVmServiceRequest(
|
|
|
|
|
method: 'registerService',
|
|
|
|
|
args: <String, Object>{
|
|
|
|
|
'service': 'flutterVersion',
|
|
|
|
|
'alias': 'Flutter Tools',
|
|
|
|
|
}),
|
|
|
|
|
FakeVmServiceRequest(method: 'registerService', args: <String, Object>{
|
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
FakeVmServiceRequest(
|
|
|
|
|
method: 'registerService',
|
|
|
|
|
args: <String, Object>{
|
|
|
|
|
'service': 'flutterMemoryInfo',
|
|
|
|
|
'alias': 'Flutter Tools',
|
|
|
|
|
}),
|
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
FakeVmServiceRequest(
|
|
|
|
|
method: 'streamListen',
|
|
|
|
|
args: <String, Object>{
|
|
|
|
@ -138,9 +148,7 @@ void main() {
|
|
|
|
|
chromeConnection.tabs.add(chromeTab);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testUsingContext(
|
|
|
|
|
'runner with web server device does not support debugging without --start-paused',
|
|
|
|
|
() {
|
|
|
|
|
testUsingContext('runner with web server device does not support debugging without --start-paused', () {
|
|
|
|
|
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice);
|
|
|
|
|
flutterDevice.device = WebServerDevice(
|
|
|
|
|
logger: BufferLogger.test(),
|
|
|
|
@ -148,8 +156,7 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
|
|
|
|
|
final ResidentRunner profileResidentWebRunner = ResidentWebRunner(
|
|
|
|
|
flutterDevice,
|
|
|
|
|
flutterProject:
|
|
|
|
|
FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
|
|
|
|
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
|
|
|
|
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
|
|
|
|
|
ipv6: true,
|
|
|
|
|
fileSystem: fileSystem,
|
|
|
|
@ -169,9 +176,7 @@ void main() {
|
|
|
|
|
ProcessManager: () => processManager,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
testUsingContext(
|
|
|
|
|
'runner with web server device supports debugging with --start-paused',
|
|
|
|
|
() {
|
|
|
|
|
testUsingContext('runner with web server device supports debugging with --start-paused', () {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
|
|
|
|
|
setupMocks();
|
|
|
|
|
flutterDevice.device = WebServerDevice(
|
|
|
|
@ -179,10 +184,8 @@ void main() {
|
|
|
|
|
);
|
|
|
|
|
final ResidentRunner profileResidentWebRunner = ResidentWebRunner(
|
|
|
|
|
flutterDevice,
|
|
|
|
|
flutterProject:
|
|
|
|
|
FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
|
|
|
|
debuggingOptions:
|
|
|
|
|
DebuggingOptions.enabled(BuildInfo.debug, startPaused: true),
|
|
|
|
|
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
|
|
|
|
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug, startPaused: true),
|
|
|
|
|
ipv6: true,
|
|
|
|
|
fileSystem: fileSystem,
|
|
|
|
|
logger: BufferLogger.test(),
|
|
|
|
@ -199,8 +202,7 @@ void main() {
|
|
|
|
|
testUsingContext('profile does not supportsServiceProtocol', () {
|
|
|
|
|
final ResidentRunner residentWebRunner = ResidentWebRunner(
|
|
|
|
|
flutterDevice,
|
|
|
|
|
flutterProject:
|
|
|
|
|
FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
|
|
|
|
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
|
|
|
|
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
|
|
|
|
|
ipv6: true,
|
|
|
|
|
fileSystem: fileSystem,
|
|
|
|
@ -212,8 +214,7 @@ void main() {
|
|
|
|
|
flutterDevice.device = chromeDevice;
|
|
|
|
|
final ResidentRunner profileResidentWebRunner = ResidentWebRunner(
|
|
|
|
|
flutterDevice,
|
|
|
|
|
flutterProject:
|
|
|
|
|
FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
|
|
|
|
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
|
|
|
|
debuggingOptions: DebuggingOptions.enabled(BuildInfo.profile),
|
|
|
|
|
ipv6: true,
|
|
|
|
|
fileSystem: fileSystem,
|
|
|
|
@ -231,98 +232,69 @@ void main() {
|
|
|
|
|
|
|
|
|
|
testUsingContext('Can successfully run and connect to vmservice', () async {
|
|
|
|
|
final BufferLogger logger = BufferLogger.test();
|
|
|
|
|
final ResidentRunner residentWebRunner =
|
|
|
|
|
setUpResidentRunner(flutterDevice, logger: logger);
|
|
|
|
|
fakeVmServiceHost =
|
|
|
|
|
FakeVmServiceHost(requests: kAttachExpectations.toList());
|
|
|
|
|
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice, logger: logger);
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList());
|
|
|
|
|
setupMocks();
|
|
|
|
|
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter =
|
|
|
|
|
Completer<DebugConnectionInfo>();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
|
|
|
|
unawaited(residentWebRunner.run(
|
|
|
|
|
connectionInfoCompleter: connectionInfoCompleter,
|
|
|
|
|
));
|
|
|
|
|
final DebugConnectionInfo debugConnectionInfo =
|
|
|
|
|
await connectionInfoCompleter.future;
|
|
|
|
|
final DebugConnectionInfo debugConnectionInfo = await connectionInfoCompleter.future;
|
|
|
|
|
|
|
|
|
|
expect(appConnection.ranMain, true);
|
|
|
|
|
expect(logger.statusText,
|
|
|
|
|
contains('Debug service listening on ws://127.0.0.1/abcd/'));
|
|
|
|
|
expect(logger.statusText, contains('Debug service listening on ws://127.0.0.1/abcd/'));
|
|
|
|
|
expect(debugConnectionInfo.wsUri.toString(), 'ws://127.0.0.1/abcd/');
|
|
|
|
|
}, overrides: <Type, Generator>{
|
|
|
|
|
FileSystem: () => fileSystem,
|
|
|
|
|
ProcessManager: () => processManager,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
testUsingContext('WebRunner copies compiled app.dill to cache during startup',
|
|
|
|
|
() async {
|
|
|
|
|
testUsingContext('WebRunner copies compiled app.dill to cache during startup', () async {
|
|
|
|
|
final DebuggingOptions debuggingOptions = DebuggingOptions.enabled(
|
|
|
|
|
const BuildInfo(BuildMode.debug, null, treeShakeIcons: false),
|
|
|
|
|
);
|
|
|
|
|
final ResidentRunner residentWebRunner =
|
|
|
|
|
setUpResidentRunner(flutterDevice, debuggingOptions: debuggingOptions);
|
|
|
|
|
fakeVmServiceHost =
|
|
|
|
|
FakeVmServiceHost(requests: kAttachExpectations.toList());
|
|
|
|
|
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice, debuggingOptions: debuggingOptions);
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList());
|
|
|
|
|
setupMocks();
|
|
|
|
|
|
|
|
|
|
residentWebRunner.artifactDirectory
|
|
|
|
|
.childFile('app.dill')
|
|
|
|
|
.writeAsStringSync('ABC');
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter =
|
|
|
|
|
Completer<DebugConnectionInfo>();
|
|
|
|
|
residentWebRunner.artifactDirectory.childFile('app.dill').writeAsStringSync('ABC');
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
|
|
|
|
unawaited(residentWebRunner.run(
|
|
|
|
|
connectionInfoCompleter: connectionInfoCompleter,
|
|
|
|
|
));
|
|
|
|
|
await connectionInfoCompleter.future;
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
await fileSystem
|
|
|
|
|
.file(fileSystem.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,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
testUsingContext(
|
|
|
|
|
'WebRunner copies compiled app.dill to cache during startup with track-widget-creation',
|
|
|
|
|
() async {
|
|
|
|
|
testUsingContext('WebRunner copies compiled app.dill to cache during startup with track-widget-creation', () async {
|
|
|
|
|
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice);
|
|
|
|
|
fakeVmServiceHost =
|
|
|
|
|
FakeVmServiceHost(requests: kAttachExpectations.toList());
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList());
|
|
|
|
|
setupMocks();
|
|
|
|
|
|
|
|
|
|
residentWebRunner.artifactDirectory
|
|
|
|
|
.childFile('app.dill')
|
|
|
|
|
.writeAsStringSync('ABC');
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter =
|
|
|
|
|
Completer<DebugConnectionInfo>();
|
|
|
|
|
residentWebRunner.artifactDirectory.childFile('app.dill').writeAsStringSync('ABC');
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
|
|
|
|
unawaited(residentWebRunner.run(
|
|
|
|
|
connectionInfoCompleter: connectionInfoCompleter,
|
|
|
|
|
));
|
|
|
|
|
await connectionInfoCompleter.future;
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
await fileSystem
|
|
|
|
|
.file(fileSystem.path.join('build', 'cache.dill.track.dill'))
|
|
|
|
|
.readAsString(),
|
|
|
|
|
'ABC');
|
|
|
|
|
expect(await fileSystem.file(fileSystem.path.join('build', 'cache.dill.track.dill')).readAsString(), 'ABC');
|
|
|
|
|
}, overrides: <Type, Generator>{
|
|
|
|
|
FileSystem: () => fileSystem,
|
|
|
|
|
ProcessManager: () => processManager,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Regression test for https://github.com/flutter/flutter/issues/60613
|
|
|
|
|
testUsingContext(
|
|
|
|
|
'ResidentWebRunner calls appFailedToStart if initial compilation fails',
|
|
|
|
|
() async {
|
|
|
|
|
fakeVmServiceHost =
|
|
|
|
|
FakeVmServiceHost(requests: kAttachExpectations.toList());
|
|
|
|
|
testUsingContext('ResidentWebRunner calls appFailedToStart if initial compilation fails', () async {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList());
|
|
|
|
|
setupMocks();
|
|
|
|
|
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice);
|
|
|
|
|
fileSystem
|
|
|
|
|
.file(globals.fs.path.join('lib', 'main.dart'))
|
|
|
|
|
fileSystem.file(globals.fs.path.join('lib', 'main.dart'))
|
|
|
|
|
.createSync(recursive: true);
|
|
|
|
|
webDevFS.report = UpdateFSReport();
|
|
|
|
|
|
|
|
|
@ -334,18 +306,15 @@ void main() {
|
|
|
|
|
ProcessManager: () => processManager,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
testUsingContext(
|
|
|
|
|
'Can successfully run without an index.html including status warning',
|
|
|
|
|
() async {
|
|
|
|
|
testUsingContext('Can successfully run without an index.html including status warning', () async {
|
|
|
|
|
final BufferLogger logger = BufferLogger.test();
|
|
|
|
|
fakeVmServiceHost =
|
|
|
|
|
FakeVmServiceHost(requests: kAttachExpectations.toList());
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList());
|
|
|
|
|
setupMocks();
|
|
|
|
|
fileSystem.file(fileSystem.path.join('web', 'index.html')).deleteSync();
|
|
|
|
|
fileSystem.file(fileSystem.path.join('web', 'index.html'))
|
|
|
|
|
.deleteSync();
|
|
|
|
|
final ResidentWebRunner residentWebRunner = ResidentWebRunner(
|
|
|
|
|
flutterDevice,
|
|
|
|
|
flutterProject:
|
|
|
|
|
FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
|
|
|
|
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
|
|
|
|
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
|
|
|
|
|
ipv6: true,
|
|
|
|
|
stayResident: false,
|
|
|
|
@ -363,15 +332,12 @@ void main() {
|
|
|
|
|
ProcessManager: () => processManager,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
testUsingContext('Can successfully run and disconnect with --no-resident',
|
|
|
|
|
() async {
|
|
|
|
|
fakeVmServiceHost =
|
|
|
|
|
FakeVmServiceHost(requests: kAttachExpectations.toList());
|
|
|
|
|
testUsingContext('Can successfully run and disconnect with --no-resident', () async {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList());
|
|
|
|
|
setupMocks();
|
|
|
|
|
final ResidentRunner residentWebRunner = ResidentWebRunner(
|
|
|
|
|
flutterDevice,
|
|
|
|
|
flutterProject:
|
|
|
|
|
FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
|
|
|
|
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
|
|
|
|
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
|
|
|
|
|
ipv6: true,
|
|
|
|
|
stayResident: false,
|
|
|
|
@ -387,11 +353,9 @@ void main() {
|
|
|
|
|
ProcessManager: () => processManager,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
testUsingContext('Listens to stdout and stderr streams before running main',
|
|
|
|
|
() async {
|
|
|
|
|
testUsingContext('Listens to stdout and stderr streams before running main', () async {
|
|
|
|
|
final BufferLogger logger = BufferLogger.test();
|
|
|
|
|
final ResidentRunner residentWebRunner =
|
|
|
|
|
setUpResidentRunner(flutterDevice, logger: logger);
|
|
|
|
|
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice, logger: logger);
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
...kAttachLogExpectations,
|
|
|
|
|
FakeVmServiceStreamResponse(
|
|
|
|
@ -399,20 +363,21 @@ void main() {
|
|
|
|
|
event: vm_service.Event(
|
|
|
|
|
timestamp: 0,
|
|
|
|
|
kind: vm_service.EventStreams.kStdout,
|
|
|
|
|
bytes: base64.encode(utf8.encode('THIS MESSAGE IS IMPORTANT'))),
|
|
|
|
|
bytes: base64.encode(utf8.encode('THIS MESSAGE IS IMPORTANT'))
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
FakeVmServiceStreamResponse(
|
|
|
|
|
streamId: 'Stderr',
|
|
|
|
|
event: vm_service.Event(
|
|
|
|
|
timestamp: 0,
|
|
|
|
|
kind: vm_service.EventStreams.kStderr,
|
|
|
|
|
bytes: base64.encode(utf8.encode('SO IS THIS'))),
|
|
|
|
|
bytes: base64.encode(utf8.encode('SO IS THIS'))
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
...kAttachIsolateExpectations,
|
|
|
|
|
]);
|
|
|
|
|
setupMocks();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter =
|
|
|
|
|
Completer<DebugConnectionInfo>();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
|
|
|
|
unawaited(residentWebRunner.run(
|
|
|
|
|
connectionInfoCompleter: connectionInfoCompleter,
|
|
|
|
|
));
|
|
|
|
@ -425,10 +390,8 @@ void main() {
|
|
|
|
|
ProcessManager: () => processManager,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
testUsingContext('Listens to extension events with structured errors',
|
|
|
|
|
() async {
|
|
|
|
|
final ResidentRunner residentWebRunner =
|
|
|
|
|
setUpResidentRunner(flutterDevice, logger: testLogger);
|
|
|
|
|
testUsingContext('Listens to extension events with structured errors', () async {
|
|
|
|
|
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice, logger: testLogger);
|
|
|
|
|
final Map<String, String> extensionData = <String, String>{
|
|
|
|
|
'test': 'data',
|
|
|
|
|
'renderedErrorText': 'error text',
|
|
|
|
@ -474,8 +437,7 @@ void main() {
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
setupMocks();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter =
|
|
|
|
|
Completer<DebugConnectionInfo>();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
|
|
|
|
unawaited(residentWebRunner.run(
|
|
|
|
|
connectionInfoCompleter: connectionInfoCompleter,
|
|
|
|
|
));
|
|
|
|
@ -492,21 +454,17 @@ void main() {
|
|
|
|
|
testUsingContext('Does not run main with --start-paused', () async {
|
|
|
|
|
final ResidentRunner residentWebRunner = ResidentWebRunner(
|
|
|
|
|
flutterDevice,
|
|
|
|
|
flutterProject:
|
|
|
|
|
FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
|
|
|
|
debuggingOptions:
|
|
|
|
|
DebuggingOptions.enabled(BuildInfo.debug, startPaused: true),
|
|
|
|
|
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
|
|
|
|
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug, startPaused: true),
|
|
|
|
|
ipv6: true,
|
|
|
|
|
fileSystem: fileSystem,
|
|
|
|
|
logger: BufferLogger.test(),
|
|
|
|
|
usage: globals.flutterUsage,
|
|
|
|
|
systemClock: globals.systemClock,
|
|
|
|
|
);
|
|
|
|
|
fakeVmServiceHost =
|
|
|
|
|
FakeVmServiceHost(requests: kAttachExpectations.toList());
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList());
|
|
|
|
|
setupMocks();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter =
|
|
|
|
|
Completer<DebugConnectionInfo>();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
|
|
|
|
|
|
|
|
|
unawaited(residentWebRunner.run(
|
|
|
|
|
connectionInfoCompleter: connectionInfoCompleter,
|
|
|
|
@ -532,7 +490,8 @@ void main() {
|
|
|
|
|
method: 'hotRestart',
|
|
|
|
|
jsonResponse: <String, Object>{
|
|
|
|
|
'type': 'Success',
|
|
|
|
|
}),
|
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
const FakeVmServiceRequest(
|
|
|
|
|
method: 'streamListen',
|
|
|
|
|
args: <String, Object>{
|
|
|
|
@ -542,8 +501,7 @@ void main() {
|
|
|
|
|
]);
|
|
|
|
|
setupMocks();
|
|
|
|
|
final TestChromiumLauncher chromiumLauncher = TestChromiumLauncher();
|
|
|
|
|
final Chromium chrome =
|
|
|
|
|
Chromium(1, chromeConnection, chromiumLauncher: chromiumLauncher);
|
|
|
|
|
final Chromium chrome = Chromium(1, chromeConnection, chromiumLauncher: chromiumLauncher);
|
|
|
|
|
chromiumLauncher.setInstance(chrome);
|
|
|
|
|
|
|
|
|
|
flutterDevice.device = GoogleChromeDevice(
|
|
|
|
@ -555,13 +513,11 @@ void main() {
|
|
|
|
|
);
|
|
|
|
|
webDevFS.report = UpdateFSReport(success: true);
|
|
|
|
|
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter =
|
|
|
|
|
Completer<DebugConnectionInfo>();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
|
|
|
|
unawaited(residentWebRunner.run(
|
|
|
|
|
connectionInfoCompleter: connectionInfoCompleter,
|
|
|
|
|
));
|
|
|
|
|
final DebugConnectionInfo debugConnectionInfo =
|
|
|
|
|
await connectionInfoCompleter.future;
|
|
|
|
|
final DebugConnectionInfo debugConnectionInfo = await connectionInfoCompleter.future;
|
|
|
|
|
|
|
|
|
|
expect(debugConnectionInfo, isNotNull);
|
|
|
|
|
|
|
|
|
@ -573,15 +529,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
// ensure that analytics are sent.
|
|
|
|
|
expect(testUsage.events, <TestUsageEvent>[
|
|
|
|
|
TestUsageEvent('hot', 'restart',
|
|
|
|
|
parameters: CustomDimensions.fromMap(<String, String>{
|
|
|
|
|
'cd27': 'web-javascript',
|
|
|
|
|
'cd28': '',
|
|
|
|
|
'cd29': 'false',
|
|
|
|
|
'cd30': 'true',
|
|
|
|
|
'cd13': '0',
|
|
|
|
|
'cd48': 'false'
|
|
|
|
|
})),
|
|
|
|
|
TestUsageEvent('hot', 'restart', parameters: CustomDimensions.fromMap(<String, String>{'cd27': 'web-javascript', 'cd28': '', 'cd29': 'false', 'cd30': 'true', 'cd13': '0', 'cd48': 'false'})),
|
|
|
|
|
]);
|
|
|
|
|
expect(testUsage.timings, const <TestTimingEvent>[
|
|
|
|
|
TestTimingEvent('hot', 'web-incremental-restart', Duration.zero),
|
|
|
|
@ -605,12 +553,12 @@ void main() {
|
|
|
|
|
method: 'hotRestart',
|
|
|
|
|
jsonResponse: <String, Object>{
|
|
|
|
|
'type': 'Success',
|
|
|
|
|
}),
|
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
]);
|
|
|
|
|
setupMocks();
|
|
|
|
|
final TestChromiumLauncher chromiumLauncher = TestChromiumLauncher();
|
|
|
|
|
final Chromium chrome =
|
|
|
|
|
Chromium(1, chromeConnection, chromiumLauncher: chromiumLauncher);
|
|
|
|
|
final Chromium chrome = Chromium(1, chromeConnection, chromiumLauncher: chromiumLauncher);
|
|
|
|
|
chromiumLauncher.setInstance(chrome);
|
|
|
|
|
|
|
|
|
|
flutterDevice.device = GoogleChromeDevice(
|
|
|
|
@ -622,19 +570,16 @@ void main() {
|
|
|
|
|
);
|
|
|
|
|
webDevFS.report = UpdateFSReport(success: true);
|
|
|
|
|
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter =
|
|
|
|
|
Completer<DebugConnectionInfo>();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
|
|
|
|
unawaited(residentWebRunner.run(
|
|
|
|
|
connectionInfoCompleter: connectionInfoCompleter,
|
|
|
|
|
));
|
|
|
|
|
await connectionInfoCompleter.future;
|
|
|
|
|
final OperationResult result =
|
|
|
|
|
await residentWebRunner.restart(fullRestart: true);
|
|
|
|
|
final OperationResult result = await residentWebRunner.restart(fullRestart: true);
|
|
|
|
|
|
|
|
|
|
// Ensure that generated entrypoint is generated correctly.
|
|
|
|
|
expect(webDevFS.mainUri, isNotNull);
|
|
|
|
|
final String entrypointContents =
|
|
|
|
|
fileSystem.file(webDevFS.mainUri).readAsStringSync();
|
|
|
|
|
final String entrypointContents = fileSystem.file(webDevFS.mainUri).readAsStringSync();
|
|
|
|
|
expect(entrypointContents, contains('// Flutter web bootstrap script'));
|
|
|
|
|
expect(entrypointContents, contains("import 'dart:ui' as ui;"));
|
|
|
|
|
expect(entrypointContents, contains('await ui.webOnlyWarmupEngine('));
|
|
|
|
@ -644,15 +589,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
// ensure that analytics are sent.
|
|
|
|
|
expect(testUsage.events, <TestUsageEvent>[
|
|
|
|
|
TestUsageEvent('hot', 'restart',
|
|
|
|
|
parameters: CustomDimensions.fromMap(<String, String>{
|
|
|
|
|
'cd27': 'web-javascript',
|
|
|
|
|
'cd28': '',
|
|
|
|
|
'cd29': 'false',
|
|
|
|
|
'cd30': 'true',
|
|
|
|
|
'cd13': '0',
|
|
|
|
|
'cd48': 'false'
|
|
|
|
|
})),
|
|
|
|
|
TestUsageEvent('hot', 'restart', parameters: CustomDimensions.fromMap(<String, String>{'cd27': 'web-javascript', 'cd28': '', 'cd29': 'false', 'cd30': 'true', 'cd13': '0', 'cd48': 'false'})),
|
|
|
|
|
]);
|
|
|
|
|
expect(testUsage.timings, const <TestTimingEvent>[
|
|
|
|
|
TestTimingEvent('hot', 'web-incremental-restart', Duration.zero),
|
|
|
|
@ -663,8 +600,7 @@ void main() {
|
|
|
|
|
ProcessManager: () => processManager,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
testUsingContext('Can hot restart after attaching with web-server device',
|
|
|
|
|
() async {
|
|
|
|
|
testUsingContext('Can hot restart after attaching with web-server device', () async {
|
|
|
|
|
final BufferLogger logger = BufferLogger.test();
|
|
|
|
|
final ResidentRunner residentWebRunner = setUpResidentRunner(
|
|
|
|
|
flutterDevice,
|
|
|
|
@ -676,14 +612,12 @@ void main() {
|
|
|
|
|
flutterDevice.device = webServerDevice;
|
|
|
|
|
webDevFS.report = UpdateFSReport(success: true);
|
|
|
|
|
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter =
|
|
|
|
|
Completer<DebugConnectionInfo>();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
|
|
|
|
unawaited(residentWebRunner.run(
|
|
|
|
|
connectionInfoCompleter: connectionInfoCompleter,
|
|
|
|
|
));
|
|
|
|
|
await connectionInfoCompleter.future;
|
|
|
|
|
final OperationResult result =
|
|
|
|
|
await residentWebRunner.restart(fullRestart: true);
|
|
|
|
|
final OperationResult result = await residentWebRunner.restart(fullRestart: true);
|
|
|
|
|
|
|
|
|
|
expect(logger.statusText, contains('Restarted application in'));
|
|
|
|
|
expect(result.code, 0);
|
|
|
|
@ -699,8 +633,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
testUsingContext('web resident runner is debuggable', () {
|
|
|
|
|
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice);
|
|
|
|
|
fakeVmServiceHost =
|
|
|
|
|
FakeVmServiceHost(requests: kAttachExpectations.toList());
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList());
|
|
|
|
|
|
|
|
|
|
expect(residentWebRunner.debuggingEnabled, true);
|
|
|
|
|
}, overrides: <Type, Generator>{
|
|
|
|
@ -714,8 +647,7 @@ void main() {
|
|
|
|
|
setupMocks();
|
|
|
|
|
webDevFS.report = UpdateFSReport();
|
|
|
|
|
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter =
|
|
|
|
|
Completer<DebugConnectionInfo>();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
|
|
|
|
unawaited(residentWebRunner.run(
|
|
|
|
|
connectionInfoCompleter: connectionInfoCompleter,
|
|
|
|
|
));
|
|
|
|
@ -729,12 +661,9 @@ void main() {
|
|
|
|
|
ProcessManager: () => processManager,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
testUsingContext(
|
|
|
|
|
'Faithfully displays stdout messages with leading/trailing spaces',
|
|
|
|
|
() async {
|
|
|
|
|
testUsingContext('Faithfully displays stdout messages with leading/trailing spaces', () async {
|
|
|
|
|
final BufferLogger logger = BufferLogger.test();
|
|
|
|
|
final ResidentRunner residentWebRunner =
|
|
|
|
|
setUpResidentRunner(flutterDevice, logger: logger);
|
|
|
|
|
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice, logger: logger);
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
...kAttachLogExpectations,
|
|
|
|
|
FakeVmServiceStreamResponse(
|
|
|
|
@ -743,25 +672,21 @@ void main() {
|
|
|
|
|
timestamp: 0,
|
|
|
|
|
kind: vm_service.EventStreams.kStdout,
|
|
|
|
|
bytes: base64.encode(
|
|
|
|
|
utf8.encode(
|
|
|
|
|
' This is a message with 4 leading and trailing spaces '),
|
|
|
|
|
utf8.encode(' This is a message with 4 leading and trailing spaces '),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
...kAttachIsolateExpectations,
|
|
|
|
|
]);
|
|
|
|
|
setupMocks();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter =
|
|
|
|
|
Completer<DebugConnectionInfo>();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
|
|
|
|
unawaited(residentWebRunner.run(
|
|
|
|
|
connectionInfoCompleter: connectionInfoCompleter,
|
|
|
|
|
));
|
|
|
|
|
await connectionInfoCompleter.future;
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
logger.statusText,
|
|
|
|
|
contains(
|
|
|
|
|
' This is a message with 4 leading and trailing spaces '));
|
|
|
|
|
expect(logger.statusText,
|
|
|
|
|
contains(' This is a message with 4 leading and trailing spaces '));
|
|
|
|
|
expect(fakeVmServiceHost.hasRemainingExpectations, false);
|
|
|
|
|
}, overrides: <Type, Generator>{
|
|
|
|
|
FileSystem: () => fileSystem,
|
|
|
|
@ -770,19 +695,16 @@ void main() {
|
|
|
|
|
|
|
|
|
|
testUsingContext('Fails on compilation errors in hot restart', () async {
|
|
|
|
|
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice);
|
|
|
|
|
fakeVmServiceHost =
|
|
|
|
|
FakeVmServiceHost(requests: kAttachExpectations.toList());
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: kAttachExpectations.toList());
|
|
|
|
|
setupMocks();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter =
|
|
|
|
|
Completer<DebugConnectionInfo>();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
|
|
|
|
unawaited(residentWebRunner.run(
|
|
|
|
|
connectionInfoCompleter: connectionInfoCompleter,
|
|
|
|
|
));
|
|
|
|
|
await connectionInfoCompleter.future;
|
|
|
|
|
webDevFS.report = UpdateFSReport();
|
|
|
|
|
|
|
|
|
|
final OperationResult result =
|
|
|
|
|
await residentWebRunner.restart(fullRestart: true);
|
|
|
|
|
final OperationResult result = await residentWebRunner.restart(fullRestart: true);
|
|
|
|
|
|
|
|
|
|
expect(result.code, 1);
|
|
|
|
|
expect(result.message, contains('Failed to recompile application.'));
|
|
|
|
@ -794,9 +716,7 @@ void main() {
|
|
|
|
|
ProcessManager: () => processManager,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
testUsingContext(
|
|
|
|
|
'Fails non-fatally on vmservice response error for hot restart',
|
|
|
|
|
() async {
|
|
|
|
|
testUsingContext('Fails non-fatally on vmservice response error for hot restart', () async {
|
|
|
|
|
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice);
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
...kAttachExpectations,
|
|
|
|
@ -808,8 +728,7 @@ void main() {
|
|
|
|
|
),
|
|
|
|
|
]);
|
|
|
|
|
setupMocks();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter =
|
|
|
|
|
Completer<DebugConnectionInfo>();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
|
|
|
|
unawaited(residentWebRunner.run(
|
|
|
|
|
connectionInfoCompleter: connectionInfoCompleter,
|
|
|
|
|
));
|
|
|
|
@ -834,8 +753,7 @@ void main() {
|
|
|
|
|
),
|
|
|
|
|
]);
|
|
|
|
|
setupMocks();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter =
|
|
|
|
|
Completer<DebugConnectionInfo>();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
|
|
|
|
unawaited(residentWebRunner.run(
|
|
|
|
|
connectionInfoCompleter: connectionInfoCompleter,
|
|
|
|
|
));
|
|
|
|
@ -843,17 +761,16 @@ void main() {
|
|
|
|
|
final OperationResult result = await residentWebRunner.restart();
|
|
|
|
|
|
|
|
|
|
expect(result.code, 1);
|
|
|
|
|
expect(result.message, contains(RPCErrorCodes.kInternalError.toString()));
|
|
|
|
|
expect(result.message,
|
|
|
|
|
contains(RPCErrorCodes.kInternalError.toString()));
|
|
|
|
|
}, overrides: <Type, Generator>{
|
|
|
|
|
FileSystem: () => fileSystem,
|
|
|
|
|
ProcessManager: () => processManager,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
testUsingContext('printHelp without details shows hot restart help message',
|
|
|
|
|
() async {
|
|
|
|
|
testUsingContext('printHelp without details shows hot restart help message', () async {
|
|
|
|
|
final BufferLogger logger = BufferLogger.test();
|
|
|
|
|
final ResidentRunner residentWebRunner =
|
|
|
|
|
setUpResidentRunner(flutterDevice, logger: logger);
|
|
|
|
|
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice, logger: logger);
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
|
|
|
|
|
residentWebRunner.printHelp(details: false);
|
|
|
|
|
|
|
|
|
@ -863,16 +780,14 @@ void main() {
|
|
|
|
|
ProcessManager: () => processManager,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
testUsingContext('cleanup of resources is safe to call multiple times',
|
|
|
|
|
() async {
|
|
|
|
|
testUsingContext('cleanup of resources is safe to call multiple times', () async {
|
|
|
|
|
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice);
|
|
|
|
|
mockDevice.dds = DartDevelopmentService();
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
...kAttachExpectations,
|
|
|
|
|
]);
|
|
|
|
|
setupMocks();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter =
|
|
|
|
|
Completer<DebugConnectionInfo>();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
|
|
|
|
unawaited(residentWebRunner.run(
|
|
|
|
|
connectionInfoCompleter: connectionInfoCompleter,
|
|
|
|
|
));
|
|
|
|
@ -894,8 +809,7 @@ void main() {
|
|
|
|
|
...kAttachExpectations,
|
|
|
|
|
]);
|
|
|
|
|
setupMocks();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter =
|
|
|
|
|
Completer<DebugConnectionInfo>();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
|
|
|
|
final Future<int> result = residentWebRunner.run(
|
|
|
|
|
connectionInfoCompleter: connectionInfoCompleter,
|
|
|
|
|
);
|
|
|
|
@ -911,23 +825,19 @@ void main() {
|
|
|
|
|
|
|
|
|
|
testUsingContext('Prints target and device name on run', () async {
|
|
|
|
|
final BufferLogger logger = BufferLogger.test();
|
|
|
|
|
final ResidentRunner residentWebRunner =
|
|
|
|
|
setUpResidentRunner(flutterDevice, logger: logger);
|
|
|
|
|
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice, logger: logger);
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
...kAttachExpectations,
|
|
|
|
|
]);
|
|
|
|
|
setupMocks();
|
|
|
|
|
mockDevice.name = 'Chromez';
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter =
|
|
|
|
|
Completer<DebugConnectionInfo>();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
|
|
|
|
unawaited(residentWebRunner.run(
|
|
|
|
|
connectionInfoCompleter: connectionInfoCompleter,
|
|
|
|
|
));
|
|
|
|
|
await connectionInfoCompleter.future;
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
logger.statusText,
|
|
|
|
|
contains(
|
|
|
|
|
expect(logger.statusText, contains(
|
|
|
|
|
'Launching ${fileSystem.path.join('lib', 'main.dart')} on '
|
|
|
|
|
'Chromez in debug mode',
|
|
|
|
|
));
|
|
|
|
@ -937,8 +847,7 @@ void main() {
|
|
|
|
|
ProcessManager: () => processManager,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
testUsingContext('Sends launched app.webLaunchUrl event for Chrome device',
|
|
|
|
|
() async {
|
|
|
|
|
testUsingContext('Sends launched app.webLaunchUrl event for Chrome device', () async {
|
|
|
|
|
final BufferLogger logger = BufferLogger.test();
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
...kAttachLogExpectations,
|
|
|
|
@ -947,8 +856,7 @@ void main() {
|
|
|
|
|
setupMocks();
|
|
|
|
|
final FakeChromeConnection chromeConnection = FakeChromeConnection();
|
|
|
|
|
final TestChromiumLauncher chromiumLauncher = TestChromiumLauncher();
|
|
|
|
|
final Chromium chrome =
|
|
|
|
|
Chromium(1, chromeConnection, chromiumLauncher: chromiumLauncher);
|
|
|
|
|
final Chromium chrome = Chromium(1, chromeConnection, chromiumLauncher: chromiumLauncher);
|
|
|
|
|
chromiumLauncher.setInstance(chrome);
|
|
|
|
|
|
|
|
|
|
flutterDevice.device = GoogleChromeDevice(
|
|
|
|
@ -965,8 +873,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
final ResidentWebRunner runner = ResidentWebRunner(
|
|
|
|
|
flutterDevice,
|
|
|
|
|
flutterProject:
|
|
|
|
|
FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
|
|
|
|
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
|
|
|
|
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
|
|
|
|
|
ipv6: true,
|
|
|
|
|
fileSystem: fileSystem,
|
|
|
|
@ -975,18 +882,15 @@ void main() {
|
|
|
|
|
systemClock: globals.systemClock,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter =
|
|
|
|
|
Completer<DebugConnectionInfo>();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
|
|
|
|
unawaited(runner.run(
|
|
|
|
|
connectionInfoCompleter: connectionInfoCompleter,
|
|
|
|
|
));
|
|
|
|
|
await connectionInfoCompleter.future;
|
|
|
|
|
|
|
|
|
|
// Ensure we got the URL and that it was already launched.
|
|
|
|
|
expect(
|
|
|
|
|
logger.eventText,
|
|
|
|
|
contains(json.encode(
|
|
|
|
|
<String, Object>{
|
|
|
|
|
expect(logger.eventText,
|
|
|
|
|
contains(json.encode(<String, Object>{
|
|
|
|
|
'name': 'app.webLaunchUrl',
|
|
|
|
|
'args': <String, Object>{
|
|
|
|
|
'url': 'http://localhost:8765/app/',
|
|
|
|
@ -1000,9 +904,7 @@ void main() {
|
|
|
|
|
ProcessManager: () => processManager,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
testUsingContext(
|
|
|
|
|
'Sends unlaunched app.webLaunchUrl event for Web Server device',
|
|
|
|
|
() async {
|
|
|
|
|
testUsingContext('Sends unlaunched app.webLaunchUrl event for Web Server device', () async {
|
|
|
|
|
final BufferLogger logger = BufferLogger.test();
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
|
|
|
|
|
setupMocks();
|
|
|
|
@ -1013,8 +915,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
final ResidentWebRunner runner = ResidentWebRunner(
|
|
|
|
|
flutterDevice,
|
|
|
|
|
flutterProject:
|
|
|
|
|
FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
|
|
|
|
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
|
|
|
|
|
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
|
|
|
|
|
ipv6: true,
|
|
|
|
|
fileSystem: fileSystem,
|
|
|
|
@ -1023,18 +924,15 @@ void main() {
|
|
|
|
|
systemClock: globals.systemClock,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter =
|
|
|
|
|
Completer<DebugConnectionInfo>();
|
|
|
|
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
|
|
|
|
unawaited(runner.run(
|
|
|
|
|
connectionInfoCompleter: connectionInfoCompleter,
|
|
|
|
|
));
|
|
|
|
|
await connectionInfoCompleter.future;
|
|
|
|
|
|
|
|
|
|
// Ensure we got the URL and that it was not already launched.
|
|
|
|
|
expect(
|
|
|
|
|
logger.eventText,
|
|
|
|
|
contains(json.encode(
|
|
|
|
|
<String, Object>{
|
|
|
|
|
expect(logger.eventText,
|
|
|
|
|
contains(json.encode(<String, Object>{
|
|
|
|
|
'name': 'app.webLaunchUrl',
|
|
|
|
|
'args': <String, Object>{
|
|
|
|
|
'url': 'http://localhost:8765/app/',
|
|
|
|
@ -1052,8 +950,8 @@ void main() {
|
|
|
|
|
// perf regression in hot restart.
|
|
|
|
|
testUsingContext('Does not generate dart_plugin_registrant.dart', () async {
|
|
|
|
|
// Create necessary files for [DartPluginRegistrantTarget]
|
|
|
|
|
final File packageConfig =
|
|
|
|
|
globals.fs.directory('.dart_tool').childFile('package_config.json');
|
|
|
|
|
final File packageConfig = globals.fs.directory('.dart_tool')
|
|
|
|
|
.childFile('package_config.json');
|
|
|
|
|
packageConfig.createSync(recursive: true);
|
|
|
|
|
packageConfig.writeAsStringSync('''
|
|
|
|
|
{
|
|
|
|
@ -1069,14 +967,12 @@ void main() {
|
|
|
|
|
}
|
|
|
|
|
''');
|
|
|
|
|
// Start with a dart_plugin_registrant.dart file.
|
|
|
|
|
globals.fs
|
|
|
|
|
.directory('.dart_tool')
|
|
|
|
|
globals.fs.directory('.dart_tool')
|
|
|
|
|
.childDirectory('flutter_build')
|
|
|
|
|
.childFile('dart_plugin_registrant.dart')
|
|
|
|
|
.createSync(recursive: true);
|
|
|
|
|
|
|
|
|
|
final FlutterProject project =
|
|
|
|
|
FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
|
|
|
|
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
|
|
|
|
|
|
|
|
|
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice);
|
|
|
|
|
await residentWebRunner.runSourceGenerators();
|
|
|
|
@ -1091,11 +987,9 @@ void main() {
|
|
|
|
|
ProcessManager: () => processManager,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
testUsingContext('Successfully turns WebSocketException into ToolExit',
|
|
|
|
|
() async {
|
|
|
|
|
testUsingContext('Successfully turns WebSocketException into ToolExit', () async {
|
|
|
|
|
final BufferLogger logger = BufferLogger.test();
|
|
|
|
|
final ResidentRunner residentWebRunner =
|
|
|
|
|
setUpResidentRunner(flutterDevice, logger: logger);
|
|
|
|
|
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice, logger: logger);
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
|
|
|
|
|
setupMocks();
|
|
|
|
|
webDevFS.exception = const WebSocketException();
|
|
|
|
@ -1108,8 +1002,7 @@ void main() {
|
|
|
|
|
ProcessManager: () => processManager,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
testUsingContext('Successfully turns AppConnectionException into ToolExit',
|
|
|
|
|
() async {
|
|
|
|
|
testUsingContext('Successfully turns AppConnectionException into ToolExit', () async {
|
|
|
|
|
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice);
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
|
|
|
|
|
setupMocks();
|
|
|
|
@ -1122,8 +1015,7 @@ void main() {
|
|
|
|
|
ProcessManager: () => processManager,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
testUsingContext('Successfully turns ChromeDebugError into ToolExit',
|
|
|
|
|
() async {
|
|
|
|
|
testUsingContext('Successfully turns ChromeDebugError into ToolExit', () async {
|
|
|
|
|
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice);
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
|
|
|
|
|
setupMocks();
|
|
|
|
@ -1152,8 +1044,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
testUsingContext('Rethrows unknown Error type from dwds tooling', () async {
|
|
|
|
|
final BufferLogger logger = BufferLogger.test();
|
|
|
|
|
final ResidentRunner residentWebRunner =
|
|
|
|
|
setUpResidentRunner(flutterDevice, logger: logger);
|
|
|
|
|
final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice, logger: logger);
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
|
|
|
|
|
setupMocks();
|
|
|
|
|
webDevFS.exception = StateError('');
|
|
|
|
@ -1166,18 +1057,15 @@ void main() {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ResidentRunner setUpResidentRunner(
|
|
|
|
|
FlutterDevice flutterDevice, {
|
|
|
|
|
ResidentRunner setUpResidentRunner(FlutterDevice flutterDevice, {
|
|
|
|
|
Logger logger,
|
|
|
|
|
SystemClock systemClock,
|
|
|
|
|
DebuggingOptions debuggingOptions,
|
|
|
|
|
}) {
|
|
|
|
|
return ResidentWebRunner(
|
|
|
|
|
flutterDevice,
|
|
|
|
|
flutterProject:
|
|
|
|
|
FlutterProject.fromDirectoryTest(globals.fs.currentDirectory),
|
|
|
|
|
debuggingOptions:
|
|
|
|
|
debuggingOptions ?? DebuggingOptions.enabled(BuildInfo.debug),
|
|
|
|
|
flutterProject: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory),
|
|
|
|
|
debuggingOptions: debuggingOptions ?? DebuggingOptions.enabled(BuildInfo.debug),
|
|
|
|
|
ipv6: true,
|
|
|
|
|
usage: globals.flutterUsage,
|
|
|
|
|
systemClock: systemClock ?? SystemClock.fixed(DateTime.now()),
|
|
|
|
@ -1238,8 +1126,7 @@ class FakeDebugConnection extends Fake implements DebugConnection {
|
|
|
|
|
FakeVmServiceHost Function() fakeVmServiceHost;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
vm_service.VmService get vmService =>
|
|
|
|
|
fakeVmServiceHost.call().vmService.service;
|
|
|
|
|
vm_service.VmService get vmService => fakeVmServiceHost.call().vmService.service;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
String uri;
|
|
|
|
@ -1283,7 +1170,6 @@ class FakeResidentCompiler extends Fake implements ResidentCompiler {
|
|
|
|
|
@required FileSystem fs,
|
|
|
|
|
bool suppressErrors = false,
|
|
|
|
|
bool checkDartPluginRegistry = false,
|
|
|
|
|
File dartPluginRegistrant,
|
|
|
|
|
}) async {
|
|
|
|
|
return const CompilerOutput('foo.dill', 0, <Uri>[]);
|
|
|
|
|
}
|
|
|
|
@ -1343,7 +1229,6 @@ class FakeWebDevFS extends Fake implements WebDevFS {
|
|
|
|
|
bool bundleFirstUpload = false,
|
|
|
|
|
bool fullRestart = false,
|
|
|
|
|
String projectRootPath,
|
|
|
|
|
File dartPluginRegistrant,
|
|
|
|
|
}) async {
|
|
|
|
|
this.mainUri = mainUri;
|
|
|
|
|
return report;
|
|
|
|
@ -1364,8 +1249,7 @@ class FakeChromeConnection extends Fake implements ChromeConnection {
|
|
|
|
|
final List<ChromeTab> tabs = <ChromeTab>[];
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<ChromeTab> getTab(bool Function(ChromeTab tab) accept,
|
|
|
|
|
{Duration retryFor}) async {
|
|
|
|
|
Future<ChromeTab> getTab(bool Function(ChromeTab tab) accept, {Duration retryFor}) async {
|
|
|
|
|
return tabs.firstWhere(accept);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1480,8 +1364,7 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<void> exitApps(
|
|
|
|
|
{Duration timeoutDelay = const Duration(seconds: 10)}) async {}
|
|
|
|
|
Future<void> exitApps({Duration timeoutDelay = const Duration(seconds: 10)}) async { }
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<void> connect({
|
|
|
|
@ -1513,7 +1396,6 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
|
|
|
|
|
String dillOutputPath,
|
|
|
|
|
List<Uri> invalidatedFiles,
|
|
|
|
|
PackageConfig packageConfig,
|
|
|
|
|
File dartPluginRegistrant,
|
|
|
|
|
}) async {
|
|
|
|
|
if (reportError != null) {
|
|
|
|
|
throw reportError;
|
|
|
|
|