mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Validate empty observatory URI for screenshot (#71451)
This commit is contained in:
parent
a5ee7f7cfc
commit
8522ec7e11
@ -77,6 +77,9 @@ class ScreenshotCommand extends FlutterCommand {
|
||||
if (observatoryUri == null) {
|
||||
throwToolExit('Observatory URI must be specified for screenshot type $screenshotType');
|
||||
}
|
||||
if (observatoryUri.isEmpty || Uri.tryParse(observatoryUri) == null) {
|
||||
throwToolExit('Observatory URI "$observatoryUri" is invalid');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -15,8 +15,18 @@ void main() {
|
||||
});
|
||||
|
||||
testUsingContext('rasterizer and skia screenshots require observatory uri', () async {
|
||||
expect(() => ScreenshotCommand.validateOptions('rasterizer', null, null), throwsToolExit());
|
||||
expect(() => ScreenshotCommand.validateOptions('skia', null, null), throwsToolExit());
|
||||
expect(
|
||||
() => ScreenshotCommand.validateOptions('rasterizer', null, null),
|
||||
throwsToolExit(
|
||||
message:
|
||||
'Observatory URI must be specified for screenshot type rasterizer'));
|
||||
expect(
|
||||
() => ScreenshotCommand.validateOptions('skia', null, null),
|
||||
throwsToolExit(
|
||||
message:
|
||||
'Observatory URI must be specified for screenshot type skia'));
|
||||
expect(() => ScreenshotCommand.validateOptions('skia', null, ''),
|
||||
throwsToolExit(message: 'Observatory URI "" is invalid'));
|
||||
});
|
||||
|
||||
testUsingContext('device screenshots require device', () async {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user