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

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

Issue 23679006: Add support for firefox on windows to the browser controller (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 library browser; 4 library browser;
5 5
6 import "dart:async"; 6 import "dart:async";
7 import "dart:convert" show LineSplitter, UTF8; 7 import "dart:convert" show LineSplitter, UTF8;
8 import "dart:core"; 8 import "dart:core";
9 import "dart:io"; 9 import "dart:io";
10 10
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 return _adbDevice.killAll().then((_) => true); 448 return _adbDevice.killAll().then((_) => true);
449 }); 449 });
450 } 450 }
451 return new Future.value(true); 451 return new Future.value(true);
452 } 452 }
453 453
454 String toString() => "chromeOnAndroid"; 454 String toString() => "chromeOnAndroid";
455 } 455 }
456 456
457 class Firefox extends Browser { 457 class Firefox extends Browser {
458 /**
459 * The binary used to run firefox - changing this can be nececcary for
460 * testing or using non standard firefox installation.
461 */
462 static const String binary = "firefox";
463
464 static const String enablePopUp = 458 static const String enablePopUp =
465 'user_pref("dom.disable_open_during_load", false);'; 459 'user_pref("dom.disable_open_during_load", false);';
466 static const String disableDefaultCheck = 460 static const String disableDefaultCheck =
467 'user_pref("browser.shell.checkDefaultBrowser", false);'; 461 'user_pref("browser.shell.checkDefaultBrowser", false);';
468 static const String disableScriptTimeLimit = 462 static const String disableScriptTimeLimit =
469 'user_pref("dom.max_script_run_time", 0);'; 463 'user_pref("dom.max_script_run_time", 0);';
470 464
471 Future _createPreferenceFile(var path) { 465 Future _createPreferenceFile(var path) {
472 var file = new File("${path.toString()}/user.js"); 466 var file = new File("${path.toString()}/user.js");
473 var randomFile = file.openSync(mode: FileMode.WRITE); 467 var randomFile = file.openSync(mode: FileMode.WRITE);
474 randomFile.writeStringSync(enablePopUp); 468 randomFile.writeStringSync(enablePopUp);
475 randomFile.writeStringSync(disableDefaultCheck); 469 randomFile.writeStringSync(disableDefaultCheck);
476 randomFile.writeStringSync(disableScriptTimeLimit); 470 randomFile.writeStringSync(disableScriptTimeLimit);
477 randomFile.close(); 471 randomFile.close();
478 } 472 }
479 473
474 // This is extracted to a function since we may need to support several
475 // locations.
476 String _getWindowsBinary() {
477 return "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe";
478 }
479
480 String _getBinary() {
kustermann 2013/09/06 08:48:49 Why not make it static and do static const String
ricow1 2013/09/06 08:52:34 Sure
481 if (Platform.isWindows) return _getWindowsBinary();
482 if (Platform.isLinux) return 'firefox';
483 }
484
480 485
481 Future<bool> start(String url) { 486 Future<bool> start(String url) {
482 _logEvent("Starting firefox browser on: $url"); 487 _logEvent("Starting firefox browser on: $url");
488 var binary = _getBinary();
483 // Get the version and log that. 489 // Get the version and log that.
484 return Process.run(binary, ["--version"]).then((var versionResult) { 490 return Process.run(binary, ["--version"]).then((var versionResult) {
485 if (versionResult.exitCode != 0) { 491 if (versionResult.exitCode != 0) {
486 _logEvent("Failed to firefox get version"); 492 _logEvent("Failed to firefox get version");
487 _logEvent("Make sure $binary is a valid program for running firefox"); 493 _logEvent("Make sure $binary is a valid program for running firefox");
488 return new Future.value(false); 494 return new Future.value(false);
489 } 495 }
490 version = versionResult.stdout; 496 version = versionResult.stdout;
491 _logEvent("Got version: $version"); 497 _logEvent("Got version: $version");
492 498
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 Dart test driver, number of tests: <div id="number"></div><br> 1143 Dart test driver, number of tests: <div id="number"></div><br>
1138 Currently executing: <div id="currently_executing"></div><br> 1144 Currently executing: <div id="currently_executing"></div><br>
1139 Unhandled error: <div id="unhandled_error"></div> 1145 Unhandled error: <div id="unhandled_error"></div>
1140 <iframe id="embedded_iframe"></iframe> 1146 <iframe id="embedded_iframe"></iframe>
1141 </body> 1147 </body>
1142 </html> 1148 </html>
1143 """; 1149 """;
1144 return driverContent; 1150 return driverContent;
1145 } 1151 }
1146 } 1152 }
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