Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1175)

Unified Diff: tools/testing/dart/browser_controller.dart

Issue 2069243002: Fix analyzer warnings for browser_controller. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/browser_controller.dart
diff --git a/tools/testing/dart/browser_controller.dart b/tools/testing/dart/browser_controller.dart
index 7094120661ad9d45ee880021dce68a5be28e1d92..76124f2b75dc7b49da03b3868d23a3823cace6a3 100644
--- a/tools/testing/dart/browser_controller.dart
+++ b/tools/testing/dart/browser_controller.dart
@@ -504,13 +504,32 @@ class SafariMobileSimulator extends Safari {
"Library/Application Support/iPhone Simulator/7.1/Applications"
];
+ // Helper function to delete many directories recursively.
+ Future<bool> deleteIfExists(Iterable<String> paths) async {
+ for (var path in paths) {
+ Directory directory = new Directory(path);
+ if (await directory.exists()) {
+ _logEvent("Deleting $path");
+ try {
+ await directory.delete(recursive: true);
+ } catch (error) {
+ _logEvent("Failure trying to delete $path: $error");
+ return false;
+ }
+ } else {
+ _logEvent("$path is not present");
+ }
+ }
+ return true;
+ }
+
// Clears the cache if the static resetBrowserConfiguration flag is set.
// Returns false if the command to actually clear the cache did not complete.
Future<bool> resetConfiguration() {
if (!Browser.resetBrowserConfiguration) return new Future.value(true);
var home = Platform.environment['HOME'];
- Iterator iterator = CACHE_DIRECTORIES.map((s) => "$home/$s").iterator;
- return deleteIfExists(iterator);
+ var paths = CACHE_DIRECTORIES.map((s) => "$home/$s");
+ return deleteIfExists(paths);
}
Future<bool> start(String url) {
@@ -902,7 +921,7 @@ class BrowserTestRunner {
final String localIp;
final String browserName;
- final int maxNumBrowsers;
+ int maxNumBrowsers;
final bool checkedMode;
int numBrowsers = 0;
// Used to send back logs from the browser (start, stop etc)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698