Chromium Code Reviews| Index: chrome/test/mini_installer/file_verifier.py |
| diff --git a/chrome/test/mini_installer/file_verifier.py b/chrome/test/mini_installer/file_verifier.py |
| index 5e6244648a4c85701899b68997ce28b345f889ce..a4037a0a2463d9435e429f7baf4888c4b47cab56 100644 |
| --- a/chrome/test/mini_installer/file_verifier.py |
| +++ b/chrome/test/mini_installer/file_verifier.py |
| @@ -10,6 +10,10 @@ import verifier |
| class FileVerifier(verifier.Verifier): |
| """Verifies that the current files match the expectation dictionaries.""" |
| + def __init__(self): |
| + self._file_path = None |
| + self._file_exists = None |
| + |
| def _VerifyExpectation(self, expectation_name, expectation, |
| variable_expander): |
| """Overridden from verifier.Verifier. |
| @@ -24,8 +28,8 @@ class FileVerifier(verifier.Verifier): |
| 'exists' a boolean indicating whether the file should exist. |
| variable_expander: A VariableExpander object. |
| """ |
| - file_path = variable_expander.Expand(expectation_name) |
| - file_exists = os.path.exists(file_path) |
| - assert expectation['exists'] == file_exists, \ |
| - ('File %s exists' % file_path) if file_exists else \ |
| - ('File %s is missing' % file_path) |
| + self._file_path = variable_expander.Expand(expectation_name) |
|
grt (UTC plus 2)
2017/03/14 09:19:44
why store state in the verifier? one instance is u
|
| + self._file_exists = os.path.exists(self._file_path) |
| + self._Assert(expectation['exists'] == self._file_exists, |
| + ('File %s exists' % self._file_path) if self._file_exists \ |
| + else ('File %s is missing' % self._file_path)) |