Chromium Code Reviews| 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 import file_verifier | 5 import file_verifier |
| 6 import process_verifier | 6 import process_verifier |
| 7 import registry_verifier | 7 import registry_verifier |
| 8 | 8 |
| 9 | 9 |
| 10 FILES = 'Files' | |
| 11 PROCESSES = 'Processes' | |
| 12 REGISTRY_ENTRIES = 'RegistryEntries' | |
| 13 | |
| 10 class VerifierRunner: | 14 class VerifierRunner: |
| 11 """Runs all Verifiers.""" | 15 """Runs all Verifiers.""" |
| 12 | 16 |
| 13 def __init__(self): | 17 def __init__(self): |
| 14 """Constructor.""" | 18 """Constructor.""" |
| 15 # TODO(sukolsak): Implement other verifiers | 19 # TODO(sukolsak): Implement other verifiers |
| 16 self._verifiers = { | 20 self._verifiers = { |
| 17 'Files': file_verifier.FileVerifier(), | 21 FILES: file_verifier.FileVerifier(), |
|
grt (UTC plus 2)
2017/03/14 09:19:44
why this change?
| |
| 18 'Processes': process_verifier.ProcessVerifier(), | 22 PROCESSES: process_verifier.ProcessVerifier(), |
| 19 'RegistryEntries': registry_verifier.RegistryVerifier(), | 23 REGISTRY_ENTRIES: registry_verifier.RegistryVerifier(), |
| 20 } | 24 } |
| 21 | 25 |
| 22 def VerifyAll(self, property, variable_expander): | 26 def VerifyAll(self, state, variable_expander): |
| 23 """Verifies that the current machine states match the property dictionary. | 27 """Verifies that the current machine states match the property dictionary. |
| 24 | 28 |
| 25 A property dictionary is a dictionary where each key is a verifier's name | 29 A property dictionary is a dictionary where each key is a verifier's name |
| 26 and the associated value is the input to that verifier. For details about | 30 and the associated value is the input to that verifier. For details about |
| 27 the input format for each verifier, take a look at http://goo.gl/1P85WL | 31 the input format for each verifier, take a look at http://goo.gl/1P85WL |
| 28 | 32 |
| 29 Args: | 33 Args: |
| 30 property: A property dictionary. | 34 state: A property dictionary. |
| 31 variable_expander: A VariableExpander object. | 35 variable_expander: A VariableExpander object. |
| 32 """ | 36 """ |
| 33 for verifier_name, verifier_input in property.iteritems(): | 37 for verifier_name, verifier_input in state.iteritems(): |
| 34 if verifier_name not in self._verifiers: | 38 if verifier_name not in self._verifiers: |
| 35 raise KeyError('Unknown verifier %s' % verifier_name) | 39 raise KeyError('Unknown verifier %s' % verifier_name) |
| 36 self._verifiers[verifier_name].VerifyInput(verifier_input, | 40 self._verifiers[verifier_name].VerifyInput(verifier_input, |
| 37 variable_expander) | 41 variable_expander) |
| OLD | NEW |