| OLD | NEW |
| 1 # Copyright (c) 2011 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 """Helper functions common to native test runners.""" | 5 """Helper functions common to native test runners.""" |
| 6 | 6 |
| 7 import logging | 7 import logging |
| 8 import optparse | 8 import optparse |
| 9 import os | 9 import os |
| 10 import subprocess | 10 import subprocess |
| 11 import sys | 11 import sys |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 Returns: | 124 Returns: |
| 125 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. |
| 126 """ | 126 """ |
| 127 base_url = '127.0.0.1:%d' % device_port | 127 base_url = '127.0.0.1:%d' % device_port |
| 128 netstat_results = adb.RunShellCommand('netstat') | 128 netstat_results = adb.RunShellCommand('netstat') |
| 129 for single_connect in netstat_results: | 129 for single_connect in netstat_results: |
| 130 # 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. |
| 131 if single_connect.split()[3] == base_url: | 131 if single_connect.split()[3] == base_url: |
| 132 return True | 132 return True |
| 133 return False | 133 return False |
| OLD | NEW |