Files
sdk/tools/testing/dart/launch_browser.dart
T
William Hesse e0f6fdfff1 Refactor testing:TestConfiguration to use smith:Configuration by inclusion.
Change-Id: I5c116ad082a24c25a07b9ceb6aaf8c9cbe3f11e3
Reviewed-on: https://dart-review.googlesource.com/68361
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2018-08-06 16:19:08 +00:00

44 lines
1.3 KiB
Dart

// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/**
* Simple command line interface to launching browsers.
* Uses the browser_controller framework.
* The usage is:
* DARTBIN launch_browser.dart BROWSER_NAME URL
* DARTBIN should be the checked in stable binary.
*/
import 'browser_controller.dart';
import 'configuration.dart';
void printHelp() {
print("Usage pattern:");
print("launch_browser.dart browser url");
print("Supported browsers: ${Browser.SUPPORTED_BROWSERS}");
}
void main(List<String> arguments) {
if (arguments.length != 2) {
print("Wrong number of arguments, please pass in exactly two arguments");
printHelp();
return;
}
var name = arguments[0];
if (!Browser.supportedBrowser(name)) {
print("Specified browser not supported");
printHelp();
return;
}
var runtime = Runtime.find(name);
var configuration = new TestConfiguration(
configuration: new Configuration(
"dummy configuration", null, null, null, runtime, null));
var executable = configuration.browserLocation;
var browser = new Browser.byRuntime(runtime, executable);
browser.start(arguments[1]);
}