Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2197)

Unified Diff: chrome/test/pyautolib/pyauto_paths.py

Issue 7634031: Let pyauto create an attached webdriver instance to manipulate web pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: forgot to re-add the previously added files Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/pyautolib/pyauto_paths.py
diff --git a/chrome/test/pyautolib/pyauto_paths.py b/chrome/test/pyautolib/pyauto_paths.py
new file mode 100644
index 0000000000000000000000000000000000000000..5b9bb1eefc6dbc124a9d5404b9ac7e5d6a944347
--- /dev/null
+++ b/chrome/test/pyautolib/pyauto_paths.py
@@ -0,0 +1,57 @@
+#!/usr/bin/python
+# 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."""
+ build_dirs = {
+ 'linux2': [ os.path.join('out', 'Debug'),
+ os.path.join('sconsbuild', 'Debug'),
+ os.path.join('out', 'Release'),
+ os.path.join('sconsbuild', 'Release')],
+ 'linux3': [ os.path.join('out', 'Debug'),
+ os.path.join('sconsbuild', 'Debug'),
+ os.path.join('out', 'Release'),
+ os.path.join('sconsbuild', 'Release')],
+ 'darwin': [ os.path.join('xcodebuild', 'Debug'),
+ os.path.join('xcodebuild', 'Release')],
+ 'win32': [ os.path.join('chrome', 'Debug'),
+ os.path.join('build', 'Debug'),
+ os.path.join('chrome', 'Release'),
+ os.path.join('build', 'Release')],
+ 'cygwin': [ os.path.join('chrome', 'Debug'),
+ os.path.join('chrome', 'Release')],
+ }
+ src_dir = GetSourceDir()
+ return map(lambda dir: os.path.join(src_dir, dir),
+ build_dirs.get(sys.platform, []))
+
+
+def GetChromeDriverExe():
+ """Returns path to ChromeDriver executable, or None if cannot be found."""
+ exe_name = 'chromedriver'
+ if sys.platform == 'win32':
+ exe_name += '.exe'
+ for dir in GetBuildDirs():
+ exe = os.path.join(dir, exe_name)
+ if os.path.exists(exe):
+ return exe
+ return None

Powered by Google App Engine
This is Rietveld 408576698