-
Notifications
You must be signed in to change notification settings - Fork 6k
[web] enable always_specify_types lint #27406
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -76,20 +76,20 @@ abstract class Browser { | |||||
| /// | ||||||
| /// This will fire once the process has started successfully. | ||||||
| Future<Process> get _process => _processCompleter.future; | ||||||
| final _processCompleter = Completer<Process>(); | ||||||
| final Completer<Process> _processCompleter = Completer<Process>(); | ||||||
|
|
||||||
| /// Whether [close] has been called. | ||||||
| var _closed = false; | ||||||
| bool _closed = false; | ||||||
|
|
||||||
| /// A future that completes when the browser exits. | ||||||
| /// | ||||||
| /// If there's a problem starting or running the browser, this will complete | ||||||
| /// with an error. | ||||||
| Future<void> get onExit => _onExitCompleter.future; | ||||||
| final _onExitCompleter = Completer<void>(); | ||||||
| final Completer<void> _onExitCompleter = Completer<void>(); | ||||||
|
|
||||||
| /// Standard IO streams for the underlying browser process. | ||||||
| final _ioSubscriptions = <StreamSubscription>[]; | ||||||
| final List<StreamSubscription<void>> _ioSubscriptions = <StreamSubscription<void>>[]; | ||||||
|
|
||||||
| /// Creates a new browser. | ||||||
| /// | ||||||
|
|
@@ -102,10 +102,10 @@ abstract class Browser { | |||||
| // for the process to actually start. They should just wait for the HTTP | ||||||
| // request instead. | ||||||
| runZonedGuarded(() async { | ||||||
| var process = await startBrowser(); | ||||||
| Process process = await startBrowser(); | ||||||
| _processCompleter.complete(process); | ||||||
|
|
||||||
| var output = Uint8Buffer(); | ||||||
| Uint8Buffer output = Uint8Buffer(); | ||||||
| void drainOutput(Stream<List<int>> stream) { | ||||||
| try { | ||||||
| _ioSubscriptions | ||||||
|
|
@@ -117,7 +117,7 @@ abstract class Browser { | |||||
| drainOutput(process.stdout); | ||||||
| drainOutput(process.stderr); | ||||||
|
|
||||||
| var exitCode = await process.exitCode; | ||||||
| int exitCode = await process.exitCode; | ||||||
|
|
||||||
| // This hack dodges an otherwise intractable race condition. When the user | ||||||
| // presses Control-C, the signal is sent to the browser and the test | ||||||
|
|
@@ -134,8 +134,8 @@ abstract class Browser { | |||||
| } | ||||||
|
|
||||||
| if (!_closed && exitCode != 0) { | ||||||
| var outputString = utf8.decode(output); | ||||||
| var message = '$name failed with exit code $exitCode.'; | ||||||
| String outputString = utf8.decode(output); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| String message = '$name failed with exit code $exitCode.'; | ||||||
| if (outputString.isNotEmpty) { | ||||||
| message += '\nStandard output:\n$outputString'; | ||||||
| } | ||||||
|
|
@@ -151,7 +151,7 @@ abstract class Browser { | |||||
| } | ||||||
|
|
||||||
| // Make sure the process dies even if the error wasn't fatal. | ||||||
| _process.then((process) => process.kill()); | ||||||
| _process.then((Process process) => process.kill()); | ||||||
|
|
||||||
| if (stackTrace == null) { | ||||||
| stackTrace = Trace.current(); | ||||||
|
|
@@ -170,13 +170,13 @@ abstract class Browser { | |||||
| /// | ||||||
| /// Returns the same [Future] as [onExit], except that it won't emit | ||||||
| /// exceptions. | ||||||
| Future close() async { | ||||||
| Future<void> close() async { | ||||||
| _closed = true; | ||||||
|
|
||||||
| // If we don't manually close the stream the test runner can hang. | ||||||
| // For example this happens with Chrome Headless. | ||||||
| // See SDK issue: https://github.com/dart-lang/sdk/issues/31264 | ||||||
| for (var stream in _ioSubscriptions) { | ||||||
| for (StreamSubscription<void> stream in _ioSubscriptions) { | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| unawaited(stream.cancel()); | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -192,7 +192,7 @@ abstract class ScreenshotManager { | |||||
| /// Capture a screenshot. | ||||||
| /// | ||||||
| /// Please read the details for the implementing classes. | ||||||
| Future<Image> capture(math.Rectangle region); | ||||||
| Future<Image> capture(math.Rectangle<num> region); | ||||||
|
|
||||||
| /// Suffix to be added to the end of the filename. | ||||||
| /// | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -51,7 +51,7 @@ class ChromeEnvironment implements BrowserEnvironment { | |||||
| /// Any errors starting or running the process are reported through [onExit]. | ||||||
| class Chrome extends Browser { | ||||||
| @override | ||||||
| final name = 'Chrome'; | ||||||
| final String name = 'Chrome'; | ||||||
|
|
||||||
| @override | ||||||
| final Future<Uri> remoteDebuggerUrl; | ||||||
|
|
@@ -60,7 +60,7 @@ class Chrome extends Browser { | |||||
| /// [Uri] or a [String]. | ||||||
| factory Chrome(Uri url, {bool debug = false}) { | ||||||
| String version = ChromeArgParser.instance.version; | ||||||
| var remoteDebuggerCompleter = Completer<Uri>.sync(); | ||||||
| Completer<Uri> remoteDebuggerCompleter = Completer<Uri>.sync(); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| return Chrome._(() async { | ||||||
| final BrowserInstallation installation = await getOrInstallChrome( | ||||||
| version, | ||||||
|
|
@@ -80,7 +80,7 @@ class Chrome extends Browser { | |||||
| final bool isChromeNoSandbox = | ||||||
| Platform.environment['CHROME_NO_SANDBOX'] == 'true'; | ||||||
| final String dir = environment.webUiDartToolDir.createTempSync('test_chrome_user_data_').resolveSymbolicLinksSync(); | ||||||
| var args = [ | ||||||
| List<String> args = <String>[ | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| '--user-data-dir=$dir', | ||||||
| url.toString(), | ||||||
| if (!debug) | ||||||
|
|
@@ -218,7 +218,7 @@ class ChromeScreenshotManager extends ScreenshotManager { | |||||
| /// [region] is used to decide which part of the web content will be used in | ||||||
| /// test image. It includes starting coordinate x,y as well as height and | ||||||
| /// width of the area to capture. | ||||||
| Future<Image> capture(math.Rectangle? region) async { | ||||||
| Future<Image> capture(math.Rectangle<num>? region) async { | ||||||
| final wip.ChromeConnection chromeConnection = | ||||||
| wip.ChromeConnection('localhost', kDevtoolsPort); | ||||||
| final wip.ChromeTab? chromeTab = await chromeConnection.getTab( | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -221,7 +221,7 @@ class DevNull implements StringSink { | |
| void write(Object? obj) {} | ||
|
|
||
| @override | ||
| void writeAll(Iterable objects, [String separator = ""]) {} | ||
| void writeAll(Iterable<dynamic> objects, [String separator = ""]) {} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
|
||
| @override | ||
| void writeCharCode(int charCode) {} | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -42,7 +42,7 @@ class EdgeEnvironment implements BrowserEnvironment { | |||||
| /// Any errors starting or running the process are reported through [onExit]. | ||||||
| class Edge extends Browser { | ||||||
| @override | ||||||
| final name = 'Edge'; | ||||||
| final String name = 'Edge'; | ||||||
|
|
||||||
| /// Starts a new instance of Safari open to the given [url], which may be a | ||||||
| /// [Uri] or a [String]. | ||||||
|
|
@@ -63,8 +63,10 @@ class Edge extends Browser { | |||||
| pathToOpen = pathToOpen.substring(0, index-1); | ||||||
| } | ||||||
|
|
||||||
| var process = | ||||||
| await Process.start(installation.executable, ['$pathToOpen','-k']); | ||||||
| Process process = await Process.start( | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| installation.executable, | ||||||
| <String>['$pathToOpen','-k'], | ||||||
| ); | ||||||
|
|
||||||
| return process; | ||||||
| }); | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -47,7 +47,7 @@ class FirefoxEnvironment implements BrowserEnvironment { | |||||
| /// Any errors starting or running the process are reported through [onExit]. | ||||||
| class Firefox extends Browser { | ||||||
| @override | ||||||
| final name = 'Firefox'; | ||||||
| final String name = 'Firefox'; | ||||||
|
|
||||||
| @override | ||||||
| final Future<Uri> remoteDebuggerUrl; | ||||||
|
|
@@ -56,15 +56,15 @@ class Firefox extends Browser { | |||||
| /// [Uri] or a [String]. | ||||||
| factory Firefox(Uri url, {bool debug = false}) { | ||||||
| final String version = FirefoxArgParser.instance.version; | ||||||
| var remoteDebuggerCompleter = Completer<Uri>.sync(); | ||||||
| Completer<Uri> remoteDebuggerCompleter = Completer<Uri>.sync(); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| return Firefox._(() async { | ||||||
| final BrowserInstallation installation = await getOrInstallFirefox( | ||||||
| version, | ||||||
| infoLog: isCirrus ? stdout : DevNull(), | ||||||
| ); | ||||||
|
|
||||||
| // Using a profile on opening will prevent popups related to profiles. | ||||||
| final _profile = ''' | ||||||
| final String _profile = ''' | ||||||
| user_pref("browser.shell.checkDefaultBrowser", false); | ||||||
| user_pref("dom.disable_open_during_load", false); | ||||||
| user_pref("dom.max_script_run_time", 0); | ||||||
|
|
@@ -84,7 +84,7 @@ user_pref("dom.max_script_run_time", 0); | |||||
| File(path.join(temporaryProfileDirectory.path, 'prefs.js')) | ||||||
| .writeAsStringSync(_profile); | ||||||
| bool isMac = Platform.isMacOS; | ||||||
| var args = [ | ||||||
| List<String> args = <String>[ | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| url.toString(), | ||||||
| '--profile', | ||||||
| '${temporaryProfileDirectory.path}', | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is unrelated to your PR, but could this become
final?