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

Unified Diff: tools/testing/dart/browser_controller.dart

Issue 15904008: Add factory constructor to browser controller. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/testing/dart/test_runner.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/browser_controller.dart
===================================================================
--- tools/testing/dart/browser_controller.dart (revision 23334)
+++ tools/testing/dart/browser_controller.dart (working copy)
@@ -52,7 +52,21 @@
// We use this to gracefully handle double calls to close.
bool underTermination = false;
+
+ Browser();
+ factory Browser.byName(String name) {
+ if (name == 'ff' || name == 'firefox') {
+ return new FireFox();
+ } else if (name == 'chrome') {
+ return new Chrome();
+ } else if (name == 'safari') {
+ return new Safari();
+ } else {
+ throw "Non supported browser";
+ }
+ }
+
void _logEvent(String event) {
String toLog = "$this ($id) - ${new DateTime.now()}: $event \n";
if (debugPrint) print("usageLog: $toLog");
@@ -719,16 +733,7 @@
}
Browser getInstance() {
- var browser;
- if (browserName == "chrome") {
- browser = new Chrome();
- } else if (browserName == "ff") {
- browser = new Firefox();
- } else if (browserName == "safari") {
- browser = new Safari();
- } else {
- throw "Non supported browser for browser controller";
- }
+ var browser = new Browser.byName(browserName);
browser.logger = logger;
return browser;
}
« no previous file with comments | « no previous file | tools/testing/dart/test_runner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698