OLD | NEW |
1 #!/usr/bin/python | |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # 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 |
4 # found in the LICENSE file. | 3 # found in the LICENSE file. |
5 | 4 |
6 """Helper functions common to native test runners.""" | 5 """Helper functions common to native test runners.""" |
7 | 6 |
8 import logging | 7 import logging |
9 import optparse | 8 import optparse |
10 import os | 9 import os |
11 import subprocess | 10 import subprocess |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 Returns: | 124 Returns: |
126 True if the port on device is already used, otherwise returns False. | 125 True if the port on device is already used, otherwise returns False. |
127 """ | 126 """ |
128 base_url = '127.0.0.1:%d' % device_port | 127 base_url = '127.0.0.1:%d' % device_port |
129 netstat_results = adb.RunShellCommand('netstat') | 128 netstat_results = adb.RunShellCommand('netstat') |
130 for single_connect in netstat_results: | 129 for single_connect in netstat_results: |
131 # Column 3 is the local address which we want to check with. | 130 # Column 3 is the local address which we want to check with. |
132 if single_connect.split()[3] == base_url: | 131 if single_connect.split()[3] == base_url: |
133 return True | 132 return True |
134 return False | 133 return False |
OLD | NEW |