Example #1
0
 def quitall(self):
     command = self.root + "quitall "
     logging.debug('quitting all emulators')
     opt, err = get_console_opt.get_console_output(command)
     if opt != '':
         raise Exception(opt)
     else:
         raise Exception("method not support")
Example #2
0
 def reboot(self, method, n):
     command = self.root + "reboot " + "--" + method + " " + str(n)
     if method == "name" or method == "index":
         logging.debug('reboot all emulators')
         opt, err = get_console_opt.get_console_output(command)
         if opt != "":
             raise Exception(opt)
     else:
         raise Exception("method not support")
Example #3
0
 def launch(self, method, n):
     command = self.root + "launch " + "--" + method + " " + str(n)
     if method == "name" or method == "index":
         logging.debug('launch emulator {} by {}'.format(n, method))
         opt, err = get_console_opt.get_console_output(command)
         if opt != "":
             raise Exception(opt)
     else:
         raise Exception("method not support")
Example #4
0
    def quit(self, method, n):

        command = self.root + "quit " + "--" + method + " " + str(n)
        if method == "name" or method == "index":
            logging.debug('quitting emulator {} by {}'.format(n, method))
            opt, err = get_console_opt.get_console_output(command)
            if err != "":
                raise Exception(str(err))
        else:
            raise Exception("method not support")
Example #5
0
 def killapp(self, method, n, apk_name):
     command = self.root + "killapp " + "--" + method + " " + str(
         n) + " --packagename " + apk_name
     if method == 'index' or method == 'name':
         opt = get_console_opt.get_console_output(command)
         logging.debug('killapp {} on emulator {} by {} method'.format(
             apk_name, n, method))
         if opt != ("", ''):
             raise Exception(opt)
         else:
             raise Exception("kill app done.")
Example #6
0
 def runapp(self, method, n, apk_name):
     command = self.root + "runapp " + "--" + method + " " + str(
         n) + " --packagename " + apk_name
     if method == "index" or method == "name":
         logging.debug('runapp {} on emulator {} by {} method'.format(
             apk_name, n, method))
         opt, err = get_console_opt.get_console_output(command)
         if opt != "":
             raise Exception(opt)
     else:
         raise Exception("method not support")
Example #7
0
 def list2(self):
     command = self.root + 'list2 '
     opt, err = get_console_opt.get_console_output(command)
     logging.debug('dnconsole list2')
     emulator_dict = {}
     if opt != "":
         lines = opt.split('\r\n')
         for line in lines:
             if line != "":
                 index, name, _, _, _, _, _ = line.split(',')
                 emulator_dict[name] = index
         return emulator_dict
Example #8
0
    def isrunning(self, method, n):
        command = self.root + "isrunning " + "--" + method + " " + str(n)
        if method == "index" or method == "name":
            opt, err = get_console_opt.get_console_output(command)

            logging.debug('checking emulator {} running statue'.format(n))
            if opt == 'running':
                logging.debug('emulator {} is running'.format(n))
                return True
            elif opt == 'stop':
                logging.debug('emulator {} is not running.'.format(n))
                return False
        else:
            raise Exception("method not support")
Example #9
0
 def adb(self, method, n, cmd, print_call_back=1):
     command = self.root + "adb " + "--" + method + " " + str(
         n) + " --command " + '"' + cmd + '"'
     #print(cmd)
     if method == "index" or method == "name":
         logging.debug('emulator {} by method {} - {}'.format(
             n, method, cmd))
         opt, err = get_console_opt.get_console_output(command)
         # print('opt',opt,err)
         opt = opt.replace('\n', "")
         opt = opt.replace('\r', '')
         if print_call_back == 1 and opt != '':
             logging.debug('call back : {}'.format(opt))
         return opt
     else:
         raise Exception("method not support")