Unverified Commit b7932853 authored by Kenzie Schmoll's avatar Kenzie Schmoll Committed by GitHub

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

parent 3d06d66b
......@@ -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>();
......
......@@ -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: () {
......
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