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

Unified Diff: scripts/slave/recipe_api.py

Issue 17635005: Make blink_trybot recipe work on windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Fix presubmit + move polyfill (retry) Created 7 years, 6 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: scripts/slave/recipe_api.py
diff --git a/scripts/slave/recipe_api.py b/scripts/slave/recipe_api.py
index b1122b6b50e6ff2bc0ba62f2b1eeac8e8b3a8b1c..58fecc7b4d49a64fc285d7e7651052f1140bde49 100644
--- a/scripts/slave/recipe_api.py
+++ b/scripts/slave/recipe_api.py
@@ -6,6 +6,7 @@ import imp
import inspect
import os
import sys
+import tempfile
class Placeholder(object):
@@ -19,6 +20,30 @@ class Placeholder(object):
pass
+class InputDataPlaceholder(Placeholder):
+ def __init__(self, data, suffix):
+ assert isinstance(data, basestring)
+ self.data = data
+ self.suffix = suffix
+ self.input_file = None
+ super(InputDataPlaceholder, self).__init__()
+
+ def render(self, test_data):
+ if test_data is not None:
+ # cheat and pretend like we're going to pass the data on the
+ # cmdline for test expectation purposes.
+ return [self.data]
+ else: # pragma: no cover
+ input_fd, self.input_file = tempfile.mkstemp(suffix=self.suffix)
+ os.write(input_fd, self.data)
+ os.close(input_fd)
+ return [self.input_file]
+
+ def step_finished(self, stream, step_result, test_data):
+ if test_data is None: # pragma: no cover
+ os.unlink(self.input_file)
+
+
class ModuleInjectionSite(object):
pass

Powered by Google App Engine
This is Rietveld 408576698