Chromium Code Reviews| Index: tools/testing/dart/browser_controller.dart |
| =================================================================== |
| --- tools/testing/dart/browser_controller.dart (revision 28998) |
| +++ tools/testing/dart/browser_controller.dart (working copy) |
| @@ -531,6 +531,44 @@ |
| String toString() => "chromeOnAndroid"; |
| } |
| + |
| +class drtOnAndroid extends Browser { |
|
kustermann
2013/10/24 09:36:00
drtOnAndroid => DrtOnAndroid
Since drt has been r
zra
2013/10/24 15:34:50
Renamed ContentShellOnAndroid
|
| + static const String viewAction = 'android.intent.action.VIEW'; |
| + static const String contentShellPackage = 'org.chromium.content_shell_apk'; |
| + |
| + AndroidEmulator _emulator; |
|
kustermann
2013/10/24 09:36:00
Where is this _emulator set / used ?
Did you try
zra
2013/10/24 15:34:50
Removed
|
| + AdbDevice _adbDevice; |
| + |
| + drtOnAndroid(this._adbDevice); |
| + |
| + Future<bool> start(String url) { |
| + var contentShellIntent = new Intent( |
| + viewAction, contentShellPackage, '.ContentShellActivity', url); |
| + |
| + return _adbDevice.waitForBootCompleted().then((_) { |
| + return _adbDevice.forceStop(contentShellIntent.package); |
| + }).then((_) { |
| + return _adbDevice.killAll(); |
| + }).then((_) { |
| + return _adbDevice.setProp("DART_FORWARDING_PRINT", "1"); |
|
kustermann
2013/10/24 09:36:00
Are you sure that a 'adb shell setprop' is setting
zra
2013/10/24 15:34:50
In a separate CL (https://codereview.chromium.org/
|
| + }).then((_) { |
| + return _adbDevice.startActivity(contentShellIntent).then((_) => true); |
| + }); |
| + } |
| + |
| + Future<bool> close() { |
| + if (_adbDevice != null) { |
| + return _adbDevice.forceStop(contentShellPackage).then((_) { |
| + return _adbDevice.killAll().then((_) => true); |
| + }); |
| + } |
| + return new Future.value(true); |
| + } |
| + |
| + String toString() => "drtOnAndroid"; |
| +} |
| + |
| + |
| class Firefox extends Browser { |
| static const String enablePopUp = |
| 'user_pref("dom.disable_open_during_load", false);'; |
| @@ -690,7 +728,8 @@ |
| // instead. |
| bool useIframe = |
| !Browser.BROWSERS_WITH_WINDOW_SUPPORT.contains(browserName); |
| - testingServer = new BrowserTestingServer(localIp, useIframe); |
| + testingServer = new BrowserTestingServer( |
| + globalConfiguration, localIp, useIframe); |
| return testingServer.start().then((_) { |
| testingServer.testDoneCallBack = handleResults; |
| testingServer.testStartedCallBack = handleStarted; |
| @@ -736,6 +775,24 @@ |
| throw new StateError("No android devices found."); |
| } |
| }); |
| + } else if (browserName == 'drtOnAndroid') { |
|
kustermann
2013/10/24 09:36:00
There is no reason to duplicate this code. You cou
zra
2013/10/24 15:34:50
Done.
|
| + AdbHelper.listDevices().then((deviceIds) { |
| + if (deviceIds.length > 0) { |
| + var browsers = []; |
| + for (int i = 0; i < deviceIds.length; i++) { |
| + var id = "BROWSER$i"; |
| + var device = new AdbDevice(deviceIds[i]); |
| + adbDeviceMapping[id] = device; |
| + var browser = new drtOnAndroid(device); |
| + browsers.add(browser); |
| + // We store this in case we need to kill the browser. |
| + browser.id = id; |
| + } |
| + browsersCompleter.complete(browsers); |
| + } else { |
| + throw new StateError("No android devices found."); |
| + } |
| + }); |
| } else { |
| var browsers = []; |
| for (int i = 0; i < maxNumBrowsers; i++) { |
| @@ -839,6 +896,8 @@ |
| var new_id = id; |
| if (browserName == 'chromeOnAndroid') { |
| browser = new AndroidChrome(adbDeviceMapping[id]); |
| + } else if (browserName == 'drtOnAndroid') { |
| + browser = new drtOnAndroid(adbDeviceMapping[id]); |
| } else { |
| browserStatus.remove(id); |
| browser = getInstance(); |
| @@ -954,6 +1013,7 @@ |
| } |
| class BrowserTestingServer { |
| + final Map globalConfiguration; |
| /// Interface of the testing server: |
| /// |
| /// GET /driver/BROWSER_ID -- This will get the driver page to fetch |
| @@ -985,10 +1045,11 @@ |
| Function testStartedCallBack; |
| Function nextTestCallBack; |
| - BrowserTestingServer(this.localIp, this.useIframe); |
| + BrowserTestingServer(this.globalConfiguration, this.localIp, this.useIframe); |
| Future start() { |
| - return HttpServer.bind(localIp, 0).then((createdServer) { |
| + int port = int.parse(globalConfiguration['test_driver_port']); |
| + return HttpServer.bind(localIp, port).then((createdServer) { |
| httpServer = createdServer; |
| void handler(HttpRequest request) { |
| // Don't allow caching of resources from the browser controller, i.e., |
| @@ -1039,7 +1100,8 @@ |
| // Set up the error reporting server that enables us to send back |
| // errors from the browser. |
| - return HttpServer.bind(localIp, 0).then((createdReportServer) { |
| + port = int.parse(globalConfiguration['test_driver_error_port']); |
| + return HttpServer.bind(localIp, port).then((createdReportServer) { |
| errorReportingServer = createdReportServer; |
| void errorReportingHandler(HttpRequest request) { |
| StringBuffer buffer = new StringBuffer(); |