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 forwarder.Forwarder.KillHost('Debug') | 97 forwarder.Forwarder.Map( |
98 self._forwarder = forwarder.Forwarder(self._adb, 'Debug') | |
99 self._forwarder.Run( | |
100 [(ANDROID_TEST_HTTP_PORT, ANDROID_TEST_HTTP_PORT), | 98 [(ANDROID_TEST_HTTP_PORT, ANDROID_TEST_HTTP_PORT), |
101 (ANDROID_TEST_HTTPS_PORT, ANDROID_TEST_HTTPS_PORT)], | 99 (ANDROID_TEST_HTTPS_PORT, ANDROID_TEST_HTTPS_PORT)], |
102 valgrind_tools.BaseTool()) | 100 self._adb) |
103 | 101 |
104 # override | 102 # override |
105 def GlobalTearDown(self): | 103 def GlobalTearDown(self): |
106 if self._adb is not None: | 104 forwarder.Forwarder.UnmapAllDevicePorts(self._adb) |
107 forwarder.Forwarder.KillDevice(self._adb, valgrind_tools.BaseTool()) | |
108 if self._forwarder is not None: | |
109 self._forwarder.Close() | |
110 | 105 |
111 # override | 106 # override |
112 def GetOS(self): | 107 def GetOS(self): |
113 return 'android' | 108 return 'android' |
OLD | NEW |