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

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/webkit_finder.py

Issue 2237083002: In rebaseline-cl: add option to only rebaseline tests changed in the CL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 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: third_party/WebKit/Tools/Scripts/webkitpy/common/webkit_finder.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/webkit_finder.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/webkit_finder.py
index 3681938d8b0d413f85884a827054bea7f375f8a2..4e2979212e28227e12fbf6169051d105979edec3 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/common/webkit_finder.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/webkit_finder.py
@@ -50,6 +50,9 @@ class WebKitFinder(object):
# of the SCM repository also matches the top of the WebKit tree. Some SVN users
# (the chromium test bots, for example), might only check out subdirectories like
# Tools/Scripts. This code will also work if there is no SCM system at all.
+ # TODO(qyearsley): Remove duplicate code; we're not concerned with SVN users anymore.
+ # Also, instead of caching the result with a private instance variable, we can use
+ # the memoized decorator.
if not self._webkit_base:
self._webkit_base = self._webkit_base
module_path = self._filesystem.abspath(self._filesystem.path_to_module(self.__module__))
@@ -81,6 +84,23 @@ class WebKitFinder(object):
def perf_tests_dir(self):
return self.path_from_webkit_base('PerformanceTests')
+ def layout_test_name(self, file_path):
+ """Returns a layout test name, given the path from the repo root.
+
+ Args:
+ file_path: A relative path from the root of the Chromium repo.
+
+ Returns:
+ The normalized layout test name, which is just the relative path from
+ the LayoutTests directory, using forward slash as the path separator.
+ Returns None if the given file is not in the LayoutTests directory.
+ """
+ layout_tests_abs_path = self._filesystem.join(self.webkit_base(), self.layout_tests_dir())
+ layout_tests_rel_path = self._filesystem.relpath(layout_tests_abs_path, self.chromium_base())
+ if not file_path.startswith(layout_tests_rel_path):
+ return None
+ return file_path[len(layout_tests_rel_path) + 1:]
+
def depot_tools_base(self):
if not self._depot_tools:
# This basically duplicates src/build/find_depot_tools.py without the side effects

Powered by Google App Engine
This is Rietveld 408576698