Ejemplo n.º 1
0
 def get_input_policy(self, device, app):
     input_policy = None
     if self.policy_name == POLICY_NONE:
         input_policy = None
     elif self.policy_name == POLICY_MONKEY:
         input_policy = None
     elif self.policy_name == POLICY_DFS:
         input_policy = UtgDfsPolicy(device, app, self.random_input)
     elif self.policy_name == POLICY_MANUAL:
         input_policy = ManualPolicy(device, app)
     else:
         input_policy = None
     if isinstance(input_policy, UtgBasedInputPolicy):
         input_policy.script = self.script
     return input_policy
Ejemplo n.º 2
0
 def get_input_policy(self, device, app, master):
     input_policy = None
     if self.policy_name == POLICY_NONE:
         input_policy = None
     elif self.policy_name == POLICY_MONKEY:
         input_policy = None
     elif self.policy_name in [POLICY_NAIVE_DFS, POLICY_NAIVE_BFS]:
         input_policy = UtgNaiveSearchPolicy(device, app, self.random_input, self.policy_name)
     elif self.policy_name in [POLICY_GREEDY_DFS, POLICY_GREEDY_BFS]:
         input_policy = UtgGreedySearchPolicy(device, app, self.random_input, self.policy_name)
     elif self.policy_name == POLICY_MANUAL:
         input_policy = ManualPolicy(device, app)
     elif self.policy_name == POLICY_RANDOM:
         input_policy = UtgRandomWidgetPolicy(device, app, self.random_input)
     else:
         self.logger.warning("No valid input policy specified. Using policy \"none\".")
         input_policy = None
     if isinstance(input_policy, UtgBasedInputPolicy):
         input_policy.script = self.script
         input_policy.master = master
     return input_policy