Exemplo n.º 1
0
    def __init__(self, chrome):
        """Construct a DisplayFacadeLocalAdapter.

        @param chrome: A Chrome object.
        """
        # Create a DisplayFacadeNative object as a component such that this
        # class can expose and manipulate its interfaces.
        self._display_component = display_facade_native.DisplayFacadeNative(
            facade_resource.FacadeResource(chrome_object=chrome))
Exemplo n.º 2
0
    def set_rotation_to_zero(self, cr):
        # Set rotation to 0 (portrait) otherwise tablet platforms might not get
        # overlays.
        facade = facade_resource.FacadeResource(cr)

        display_facade = display_facade_native.DisplayFacadeNative(facade)
        internal_display_id = display_facade.get_internal_display_id()

        logging.info("Internal display ID is %s", internal_display_id)
        display_facade.set_display_rotation(internal_display_id, rotation=0)
 def run_once(self):
     """Test to rotate internal display"""
     facade = facade_resource.FacadeResource()
     facade.start_default_chrome()
     self.display_facade = display_facade_native.DisplayFacadeNative(facade)
     self.internal_display_id = self.display_facade.get_internal_display_id()
     logging.info("Internal display ID is %s", self.internal_display_id)
     rotation_before_starts = self.display_facade.get_display_rotation(
             self.internal_display_id)
     logging.info("Rotation before test starts is %d",
                  rotation_before_starts)
     for angle in self.ROTATIONS:
         logging.info("Rotation to be set %d", angle)
         self.display_facade.set_display_rotation(self.internal_display_id,
                                                  angle,
                                                  self.DELAY_BEFORE_ROTATION,
                                                  self.DELAY_AFTER_ROTATION)
         rotation = self.display_facade.get_display_rotation(
                 self.internal_display_id)
         logging.info("Internal display rotation is set to %s", rotation)
         if rotation != angle:
             raise error.TestFail('Failed to set %d rotation' % angle)
    """Configs logging to be verbose and use console handler."""
    config = logging_config.LoggingConfig()
    config.configure_logging(use_console=True, verbose=True)


if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('-d', '--debug', action='store_true', required=False,
                        help=('create a debug console with a ServerProxy "s" '
                              'connecting to the XML RPC sever at localhost'))
    args = parser.parse_args()

    if args.debug:
        s = xmlrpclib.ServerProxy('http://localhost:%d' %
                                  constants.MULTIMEDIA_XMLRPC_SERVER_PORT,
                                  allow_none=True)
        code.interact(local=locals())
    else:
        config_logging()
        logging.debug('multimedia_xmlrpc_server main...')


        # Restart Cras to clean up any audio activities.
        upstart.restart_job('cras')

        with facade_resource.FacadeResource() as res:
            server = xmlrpc_server.XmlRpcServer(
                    'localhost', constants.MULTIMEDIA_XMLRPC_SERVER_PORT)
            server.register_delegate(MultimediaXmlRpcDelegate(res))
            server.run()
Exemplo n.º 5
0
    parser.add_argument('-d',
                        '--debug',
                        action='store_true',
                        required=False,
                        help=('create a debug console with a ServerProxy "s" '
                              'connecting to the XML RPC sever at localhost'))
    parser.add_argument('--restart',
                        action='store_true',
                        required=False,
                        help=('restart the XML RPC server without clearing '
                              'the previous state'))
    args = parser.parse_args()

    if args.debug:
        s = xmlrpclib.ServerProxy('http://localhost:%d' %
                                  constants.MULTIMEDIA_XMLRPC_SERVER_PORT,
                                  allow_none=True)
        code.interact(local=locals())
    else:
        config_logging()
        logging.debug('multimedia_xmlrpc_server main...')

        # Restart Cras to clean up any audio activities.
        utils.restart_job('cras')

        with facade_resource.FacadeResource(restart=args.restart) as res:
            server = xmlrpc_server.XmlRpcServer(
                'localhost', constants.MULTIMEDIA_XMLRPC_SERVER_PORT)
            server.register_delegate(MultimediaXmlRpcDelegate(res))
            server.run()