Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """TestEnvironment classes. | 5 """TestEnvironment classes. |
| 6 | 6 |
| 7 These classes abstract away the various setups needed to run the WebDriver java | 7 These classes abstract away the various setups needed to run the WebDriver java |
| 8 tests in various environments. | 8 tests in various environments. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 def __init__(self, chrome_version='HEAD'): | 87 def __init__(self, chrome_version='HEAD'): |
| 88 super(AndroidTestEnvironment, self).__init__(chrome_version) | 88 super(AndroidTestEnvironment, self).__init__(chrome_version) |
| 89 self._adb = None | 89 self._adb = None |
| 90 self._forwarder = None | 90 self._forwarder = None |
| 91 | 91 |
| 92 # override | 92 # override |
| 93 def GlobalSetUp(self): | 93 def GlobalSetUp(self): |
| 94 os.putenv('TEST_HTTP_PORT', str(ANDROID_TEST_HTTP_PORT)) | 94 os.putenv('TEST_HTTP_PORT', str(ANDROID_TEST_HTTP_PORT)) |
| 95 os.putenv('TEST_HTTPS_PORT', str(ANDROID_TEST_HTTPS_PORT)) | 95 os.putenv('TEST_HTTPS_PORT', str(ANDROID_TEST_HTTPS_PORT)) |
| 96 self._adb = android_commands.AndroidCommands() | 96 self._adb = android_commands.AndroidCommands() |
| 97 self._forwarder = forwarder.Forwarder(self._adb, 'Debug') | 97 forwarder.Forwarder.Map( |
|
frankf
2013/07/15 22:23:22
Same here.
Philippe
2013/07/16 12:31:21
Done.
| |
| 98 self._forwarder.Run( | |
| 99 [(ANDROID_TEST_HTTP_PORT, ANDROID_TEST_HTTP_PORT), | 98 [(ANDROID_TEST_HTTP_PORT, ANDROID_TEST_HTTP_PORT), |
| 100 (ANDROID_TEST_HTTPS_PORT, ANDROID_TEST_HTTPS_PORT)], | 99 (ANDROID_TEST_HTTPS_PORT, ANDROID_TEST_HTTPS_PORT)], |
| 101 valgrind_tools.BaseTool()) | 100 self._adb) |
| 102 | 101 |
| 103 # override | 102 # override |
| 104 def GlobalTearDown(self): | 103 def GlobalTearDown(self): |
| 105 if self._adb is not None: | 104 for device_port in [ANDROID_TEST_HTTP_PORT, ANDROID_TEST_HTTPS_PORT]: |
| 106 forwarder.Forwarder.KillDevice(self._adb, valgrind_tools.BaseTool()) | 105 forwarder.Forwarder.UnmapDevicePort(device_port, self._adb) |
| 107 if self._forwarder is not None: | |
| 108 self._forwarder.Close() | |
| 109 | 106 |
| 110 # override | 107 # override |
| 111 def GetOS(self): | 108 def GetOS(self): |
| 112 return 'android' | 109 return 'android' |
| OLD | NEW |