[web] Wire the "--start-paused" flag correctly for web (#49310)
This commit is contained in:
parent
4fd19aa189
commit
a1fa1a3d26
@ -83,12 +83,13 @@ class FlutterWebPlatform extends PlatformPlugin {
|
|||||||
FlutterProject flutterProject,
|
FlutterProject flutterProject,
|
||||||
String shellPath,
|
String shellPath,
|
||||||
bool updateGoldens = false,
|
bool updateGoldens = false,
|
||||||
|
bool pauseAfterLoad = false,
|
||||||
}) async {
|
}) async {
|
||||||
final shelf_io.IOServer server =
|
final shelf_io.IOServer server =
|
||||||
shelf_io.IOServer(await HttpMultiServer.loopback(0));
|
shelf_io.IOServer(await HttpMultiServer.loopback(0));
|
||||||
return FlutterWebPlatform._(
|
return FlutterWebPlatform._(
|
||||||
server,
|
server,
|
||||||
Configuration.current,
|
Configuration.current.change(pauseAfterLoad: pauseAfterLoad),
|
||||||
root,
|
root,
|
||||||
flutterProject: flutterProject,
|
flutterProject: flutterProject,
|
||||||
shellPath: shellPath,
|
shellPath: shellPath,
|
||||||
@ -339,6 +340,7 @@ class FlutterWebPlatform extends PlatformPlugin {
|
|||||||
browser,
|
browser,
|
||||||
hostUrl,
|
hostUrl,
|
||||||
completer.future,
|
completer.future,
|
||||||
|
headless: !_config.pauseAfterLoad,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Store null values for browsers that error out so we know not to load them
|
// Store null values for browsers that error out so we know not to load them
|
||||||
@ -587,6 +589,8 @@ class BrowserManager {
|
|||||||
/// [future]. If [debug] is true, starts the browser in debug mode, with its
|
/// [future]. If [debug] is true, starts the browser in debug mode, with its
|
||||||
/// debugger interfaces on and detected.
|
/// debugger interfaces on and detected.
|
||||||
///
|
///
|
||||||
|
/// The browser will start in headless mode if [headless] is true.
|
||||||
|
///
|
||||||
/// The [settings] indicate how to invoke this browser's executable.
|
/// The [settings] indicate how to invoke this browser's executable.
|
||||||
///
|
///
|
||||||
/// Returns the browser manager, or throws an [ApplicationException] if a
|
/// Returns the browser manager, or throws an [ApplicationException] if a
|
||||||
@ -596,9 +600,10 @@ class BrowserManager {
|
|||||||
Uri url,
|
Uri url,
|
||||||
Future<WebSocketChannel> future, {
|
Future<WebSocketChannel> future, {
|
||||||
bool debug = false,
|
bool debug = false,
|
||||||
|
bool headless = true,
|
||||||
}) async {
|
}) async {
|
||||||
final Chrome chrome =
|
final Chrome chrome =
|
||||||
await chromeLauncher.launch(url.toString(), headless: true);
|
await chromeLauncher.launch(url.toString(), headless: headless);
|
||||||
|
|
||||||
final Completer<BrowserManager> completer = Completer<BrowserManager>();
|
final Completer<BrowserManager> completer = Completer<BrowserManager>();
|
||||||
|
|
||||||
|
@ -56,6 +56,8 @@ Future<int> runTests(
|
|||||||
final List<String> testArgs = <String>[
|
final List<String> testArgs = <String>[
|
||||||
if (!globals.terminal.supportsColor)
|
if (!globals.terminal.supportsColor)
|
||||||
'--no-color',
|
'--no-color',
|
||||||
|
if (startPaused)
|
||||||
|
'--pause-after-load',
|
||||||
if (machine)
|
if (machine)
|
||||||
...<String>['-r', 'json']
|
...<String>['-r', 'json']
|
||||||
else
|
else
|
||||||
@ -96,6 +98,7 @@ Future<int> runTests(
|
|||||||
updateGoldens: updateGoldens,
|
updateGoldens: updateGoldens,
|
||||||
shellPath: shellPath,
|
shellPath: shellPath,
|
||||||
flutterProject: flutterProject,
|
flutterProject: flutterProject,
|
||||||
|
pauseAfterLoad: startPaused,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -48,6 +48,31 @@ void main() {
|
|||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
Cache: () => FakeCache(),
|
Cache: () => FakeCache(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testUsingContext('Pipes start-paused to package:test',
|
||||||
|
() async {
|
||||||
|
final FakePackageTest fakePackageTest = FakePackageTest();
|
||||||
|
|
||||||
|
final TestCommand testCommand = TestCommand(testWrapper: fakePackageTest);
|
||||||
|
final CommandRunner<void> commandRunner =
|
||||||
|
createTestCommandRunner(testCommand);
|
||||||
|
|
||||||
|
await commandRunner.run(const <String>[
|
||||||
|
'test',
|
||||||
|
'--no-pub',
|
||||||
|
'--start-paused',
|
||||||
|
'--',
|
||||||
|
'test/fake_test.dart',
|
||||||
|
]);
|
||||||
|
expect(
|
||||||
|
fakePackageTest.lastArgs,
|
||||||
|
contains('--pause-after-load'),
|
||||||
|
);
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
FileSystem: () => fs,
|
||||||
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
|
Cache: () => FakeCache(),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
class FakePackageTest implements TestWrapper {
|
class FakePackageTest implements TestWrapper {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user