Home | History | Annotate | Download | only in multimedia
      1 # Copyright 2015 The Chromium OS 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 """An adapter to remotely access the system facade on DUT."""
      6 
      7 
      8 class SystemFacadeRemoteAdapter(object):
      9     """SystemFacadeRemoteAdapter is an adapter to remotely control DUT system.
     10 
     11     The Autotest host object representing the remote DUT, passed to this
     12     class on initialization, can be accessed from its _client property.
     13 
     14     """
     15     def __init__(self, host, remote_facade_proxy):
     16         """Construct an SystemFacadeRemoteAdapter.
     17 
     18         @param host: Host object representing a remote host.
     19         @param remote_facade_proxy: RemoteFacadeProxy object.
     20 
     21         """
     22         self._client = host
     23         self._proxy = remote_facade_proxy
     24 
     25 
     26     @property
     27     def _system_proxy(self):
     28         """Gets the proxy to DUT system facade.
     29 
     30         @return XML RPC proxy to DUT system facade.
     31 
     32         """
     33         return self._proxy.system
     34 
     35 
     36     def set_scaling_governor_mode(self, index, mode):
     37         """Set mode of CPU scaling governor on one CPU of DUT.
     38 
     39         @param index: CPU index starting from 0.
     40 
     41         @param mode: Mode of scaling governor, accept 'interactive' or
     42                      'performance'.
     43 
     44         @returns: The original mode.
     45 
     46         """
     47         return self._system_proxy.set_scaling_governor_mode(index, mode)
     48