Skip to content

[tool] the chrome.close can recover if getTab throws a StateError test doesn't verify intended behavior #154857

@andrewkolos

Description

@andrewkolos

Discovered in #154380 (comment).

The test in question:

testWithoutContext('chrome.close can recover if getTab throws a StateError', () async {
final BufferLogger logger = BufferLogger.test();
final FakeChromeConnection chromeConnection = FakeChromeConnection(
maxRetries: 4,
error: StateError('Client is closed.'),
);
final ChromiumLauncher chromiumLauncher = ChromiumLauncher(
fileSystem: fileSystem,
platform: platform,
processManager: processManager,
operatingSystemUtils: operatingSystemUtils,
browserFinder: findChromeExecutable,
logger: logger,
);
final FakeProcess process = FakeProcess();
final Chromium chrome = Chromium(0, chromeConnection, chromiumLauncher: chromiumLauncher, process: process, logger: logger,);
await chrome.close();
expect(logger.errorText, isEmpty);
});

The test is meant to ensure that Chromium.close handles any StateError thrown by the Chromium.connection.getTab call.

However, the StateError provided to the FakeChromeConnection in the test is never thrown, because the argued error is only thrown by calls to getTabs, not getTab.

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listteam-toolOwned by Flutter Tool teamtriaged-toolTriaged by Flutter Tool team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions