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

Side by Side Diff: build/android/emulator.py

Issue 10781032: restarting adb server before each testing start will cause conflict for multiple emulators (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Provides an interface to start and stop Android emulator. 7 """Provides an interface to start and stop Android emulator.
8 8
9 Assumes system environment ANDROID_NDK_ROOT has been set. 9 Assumes system environment ANDROID_NDK_ROOT has been set.
10 10
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 if new_avd_name: 142 if new_avd_name:
143 self.default_avd = False 143 self.default_avd = False
144 self.avd = self._CreateAVD(new_avd_name) 144 self.avd = self._CreateAVD(new_avd_name)
145 145
146 def _DeviceName(self): 146 def _DeviceName(self):
147 """Return our device name.""" 147 """Return our device name."""
148 port = _GetAvailablePort() 148 port = _GetAvailablePort()
149 return ('emulator-%d' % port, port) 149 return ('emulator-%d' % port, port)
150 150
151 def _CreateAVD(self, avd_name): 151 def _CreateAVD(self, avd_name):
152 avd_command = [ 152 avd_command = [
John Grabowski 2012/07/17 18:09:22 add docstring. doc return values.
Wei James(wistoch) 2012/07/20 04:07:01 fixed. thanks
153 self.android, 153 self.android,
154 '--silent', 154 '--silent',
155 'create', 'avd', 155 'create', 'avd',
156 '--name', avd_name, 156 '--name', avd_name,
157 '--abi', self.abi, 157 '--abi', self.abi,
158 '--target', 'android-15', 158 '--target', 'android-15',
159 '-c', '64M', 159 '-c', '64M',
160 '--force', 160 '--force',
161 ] 161 ]
162 avd_process = subprocess.Popen(args=avd_command, 162 avd_process = subprocess.Popen(args=avd_command,
163 stdin=subprocess.PIPE, 163 stdin=subprocess.PIPE,
164 stdout=subprocess.PIPE, 164 stdout=subprocess.PIPE,
165 stderr=subprocess.STDOUT) 165 stderr=subprocess.STDOUT)
166 avd_process.stdin.write('no\n') 166 avd_process.stdin.write('no\n')
167 avd_process.wait() 167 avd_process.wait()
168 logging.info('Create AVD command: %s', ' '.join(avd_command)) 168 logging.info('Create AVD command: %s', ' '.join(avd_command))
169 return self.avd 169 return avd_name
170 170
171 def _DeleteAVD(self): 171 def _DeleteAVD(self):
172 avd_command = [ 172 avd_command = [
173 self.android, 173 self.android,
174 '--silent', 174 '--silent',
175 'delete', 175 'delete',
176 'avd', 176 'avd',
177 '--name', self.avd, 177 '--name', self.avd,
178 ] 178 ]
179 avd_process = subprocess.Popen(args=avd_command, 179 avd_process = subprocess.Popen(args=avd_command,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 """Install a handler to kill the emulator when we exit unexpectedly.""" 289 """Install a handler to kill the emulator when we exit unexpectedly."""
290 for sig in self._SIGNALS: 290 for sig in self._SIGNALS:
291 signal.signal(sig, self._ShutdownOnSignal) 291 signal.signal(sig, self._ShutdownOnSignal)
292 292
293 def main(argv): 293 def main(argv):
294 Emulator(None, True).Launch(True) 294 Emulator(None, True).Launch(True)
295 295
296 296
297 if __name__ == '__main__': 297 if __name__ == '__main__':
298 main(sys.argv) 298 main(sys.argv)
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/android_commands.py » ('j') | build/android/pylib/android_commands.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698