OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 from future import Future | 5 from future import Future |
6 from patcher import Patcher | 6 from patcher import Patcher |
7 | 7 |
8 class TestPatcher(Patcher): | 8 class TestPatcher(Patcher): |
9 def __init__(self, version, patched_files, patch_data, assert_binary=False): | 9 def __init__(self, version, patched_files, patch_data, assert_binary=False): |
10 self._version = version | 10 self._version = version |
(...skipping 14 matching lines...) Expand all Loading... |
25 return self._patched_files | 25 return self._patched_files |
26 | 26 |
27 def Apply(self, paths, file_system, binary, version=None): | 27 def Apply(self, paths, file_system, binary, version=None): |
28 if self._assert_binary: | 28 if self._assert_binary: |
29 assert binary | 29 assert binary |
30 self.apply_count += 1 | 30 self.apply_count += 1 |
31 try: | 31 try: |
32 return Future(value={path: self._patch_data[path] for path in paths}) | 32 return Future(value={path: self._patch_data[path] for path in paths}) |
33 except KeyError: | 33 except KeyError: |
34 raise FileNotFoundError('One of %s is deleted in the patch.' % paths) | 34 raise FileNotFoundError('One of %s is deleted in the patch.' % paths) |
| 35 |
| 36 def GetIdentity(self): |
| 37 return self.__class__.__name__ |
OLD | NEW |