Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(598)

Side by Side Diff: tools/testing/dart/launch_browser.dart

Issue 15963007: Add browser launching functionality. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 /**
6 * Simple command line interface to launcing browsers.
7 * Uses the browser_controller framework.
8 * The usage is:
9 * DARTBIN launch_browser.dart BROWSER_NAME URL
kustermann 2013/05/29 11:02:34 You could add a comment that DARTBIN should be the
ricow1 2013/05/29 11:46:31 Done.
10 */
11
12 import "dart:io";
13 import "browser_controller.dart";
14
15 const List<String> SUPPORTED_BROWSERS =
16 const ['safari', 'ff', 'chrome'];
kustermann 2013/05/29 11:02:34 Please add a TODO for me to make this work with an
ricow1 2013/05/29 11:46:31 Done.
17
18 bool supportedBrowser(String browser) {
19 return SUPPORTED_BROWSERS.contains(browser);
20 }
21
22 void printHelp() {
23 print("""
24 Usage pattern:
25 launch_browser browser url
26 Supported browsers: $SUPPORTED_BROWSERS
27 """);
kustermann 2013/05/29 11:02:34 If you use three strings, you can indent then corr
ricow1 2013/05/29 11:46:31 Done.
28 }
29
30 void main() {
31 var args = new Options().arguments;
32 if (args.length != 2) {
33 print("Wrong number of arguments, please pass in exactly two arguments");
34 printHelp();
35 return;
36 }
37 if (!supportedBrowser(args[0])) {
38 print("Specified browser not supported");
39 printHelp();
40 return;
41 }
42 var browser = new Browser.byName(args[0]);
43 browser.start(args[1]);
44
45 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698