From 441a62a4021aa35bdb9500103cd3972de0dde362 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Mon, 24 Oct 2016 12:36:48 -0700 Subject: [PATCH] Support an environment-specified VM service URL (#6497) If a URL is not explicitly specified by the test author, check for an environment-specified URL before falling back to the default value. --- packages/flutter_driver/lib/src/driver.dart | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/flutter_driver/lib/src/driver.dart b/packages/flutter_driver/lib/src/driver.dart index 4627c6761e..cca94da083 100644 --- a/packages/flutter_driver/lib/src/driver.dart +++ b/packages/flutter_driver/lib/src/driver.dart @@ -73,9 +73,13 @@ class FlutterDriver { /// /// Resumes the application if it is currently paused (e.g. at a breakpoint). /// - /// [dartVmServiceUrl] is the URL to Dart observatory (a.k.a. VM service). By - /// default it connects to `http://localhost:8183`. - static Future connect({String dartVmServiceUrl: 'http://localhost:8183'}) async { + /// [dartVmServiceUrl] is the URL to Dart observatory (a.k.a. VM service). If + /// not specified, the URL specified by the `VM_SERVICE_URL` environment + /// variable is used, or 'http://localhost:8183'. + static Future connect({String dartVmServiceUrl}) async { + dartVmServiceUrl ??= Platform.environment['VM_SERVICE_URL']; + dartVmServiceUrl ??= 'http://localhost:8183'; + // Connect to Dart VM servcies _log.info('Connecting to Flutter application at $dartVmServiceUrl'); VMServiceClientConnection connection = await vmServiceConnectFunction(dartVmServiceUrl);