Chromium Code Reviews| Index: tools/testing/dart/browser_controller.dart |
| =================================================================== |
| --- tools/testing/dart/browser_controller.dart (revision 29259) |
| +++ tools/testing/dart/browser_controller.dart (working copy) |
| @@ -576,6 +576,44 @@ |
| } |
| +class DartiumOnAndroid extends Browser { |
| + static const String viewAction = 'android.intent.action.VIEW'; |
| + static const String dartiumPackage = 'com.google.android.apps.chrome'; |
| + |
| + AdbDevice _adbDevice; |
| + |
| + DartiumOnAndroid(this._adbDevice); |
| + |
| + Future<bool> start(String url) { |
| + var dartiumIntent = new Intent( |
| + viewAction, dartiumPackage, '.Main', url); |
| + |
| + return _adbDevice.waitForBootCompleted().then((_) { |
| + return _adbDevice.forceStop(dartiumIntent.package); |
| + }).then((_) { |
| + return _adbDevice.killAll(); |
| + }).then((_) { |
| + return _adbDevice.adbRoot(); |
| + }).then((_) { |
| + return _adbDevice.setProp("DART_FORWARDING_PRINT", "1"); |
| + }).then((_) { |
| + return _adbDevice.startActivity(dartiumIntent).then((_) => true); |
| + }); |
| + } |
| + |
| + Future<bool> close() { |
| + if (_adbDevice != null) { |
| + return _adbDevice.forceStop(dartiumPackage).then((_) { |
| + return _adbDevice.killAll().then((_) => true); |
| + }); |
| + } |
| + return new Future.value(true); |
| + } |
| + |
| + String toString() => "DartiumOnAndroid"; |
| +} |
|
kustermann
2013/10/25 19:23:03
We have now three of these classes with similar fu
zra
2013/10/25 21:33:34
I'm not comfortable modifying AndroidChrome since
|
| + |
| + |
| class Firefox extends Browser { |
| static const String enablePopUp = |
| 'user_pref("dom.disable_open_during_load", false);'; |
| @@ -770,6 +808,8 @@ |
| 'chromeOnAndroid' : (AdbDevice device) => new AndroidChrome(device), |
| 'ContentShellOnAndroid' : (AdbDevice device) => |
| new ContentShellOnAndroid(device), |
| + 'DartiumOnAndroid' : (AdbDevice device) => |
| + new DartiumOnAndroid(device), |
| }; |
| if (androidBrowserCreationMapping.containsKey(browserName)) { |
| AdbHelper.listDevices().then((deviceIds) { |
| @@ -894,6 +934,8 @@ |
| browser = new AndroidChrome(adbDeviceMapping[id]); |
| } else if (browserName == 'ContentShellOnAndroid') { |
| browser = new ContentShellOnAndroid(adbDeviceMapping[id]); |
| + } else if (browserName == 'DartiumOnAndroid') { |
| + browser = new DartiumOnAndroid(adbDeviceMapping[id]); |
| } else { |
| browserStatus.remove(id); |
| browser = getInstance(); |