| 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 import inspect | 4 import inspect |
| 5 import os | 5 import os |
| 6 import socket | 6 import socket |
| 7 import sys | 7 import sys |
| 8 import time | 8 import time |
| 9 | 9 |
| 10 | 10 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 tab.ExecuteJavaScript("""window.chrome && chrome.benchmarking && | 107 tab.ExecuteJavaScript("""window.chrome && chrome.benchmarking && |
| 108 chrome.benchmarking.closeConnections()""") | 108 chrome.benchmarking.closeConnections()""") |
| 109 except Exception: | 109 except Exception: |
| 110 pass | 110 pass |
| 111 | 111 |
| 112 | 112 |
| 113 def GetBuildDirectories(): | 113 def GetBuildDirectories(): |
| 114 """Yields all combination of Chromium build output directories.""" | 114 """Yields all combination of Chromium build output directories.""" |
| 115 build_dirs = ['build', | 115 build_dirs = ['build', |
| 116 'out', | 116 'out', |
| 117 'sconsbuild', | |
| 118 'xcodebuild'] | 117 'xcodebuild'] |
| 119 | 118 |
| 120 build_types = ['Debug', 'Debug_x64', 'Release', 'Release_x64'] | 119 build_types = ['Debug', 'Debug_x64', 'Release', 'Release_x64'] |
| 121 | 120 |
| 122 for build_dir in build_dirs: | 121 for build_dir in build_dirs: |
| 123 for build_type in build_types: | 122 for build_type in build_types: |
| 124 yield build_dir, build_type | 123 yield build_dir, build_type |
| 125 | 124 |
| 126 def FindSupportBinary(binary_name): | 125 def FindSupportBinary(binary_name): |
| 127 """Returns the path to the given binary name.""" | 126 """Returns the path to the given binary name.""" |
| 128 # TODO(tonyg/dtu): This should support finding binaries in cloud storage. | 127 # TODO(tonyg/dtu): This should support finding binaries in cloud storage. |
| 129 command = None | 128 command = None |
| 130 command_mtime = 0 | 129 command_mtime = 0 |
| 131 | 130 |
| 132 chrome_root = GetChromiumSrcDir() | 131 chrome_root = GetChromiumSrcDir() |
| 133 for build_dir, build_type in GetBuildDirectories(): | 132 for build_dir, build_type in GetBuildDirectories(): |
| 134 candidate = os.path.join(chrome_root, build_dir, build_type, binary_name) | 133 candidate = os.path.join(chrome_root, build_dir, build_type, binary_name) |
| 135 if os.path.isfile(candidate) and os.access(candidate, os.X_OK): | 134 if os.path.isfile(candidate) and os.access(candidate, os.X_OK): |
| 136 candidate_mtime = os.stat(candidate).st_mtime | 135 candidate_mtime = os.stat(candidate).st_mtime |
| 137 if candidate_mtime > command_mtime: | 136 if candidate_mtime > command_mtime: |
| 138 command = candidate | 137 command = candidate |
| 139 command_mtime = candidate_mtime | 138 command_mtime = candidate_mtime |
| 140 | 139 |
| 141 return command | 140 return command |
| OLD | NEW |