コード例 #1
0
ファイル: input_manager.py プロジェクト: husam88/DroidbotX
    def __init__(self, device, app, policy_name, random_input,
                 event_count, event_interval,
                 script_path=None, profiling_method=None, master=None,
                 replay_output=None):
        """
        manage input event sent to the target device
        :param device: instance of Device
        :param app: instance of App
        :param policy_name: policy of generating events, string
        :return:
        """
        self.logger = logging.getLogger('InputEventManager')
        self.enabled = True

        self.device = device
        self.app = app
        self.policy_name = policy_name
        self.random_input = random_input
        self.events = []
        self.policy = None
        self.script = None
        self.event_count = event_count
        self.event_interval = event_interval
        self.replay_output = replay_output

        self.monkey = None

        if script_path is not None:
            f = open(script_path, 'r')
            script_dict = json.load(f)
            from input_script import DroidBotScript
            self.script = DroidBotScript(script_dict)

        self.policy = self.get_input_policy(device, app, master)
        self.profiling_method = profiling_method
コード例 #2
0
    def __init__(self, device, app, event_policy, no_shuffle,
                 event_count, event_interval, event_duration,
                 script_path=None, profiling_method=None):
        """
        manage input event sent to the target device
        :param device: instance of Device
        :param app: instance of App
        :param event_policy: policy of generating events, string
        :return:
        """
        self.logger = logging.getLogger('InputEventManager')
        self.enabled = True

        self.device = device
        self.app = app
        self.policy = event_policy
        self.no_shuffle = no_shuffle
        self.events = []
        self.event_factory = None
        self.script = None
        self.event_count = event_count
        self.event_interval = event_interval
        self.event_duration = event_duration
        self.monkey = None
        self.timer = None

        if script_path is not None:
            f = open(script_path, 'r')
            script_dict = json.load(f)
            from input_script import DroidBotScript
            self.script = DroidBotScript(script_dict)

        self.event_factory = self.get_event_factory(device, app)
        self.profiling_method = profiling_method