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

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt.py

Issue 2583723002: Use LocalWPT.test_patch when filtering exportable commits (Closed)
Patch Set: Fix test_exporter_unittest Created 4 years 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/w3c/local_wpt.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt.py
index d7217c0999415007a3f5e9ea49322a3559e2f160..cec54e988c9e1a70b2aba4256af3a5a8af89c529 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt.py
@@ -6,6 +6,7 @@
import logging
+from webkitpy.common.system.executive import ScriptError
from webkitpy.w3c.chromium_commit import ChromiumCommit
WPT_REPO_URL = 'https://chromium.googlesource.com/external/w3c/web-platform-tests.git'
@@ -107,6 +108,31 @@ class LocalWPT(object):
return branch_name
+ def test_patch(self, patch):
+ """Returns the expected output of a patch against origin/master.
+
+ Args:
+ patch: The patch to test against.
+
+ Returns:
+ A string containing the diff the patch produced.
+ """
+ self.clean()
+
+ # Remove Chromium WPT directory prefix.
+ patch = patch.replace(CHROMIUM_WPT_DIR, '')
+
+ try:
+ self.run(['git', 'apply', '-'], input=patch)
+ self.run(['git', 'add', '.'])
+ output = self.run(['git', 'diff', 'origin/master'])
+ except ScriptError as error:
+ _log.error('Error while applying patch: %s', error)
+ output = ''
+
+ self.clean()
+ return output
+
def commits_behind_master(self, commit):
"""Returns the number of commits after the given commit on origin/master.

Powered by Google App Engine
This is Rietveld 408576698