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

Unified Diff: webkit/tools/layout_tests/layout_package/path_utils.py

Issue 115302: Allow layout tests to be located both in src/webkit/data/layout_tests and thi... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: Moar fixez Created 11 years, 7 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
« no previous file with comments | « no previous file | webkit/tools/layout_tests/layout_package/test_expectations.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/tools/layout_tests/layout_package/path_utils.py
===================================================================
--- webkit/tools/layout_tests/layout_package/path_utils.py (revision 15966)
+++ webkit/tools/layout_tests/layout_package/path_utils.py (working copy)
@@ -19,6 +19,7 @@
# Save some paths here so we don't keep re-evaling.
_webkit_root = None
_layout_data_dir = None
+_layout_tests_dir = None
# A map from platform description to directory list.
_platform_results_dirs = {}
@@ -51,6 +52,27 @@
'data', 'layout_tests')
return _layout_data_dir
+def LayoutTestsDir(path = None):
+ """Returns the full path to the directory containing layout tests, based on
+ the supplied relative or absolute path to a layout tests. If the path contains
+ "LayoutTests" directory, locates this directory, assuming it's either in
+ in webkit/data/layout_tests or in third_party/WebKit."""
+
+ if path != None and path.find('LayoutTests') == -1:
+ return LayoutDataDir()
+
+ global _layout_tests_dir
+ if _layout_tests_dir:
+ return _layout_tests_dir
+
+ if os.path.exists(os.path.join(LayoutDataDir(), 'LayoutTests')):
+ _layout_tests_dir = LayoutDataDir()
+ else:
+ _layout_tests_dir = google.path_utils.FindUpward(
+ google.path_utils.ScriptDir(), 'third_party', 'WebKit')
+
+ return _layout_tests_dir
+
def ChromiumPlatformResultsEnclosingDir():
"""Returns the full path to the directory containing Chromium platform
result directories.
@@ -61,7 +83,7 @@
def WebKitPlatformResultsEnclosingDir():
"""Gets the full path to just above the platform results directory."""
- return os.path.join(LayoutDataDir(), 'LayoutTests', 'platform')
+ return os.path.join(LayoutTestsDir(), 'LayoutTests', 'platform')
def PlatformResultsEnclosingDir(platform):
"""Gets the path to just above the results directory for this platform."""
@@ -190,7 +212,7 @@
def RelativeTestFilename(filename):
"""Provide the filename of the test relative to the layout data
directory as a unix style path (a/b/c)."""
- return WinPathToUnix(filename[len(LayoutDataDir()) + 1:])
+ return WinPathToUnix(filename[len(LayoutTestsDir(filename)) + 1:])
def GetPlatformUtil():
"""Returns a singleton instance of the PlatformUtility."""
« no previous file with comments | « no previous file | webkit/tools/layout_tests/layout_package/test_expectations.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698