@@ -7,11 +7,13 @@ import 'dart:convert';
77import 'dart:io' ;
88
99import 'package:async/async.dart' ;
10- import 'package:path/path.dart' as p;
1110
11+ import '../../backend/test_platform.dart' ;
1212import '../../util/io.dart' ;
1313import '../../utils.dart' ;
14+ import '../executable_settings.dart' ;
1415import 'browser.dart' ;
16+ import 'default_settings.dart' ;
1517
1618final _observatoryRegExp =
1719 new RegExp (r'Observatory listening (?:on|at) ([^ "]+)' );
@@ -30,12 +32,11 @@ class Dartium extends Browser {
3032
3133 final Future <Uri > remoteDebuggerUrl;
3234
33- factory Dartium (url, {String executable, bool debug: false }) {
35+ factory Dartium (url, {ExecutableSettings settings, bool debug: false }) {
36+ settings ?? = defaultSettings[TestPlatform .dartium];
3437 var observatoryCompleter = new Completer <Uri >.sync ();
3538 var remoteDebuggerCompleter = new Completer <Uri >.sync ();
3639 return new Dartium ._(() async {
37- if (executable == null ) executable = _defaultExecutable ();
38-
3940 var tryPort = ([int port]) async {
4041 var dir = createTempDir ();
4142 var args = [
@@ -48,7 +49,7 @@ class Dartium extends Browser {
4849 "--no-default-browser-check" ,
4950 "--disable-default-apps" ,
5051 "--disable-translate"
51- ];
52+ ].. addAll (settings.arguments) ;
5253
5354 if (port != null ) {
5455 args.add ("--remote-debugging-port=$port " );
@@ -62,8 +63,8 @@ class Dartium extends Browser {
6263 args.add ("--vmodule=startup_browser_creator_impl=1" );
6364 }
6465
65- var process = await Process
66- . start (executable, args, environment: {"DART_FLAGS" : "--checked" });
66+ var process = await Process . start (settings.executable, args,
67+ environment: {"DART_FLAGS" : "--checked" });
6768
6869 if (port != null ) {
6970 // Dartium on Windows prints all standard IO to stderr, so we need to
@@ -124,47 +125,6 @@ class Dartium extends Browser {
124125 this .remoteDebuggerUrl)
125126 : super (startBrowser);
126127
127- /// Starts a new instance of Dartium open to the given [url] , which may be a
128- /// [Uri] or a [String] .
129- ///
130- /// If [executable] is passed, it's used as the Dartium executable. Otherwise
131- /// the default executable name for the current OS will be used.
132-
133- /// Return the default executable for the current operating system.
134- static String _defaultExecutable () {
135- var dartium = _executableInEditor ();
136- if (dartium != null ) return dartium;
137- return Platform .isWindows ? "dartium.exe" : "dartium" ;
138- }
139-
140- static String _executableInEditor () {
141- var dir = p.dirname (sdkDir);
142-
143- if (Platform .isWindows) {
144- if (! new File (p.join (dir, "DartEditor.exe" )).existsSync ()) return null ;
145-
146- var dartium = p.join (dir, "chromium\\ chrome.exe" );
147- return new File (dartium).existsSync () ? dartium : null ;
148- }
149-
150- if (Platform .isMacOS) {
151- if (! new File (p.join (dir, "DartEditor.app/Contents/MacOS/DartEditor" ))
152- .existsSync ()) {
153- return null ;
154- }
155-
156- var dartium =
157- p.join (dir, "chromium/Chromium.app/Contents/MacOS/Chromium" );
158- return new File (dartium).existsSync () ? dartium : null ;
159- }
160-
161- assert (Platform .isLinux);
162- if (! new File (p.join (dir, "DartEditor" )).existsSync ()) return null ;
163-
164- var dartium = p.join (dir, "chromium" , "chrome" );
165- return new File (dartium).existsSync () ? dartium : null ;
166- }
167-
168128 // TODO(nweiz): simplify this when sdk#23923 is fixed.
169129 /// Returns the Observatory URL for the Dartium executable with the given
170130 /// [stdout] stream, or `null` if the correct one couldn't be found.
0 commit comments