mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add --no-launch-browser flag to DevTools pub run command (#72519)
This commit is contained in:
parent
3d06d66b93
commit
b793285329
@ -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: () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user