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