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

Side by Side Diff: Tools/Scripts/webkitpy/common/system/executive_mock.py

Issue 546613003: Add a new 'format-webkitpy' command that will reformat code to the style guide. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ready for review Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (C) 2011 Google Inc. All rights reserved. 1 # Copyright (C) 2011 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 num_previous_calls = len(self.calls) 161 num_previous_calls = len(self.calls)
162 command_outputs = [] 162 command_outputs = []
163 for cmd_line, cwd in commands: 163 for cmd_line, cwd in commands:
164 command_outputs.append([0, self.run_command(cmd_line, cwd=cwd), '']) 164 command_outputs.append([0, self.run_command(cmd_line, cwd=cwd), ''])
165 165
166 new_calls = self.calls[num_previous_calls:] 166 new_calls = self.calls[num_previous_calls:]
167 self.calls = self.calls[:num_previous_calls] 167 self.calls = self.calls[:num_previous_calls]
168 self.calls.append(new_calls) 168 self.calls.append(new_calls)
169 return command_outputs 169 return command_outputs
170 170
171 def map(self, thunk, arglist, processes=None):
172 return map(thunk, arglist)
173
171 174
172 class MockExecutive2(MockExecutive): 175 class MockExecutive2(MockExecutive):
173 """MockExecutive2 is like MockExecutive except it doesn't log anything.""" 176 """MockExecutive2 is like MockExecutive except it doesn't log anything."""
174 177
175 def __init__(self, output='', exit_code=0, exception=None, run_command_fn=No ne, stderr=''): 178 def __init__(self, output='', exit_code=0, exception=None, run_command_fn=No ne, stderr=''):
176 self._output = output 179 self._output = output
177 self._stderr = stderr 180 self._stderr = stderr
178 self._exit_code = exit_code 181 self._exit_code = exit_code
179 self._exception = exception 182 self._exception = exception
180 self._run_command_fn = run_command_fn 183 self._run_command_fn = run_command_fn
(...skipping 16 matching lines...) Expand all
197 if self._run_command_fn: 200 if self._run_command_fn:
198 return self._run_command_fn(args) 201 return self._run_command_fn(args)
199 if return_exit_code: 202 if return_exit_code:
200 return self._exit_code 203 return self._exit_code
201 if self._exit_code and error_handler: 204 if self._exit_code and error_handler:
202 script_error = ScriptError(script_args=args, exit_code=self._exit_co de, output=self._output) 205 script_error = ScriptError(script_args=args, exit_code=self._exit_co de, output=self._output)
203 error_handler(script_error) 206 error_handler(script_error)
204 if return_stderr: 207 if return_stderr:
205 return self._output + self._stderr 208 return self._output + self._stderr
206 return self._output 209 return self._output
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698