• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1class ActionContext(object):
2    """
3    Provides the dependencies actions might need to execute.
4    """
5    def __init__(self,
6                 cfm_facade=None,
7                 file_contents_collector=None,
8                 host=None,
9                 usb_device_collector=None,
10                 usb_port_manager=None,
11                 crash_detector=None,
12                 perf_metrics_collector=None,
13                 bond_api=None):
14        """
15        Initializes.
16
17        Parameters are set to None by default to make it easier to provide
18        a subset of dependencies in tests.
19
20        @param cfm_facade CFM facade to use, an instance of
21                CFMFacadeRemoteAdapter.
22        @param file_contents_collector object with a
23                collect_file_contents(file_name) method to get file contents
24                from the specified file on the DUT.
25        @param host an Host instance.
26        @param usb_device_collecor a UsbDeviceCollector instance.
27        @param usb_port_manager a UsbPortManager instance.
28        @param crash_detector a CrashDetector instance.
29        @param perf_metrics_collector a PerfMetricsCollector instance.
30        @param bond_api a BondHttpApi instance
31        """
32        self.cfm_facade = cfm_facade
33        self.file_contents_collector = file_contents_collector
34        # TODO(kerl) consider using a facade to the Host to only provide an
35        # interface with what we need.
36        self.host = host
37        self.usb_device_collector = usb_device_collector
38        self.usb_port_manager = usb_port_manager
39        self.crash_detector = crash_detector
40        self.perf_metrics_collector = perf_metrics_collector
41        self.bond_api = bond_api
42        self.bots_meeting_code = None
43