Home | History | Annotate | Download | only in mini_installer
      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 file_verifier
      6 import process_verifier
      7 import registry_verifier
      8 
      9 
     10 class VerifierRunner:
     11   """Runs all Verifiers."""
     12 
     13   def __init__(self):
     14     """Constructor."""
     15     # TODO(sukolsak): Implement other verifiers
     16     self._verifiers = {
     17       'Files': file_verifier.FileVerifier(),
     18       'Processes': process_verifier.ProcessVerifier(),
     19       'RegistryEntries': registry_verifier.RegistryVerifier(),
     20     }
     21 
     22   def VerifyAll(self, property, variable_expander):
     23     """Verifies that the current machine states match the property dictionary.
     24 
     25     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
     27     the input format for each verifier, take a look at http://goo.gl/1P85WL
     28 
     29     Args:
     30       property: A property dictionary.
     31       variable_expander: A VariableExpander object.
     32     """
     33     for verifier_name, verifier_input in property.iteritems():
     34       if verifier_name not in self._verifiers:
     35         raise KeyError('Unknown verifier %s' % verifier_name)
     36       self._verifiers[verifier_name].VerifyInput(verifier_input,
     37                                                  variable_expander)
     38