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

Side by Side Diff: chrome/common/extensions/docs/server2/test_patcher.py

Issue 14125010: Docserver: Add support for viewing docs with a codereview patch applied (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: add executable bits for tests Created 7 years, 7 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
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 from future import Future
6 from patcher import Patcher
7
8 class TestPatcher(Patcher):
9 def __init__(self, version, patched_files, patch_data, assert_binary=False):
10 self._version = version
11 self._patched_files = patched_files
12 self._patch_data = patch_data
13 self._assert_binary = assert_binary
14
15 self.get_version_count = 0
16 self.get_patched_files_count = 0
17 self.apply_count = 0
18
19 def GetVersion(self):
20 self.get_version_count += 1
21 return self._version
22
23 def GetPatchedFiles(self, version=None):
24 self.get_patched_files_count += 1
25 return self._patched_files
26
27 def Apply(self, paths, file_system, binary, version=None):
28 if self._assert_binary:
29 assert binary
30 self.apply_count += 1
31 try:
32 return Future(value={path: self._patch_data[path] for path in paths})
33 except KeyError:
34 raise FileNotFoundError('One of %s is deleted in the patch.' % paths)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698