Chromium Code Reviews| Index: tools/testing/dart/launch_browser.dart |
| =================================================================== |
| --- tools/testing/dart/launch_browser.dart (revision 0) |
| +++ tools/testing/dart/launch_browser.dart (revision 0) |
| @@ -0,0 +1,44 @@ |
| +// 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 launcing browsers. |
|
kustermann
2013/05/29 11:58:00
launcing -> launching
ricow1
2013/05/29 12:08:23
Done.
|
| + * Uses the browser_controller framework. |
| + * The usage is: |
| + * DARTBIN launch_browser.dart BROWSER_NAME URL |
| + * DARTBIN should be the checked in stable binary. |
| + */ |
| + |
| +import "dart:io"; |
| +import "browser_controller.dart"; |
| + |
| + |
| +bool supportedBrowser(String browser) { |
| + return |
| +} |
|
kustermann
2013/05/29 11:58:00
This function can be removed now.
ricow1
2013/05/29 12:08:23
Done.
|
| + |
| +void printHelp() { |
| + print("Usage pattern:"); |
| + print("launch_browser.dart browser url"); |
| + print("Supported browsers: ${Browser.SUPPORTED_BROWSERS}"); |
| +} |
| + |
| +void main() { |
| + var args = new Options().arguments; |
| + if (args.length != 2) { |
| + print("Wrong number of arguments, please pass in exactly two arguments"); |
| + printHelp(); |
| + return; |
| + } |
| + |
| + if (!Browser.supportedBrowser(args[0])) { |
| + print("Specified browser not supported"); |
| + printHelp(); |
| + return; |
| + } |
| + |
| + var browser = new Browser.byName(args[0]); |
| + browser.start(args[1]); |
| + |
| +} |