Add --no-launch-browser flag to DevTools pub run command (#72519)

This commit is contained in:
Kenzie Schmoll 2020-12-18 10:14:36 -08:00 committed by GitHub
parent 3d06d66b93
commit b793285329
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 0 deletions

View File

@ -71,6 +71,7 @@ class DevtoolsServerLauncher extends DevtoolsLauncher {
'global',
'run',
'devtools',
if (!openInBrowser) '--no-launch-browser',
if (vmServiceUri != null) '--vm-uri=$vmServiceUri',
]);
final Completer<Uri> completer = Completer<Uri>();

View File

@ -34,6 +34,7 @@ void main() {
'global',
'run',
'devtools',
'--no-launch-browser',
],
stdout: 'Serving DevTools at http://127.0.0.1:9100\n',
completer: completer,
@ -46,6 +47,39 @@ void main() {
expect(address.port, 9100);
});
testWithoutContext('DevtoolsLauncher launches DevTools in browser', () async {
final Completer<void> completer = Completer<void>();
final DevtoolsLauncher launcher = DevtoolsServerLauncher(
pubExecutable: 'pub',
logger: BufferLogger.test(),
processManager: FakeProcessManager.list(<FakeCommand>[
const FakeCommand(
command: <String>[
'pub',
'global',
'activate',
'devtools',
],
stdout: 'Activated DevTools 0.9.5',
),
FakeCommand(
command: const <String>[
'pub',
'global',
'run',
'devtools',
],
stdout: 'Serving DevTools at http://127.0.0.1:9100\n',
completer: completer,
),
]),
);
final DevToolsServerAddress address = await launcher.serve(openInBrowser: true);
expect(address.host, '127.0.0.1');
expect(address.port, 9100);
});
testWithoutContext('DevtoolsLauncher prints error if exception is thrown during activate', () async {
final BufferLogger logger = BufferLogger.test();
final DevtoolsLauncher launcher = DevtoolsServerLauncher(
@ -68,6 +102,7 @@ void main() {
'global',
'run',
'devtools',
'--no-launch-browser',
'--vm-uri=http://127.0.0.1:1234/abcdefg',
],
onRun: () {
@ -103,6 +138,7 @@ void main() {
'global',
'run',
'devtools',
'--no-launch-browser',
'--vm-uri=http://127.0.0.1:1234/abcdefg',
],
onRun: () {