| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/python | |
| 2 # 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 | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 """Common paths for pyauto tests.""" | |
| 7 | |
| 8 import os | |
| 9 import sys | |
| 10 | |
| 11 | |
| 12 def GetSourceDir(): | |
| 13 """Returns src/ directory.""" | |
| 14 script_dir = os.path.abspath(os.path.dirname(__file__)) | |
| 15 return os.path.join(script_dir, os.pardir, os.pardir, os.pardir) | |
| 16 | |
| 17 | |
| 18 def GetThirdPartyDir(): | |
| 19 """Returns src/third_party directory.""" | |
| 20 return os.path.join(GetSourceDir(), 'third_party') | |
| 21 | |
| 22 | |
| 23 def GetBuildDirs(): | |
| 24 """Returns list of possible build directories.""" | |
| 25 build_dirs = { | |
| 26 'linux2': [ os.path.join('out', 'Debug'), | |
| 27 os.path.join('sconsbuild', 'Debug'), | |
| 28 os.path.join('out', 'Release'), | |
| 29 os.path.join('sconsbuild', 'Release')], | |
| 30 'linux3': [ os.path.join('out', 'Debug'), | |
| 31 os.path.join('sconsbuild', 'Debug'), | |
| 32 os.path.join('out', 'Release'), | |
| 33 os.path.join('sconsbuild', 'Release')], | |
| 34 'darwin': [ os.path.join('xcodebuild', 'Debug'), | |
| 35 os.path.join('xcodebuild', 'Release')], | |
| 36 'win32': [ os.path.join('chrome', 'Debug'), | |
| 37 os.path.join('build', 'Debug'), | |
| 38 os.path.join('chrome', 'Release'), | |
| 39 os.path.join('build', 'Release')], | |
| 40 'cygwin': [ os.path.join('chrome', 'Debug'), | |
| 41 os.path.join('chrome', 'Release')], | |
| 42 } | |
| 43 src_dir = GetSourceDir() | |
| 44 return map(lambda dir: os.path.join(src_dir, dir), | |
| 45 build_dirs.get(sys.platform, [])) | |
| 46 | |
| 47 | |
| 48 def GetChromeDriverExe(): | |
| 49 """Returns path to ChromeDriver executable, or None if cannot be found.""" | |
| 50 exe_name = 'chromedriver' | |
| 51 if sys.platform == 'win32': | |
| 52 exe_name += '.exe' | |
| 53 for dir in GetBuildDirs(): | |
| 54 exe = os.path.join(dir, exe_name) | |
| 55 if os.path.exists(exe): | |
| 56 return exe | |
| 57 return None | |
| OLD | NEW |