// 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 'package:test_runner/src/browser_controller.dart';
import 'package:test_runner/src/configuration.dart';

void printHelp() {
  print("Usage pattern:");
  print("launch_browser.dart browser url");
  print("Supported browsers: ${Browser.supportedBrowsers}");
}

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 = TestConfiguration(
      configuration: Configuration(
          "dummy configuration", null, null, null, runtime, null));
  var executable = configuration.browserLocation;
  var browser = Browser.byRuntime(runtime, executable);
  browser.start(arguments[1]);
}

// 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 'package:test_runner/src/browser_controller.dart';
import 'package:test_runner/src/configuration.dart';

void printHelp() {
  print("Usage pattern:");
  print("launch_browser.dart browser url");
  print("Supported browsers: ${Browser.supportedBrowsers}");
}

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 = TestConfiguration(
      configuration: Configuration(
          "dummy-configuration", null, null, null, runtime, null));
  var executable = configuration.browserLocation;
  var browser = Browser.byRuntime(runtime, executable);
  browser.start(arguments[1]);
}

Replace space from test config name
[pkg:test_runner] Replace space from test config name

https://dart-review.googlesource.com/c/sdk/+/181404 disallows spaces
in Configurations.

Change-Id: I0582eca064bd6d88ebcbbf411e44a6147895148c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184902
Auto-Submit: Srujan Gaddam <4175f2f2dd3cde6c8ffb10fc9674dc09abf813fe@google.com>
Commit-Queue: William Hesse <a821cddceae7dc400f272e3cb1a72f400f9fed6d@google.com>
Reviewed-by: William Hesse <a821cddceae7dc400f272e3cb1a72f400f9fed6d@google.com>
