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