当前位置: 首页>>代码示例>>Python>>正文


Python DeviceManagerADB.pushFile方法代码示例

本文整理汇总了Python中mozdevice.DeviceManagerADB.pushFile方法的典型用法代码示例。如果您正苦于以下问题:Python DeviceManagerADB.pushFile方法的具体用法?Python DeviceManagerADB.pushFile怎么用?Python DeviceManagerADB.pushFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mozdevice.DeviceManagerADB的用法示例。


在下文中一共展示了DeviceManagerADB.pushFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from mozdevice import DeviceManagerADB [as 别名]
# 或者: from mozdevice.DeviceManagerADB import pushFile [as 别名]
class ADBFuzz:

  def __init__(self, cfgFile):
    self.config = ADBFuzzConfig(cfgFile)

    self.HTTPProcess = None
    self.logProcesses = []
    self.logThreads = []
    self.remoteInitialized = None

    self.triager = Triager(self.config)
    
    # Seed RNG with localtime
    random.seed()
    
  def deploy(self, packageFile, prefFile):
    self.dm = DeviceManagerADB(self.config.remoteAddr, 5555)
    
    # Install a signal handler that shuts down our external programs on SIGINT
    signal.signal(signal.SIGINT, self.signal_handler)
    
    self.dm.updateApp(packageFile)
    
    # Standard init stuff
    self.appName = self.dm.packageName
    self.appRoot = self.dm.getAppRoot(self.appName)
    self.profileBase = self.appRoot + "/files/mozilla"
    
    # Ensure no Fennec instance is running
    self.stopFennec()
    
    # Start Fennec, so a profile is created if this is the first install
    self.startFennec(blank=True)
    
    # Grant some time to create profile
    time.sleep(self.config.runTimeout * 2)
    
    # Stop Fennec again
    self.stopFennec()
    
    # Now try to get the profile(s)
    self.profiles = self.getProfiles()

    if (len(self.profiles) == 0):
      print "Failed to detect any valid profile, aborting..."
      return 1

    self.defaultProfile = self.profiles[0]

    if (len(self.profiles) > 1):
      print "Multiple profiles detected, using the first: " + self.defaultProfile
      
    # Push prefs.js to profile
    self.dm.pushFile(prefFile, self.profileBase + "/" + self.defaultProfile + "/prefs.js")
    
    # Try to install addon if requested by configuration
    if self.config.addon != None:
      self.ensureExtensionInstalled(self.config.addon)
    
    print "Successfully deployed package."
    
  def reset(self, prefFile):
    self.dm = DeviceManagerADB(self.config.remoteAddr, 5555)
    
    # Install a signal handler that shuts down our external programs on SIGINT
    signal.signal(signal.SIGINT, self.signal_handler)
    
    # Standard init stuff
    self.appName = self.dm.packageName
    self.appRoot = self.dm.getAppRoot(self.appName)
    self.profileBase = self.appRoot + "/files/mozilla"
    
    # Ensure no Fennec instance is running
    self.stopFennec()
    
    # Now try to get the old profile(s)
    self.profiles = self.getProfiles()
    
    for profile in self.profiles:
      self.dm.removeDir(self.profileBase + "/" + profile)
      
    self.dm.removeFile(self.profileBase + "/profiles.ini")
    
    # Start Fennec, so a new profile is created
    self.startFennec(blank=True)
    
    # Grant some time to create profile
    time.sleep(self.config.runTimeout * 2)
    
    # Stop Fennec again
    self.stopFennec()
    
    # Now try to get the profile(s) again
    self.profiles = self.getProfiles()

    if (len(self.profiles) == 0):
      print "Failed to detect any valid profile, aborting..."
      return 1

    self.defaultProfile = self.profiles[0]
#.........这里部分代码省略.........
开发者ID:0xr0ot,项目名称:ADBFuzz,代码行数:103,代码来源:adbfuzz.py


注:本文中的mozdevice.DeviceManagerADB.pushFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。