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

Side by Side Diff: chrome/test/mini_installer/file_verifier.py

Issue 2747023002: Cleanup machine based on the state in configuration file for mini installer test.
Patch Set: refactor to use visitor pattern Created 3 years, 9 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
« no previous file with comments | « chrome/test/mini_installer/file.py ('k') | chrome/test/mini_installer/mini_installer_test.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import os
6
7 import verifier
8
9
10 class FileVerifier(verifier.Verifier):
11 """Verifies that the current files match the expectation dictionaries."""
12
13 def _VerifyExpectation(self, expectation_name, expectation,
14 variable_expander):
15 """Overridden from verifier.Verifier.
16
17 This method will throw an AssertionError if file state doesn't match the
18 |expectation|.
19
20 Args:
21 expectation_name: Path to the file being verified. It is expanded using
22 Expand.
23 expectation: A dictionary with the following key and value:
24 'exists' a boolean indicating whether the file should exist.
25 variable_expander: A VariableExpander object.
26 """
27 file_path = variable_expander.Expand(expectation_name)
28 file_exists = os.path.exists(file_path)
29 assert expectation['exists'] == file_exists, \
30 ('File %s exists' % file_path) if file_exists else \
31 ('File %s is missing' % file_path)
OLDNEW
« no previous file with comments | « chrome/test/mini_installer/file.py ('k') | chrome/test/mini_installer/mini_installer_test.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698