예제 #1
0
 def copyExtraFilesToProfile(self, options, profileDir):
     RefTest.copyExtraFilesToProfile(self, options, profileDir)
     try:
         self._devicemanager.pushDir(profileDir, options.remoteProfile)
     except devicemanager.DMError:
         print "Automation Error: Failed to copy extra files to device"
         raise
예제 #2
0
    def createReftestProfile(self, options, profileDir):
        RefTest.createReftestProfile(self, options, profileDir)

        if (self._devicemanager.pushDir(profileDir,
                                        options.remoteProfile) == None):
            raise devicemanager.FileError(
                "Failed to copy profiledir to device")
예제 #3
0
 def cleanup(self, profileDir):
     # Pull results back from device
     if (self.remoteLogFile):
         self._devicemanager.getFile(self.remoteLogFile, self.localLogName)
     self._devicemanager.removeDir(self.remoteProfile)
     self._devicemanager.removeDir(self.remoteTestRoot)
     RefTest.cleanup(self, profileDir)
예제 #4
0
 def copyExtraFilesToProfile(self, options, profileDir):
     RefTest.copyExtraFilesToProfile(self, options, profileDir)
     try:
         self._devicemanager.pushDir(profileDir, options.remoteProfile)
     except devicemanager.DMError:
         print "Automation Error: Failed to copy extra files to device"
         raise
예제 #5
0
    def __init__(self, automation, devicemanager, options, scriptDir):
        RefTest.__init__(self)
        self.automation = automation
        self._devicemanager = devicemanager
        self.scriptDir = scriptDir
        self.remoteApp = options.app
        self.remoteProfile = options.remoteProfile
        self.remoteTestRoot = options.remoteTestRoot
        self.remoteLogFile = options.remoteLogFile
        self.remoteCache = os.path.join(options.remoteTestRoot, "cache/")
        self.localLogName = options.localLogName
        self.pidFile = options.pidFile
        if self.automation.IS_DEBUG_BUILD:
            self.SERVER_STARTUP_TIMEOUT = 180
        else:
            self.SERVER_STARTUP_TIMEOUT = 90
        self.automation.deleteANRs()
        self.automation.deleteTombstones()
        self._devicemanager.removeDir(self.remoteCache)

        self._populate_logger(options)
        self.outputHandler = OutputHandler(self.log, options.utilityPath, options.symbolsPath)
        # RemoteAutomation.py's 'messageLogger' is also used by mochitest. Mimic a mochitest
        # MessageLogger object to re-use this code path.
        self.outputHandler.write = self.outputHandler.__call__
        self.automation._processArgs['messageLogger'] = self.outputHandler
예제 #6
0
    def createReftestProfile(self, options, profileDir, reftestlist):
        RefTest.createReftestProfile(self,
                                     options,
                                     profileDir,
                                     reftestlist,
                                     server=options.remoteWebServer)

        # Turn off the locale picker screen
        fhandle = open(os.path.join(profileDir, "user.js"), 'a')
        fhandle.write("""
user_pref("browser.firstrun.show.localepicker", false);
user_pref("font.size.inflation.emPerLine", 0);
user_pref("font.size.inflation.minTwips", 0);
user_pref("reftest.remote", true);
user_pref("toolkit.telemetry.prompted", true);
user_pref("reftest.uri", "%s");
""" % reftestlist)

        #workaround for jsreftests.
        if options.enablePrivilege:
            fhandle.write("""
user_pref("capability.principal.codebase.p2.granted", "UniversalXPConnect");
user_pref("capability.principal.codebase.p2.id", "http://%s:%s");
""" % (options.remoteWebServer, options.httpPort))

        # Close the file
        fhandle.close()

        if (self._devicemanager.pushDir(profileDir,
                                        options.remoteProfile) == None):
            raise devicemanager.FileError(
                "Failed to copy profiledir to device")
예제 #7
0
    def createReftestProfile(self, options, profileDir, reftestlist):
        RefTest.createReftestProfile(self, options, profileDir, reftestlist, server=options.remoteWebServer)

        # Turn off the locale picker screen
        fhandle = open(os.path.join(profileDir, "user.js"), 'a')
        fhandle.write("""
user_pref("browser.firstrun.show.localepicker", false);
user_pref("font.size.inflation.emPerLine", 0);
user_pref("font.size.inflation.minTwips", 0);
user_pref("reftest.remote", true);
user_pref("toolkit.telemetry.prompted", true);
user_pref("reftest.uri", "%s");
""" % reftestlist)

        #workaround for jsreftests.
        if options.enablePrivilege:
            fhandle.write("""
user_pref("capability.principal.codebase.p2.granted", "UniversalPreferencesWrite UniversalXPConnect UniversalBrowserWrite UniversalPreferencesRead UniversalBrowserRead");
user_pref("capability.principal.codebase.p2.id", "http://%s:%s");
""" % (options.remoteWebServer, options.httpPort))

        # Close the file
        fhandle.close()

        if (self._devicemanager.pushDir(profileDir, options.remoteProfile) == None):
            raise devicemanager.FileError("Failed to copy profiledir to device")
예제 #8
0
    def __init__(self, automation, devicemanager, options, scriptDir):
        RefTest.__init__(self)
        self.automation = automation
        self._devicemanager = devicemanager
        self.scriptDir = scriptDir
        self.remoteApp = options.app
        self.remoteProfile = options.remoteProfile
        self.remoteTestRoot = options.remoteTestRoot
        self.remoteLogFile = options.remoteLogFile
        self.remoteCache = os.path.join(options.remoteTestRoot, "cache/")
        self.localLogName = options.localLogName
        self.pidFile = options.pidFile
        if self.automation.IS_DEBUG_BUILD:
            self.SERVER_STARTUP_TIMEOUT = 180
        else:
            self.SERVER_STARTUP_TIMEOUT = 90
        self.automation.deleteANRs()
        self.automation.deleteTombstones()
        self._devicemanager.removeDir(self.remoteCache)

        self._populate_logger(options)
        outputHandler = OutputHandler(self.log, options.utilityPath, options.symbolsPath)
        # RemoteAutomation.py's 'messageLogger' is also used by mochitest. Mimic a mochitest
        # MessageLogger object to re-use this code path.
        outputHandler.write = outputHandler.__call__
        self.automation._processArgs['messageLogger'] = outputHandler
예제 #9
0
    def createReftestProfile(self, options, profileDir, reftestlist):
        RefTest.createReftestProfile(self, options, profileDir, reftestlist, server=options.remoteWebServer)

        # Turn off the locale picker screen
        fhandle = open(os.path.join(profileDir, "user.js"), 'a')
        fhandle.write("""
user_pref("browser.firstrun.show.localepicker", false);
user_pref("font.size.inflation.emPerLine", 0);
user_pref("font.size.inflation.minTwips", 0);
user_pref("reftest.remote", true);
// Set a future policy version to avoid the telemetry prompt.
user_pref("toolkit.telemetry.prompted", 999);
user_pref("toolkit.telemetry.notifiedOptOut", 999);
user_pref("reftest.uri", "%s");
user_pref("datareporting.policy.dataSubmissionPolicyBypassAcceptance", true);
""" % reftestlist)

        #workaround for jsreftests.
        if options.enablePrivilege:
            fhandle.write("""
user_pref("capability.principal.codebase.p2.granted", "UniversalXPConnect");
user_pref("capability.principal.codebase.p2.id", "http://%s:%s");
""" % (options.remoteWebServer, options.httpPort))

        # Close the file
        fhandle.close()

        try:
            self._devicemanager.pushDir(profileDir, options.remoteProfile)
        except devicemanager.DMError:
            print "Automation Error: Failed to copy profiledir to device"
            raise
예제 #10
0
 def cleanup(self, profileDir):
     # Pull results back from device
     if (self.remoteLogFile):
         self._devicemanager.getFile(self.remoteLogFile, self.localLogName)
     self._devicemanager.removeDir(self.remoteProfile)
     self._devicemanager.removeDir(self.remoteTestRoot)
     RefTest.cleanup(self, profileDir)
예제 #11
0
    def createReftestProfile(self, options, profileDir, reftestlist):
        RefTest.createReftestProfile(self,
                                     options,
                                     profileDir,
                                     reftestlist,
                                     server=options.remoteWebServer)

        # Turn off the locale picker screen
        fhandle = open(os.path.join(profileDir, "user.js"), 'a')
        fhandle.write("""
user_pref("browser.firstrun.show.localepicker", false);
user_pref("font.size.inflation.emPerLine", 0);
user_pref("font.size.inflation.minTwips", 0);
user_pref("reftest.remote", true);
// Set a future policy version to avoid the telemetry prompt.
user_pref("toolkit.telemetry.prompted", 999);
user_pref("toolkit.telemetry.notifiedOptOut", 999);
user_pref("reftest.uri", "%s");
user_pref("datareporting.policy.dataSubmissionPolicyBypassAcceptance", true);

// Point the url-classifier to the local testing server for fast failures
user_pref("browser.safebrowsing.gethashURL", "http://127.0.0.1:8888/safebrowsing-dummy/gethash");
user_pref("browser.safebrowsing.keyURL", "http://127.0.0.1:8888/safebrowsing-dummy/newkey");
user_pref("browser.safebrowsing.updateURL", "http://127.0.0.1:8888/safebrowsing-dummy/update");
// Point update checks to the local testing server for fast failures
user_pref("extensions.update.url", "http://127.0.0.1:8888/extensions-dummy/updateURL");
user_pref("extensions.update.background.url", "http://127.0.0.1:8888/extensions-dummy/updateBackgroundURL");
user_pref("extensions.blocklist.url", "http://127.0.0.1:8888/extensions-dummy/blocklistURL");
user_pref("extensions.hotfix.url", "http://127.0.0.1:8888/extensions-dummy/hotfixURL");
// Turn off extension updates so they don't bother tests
user_pref("extensions.update.enabled", false);
// Make sure opening about:addons won't hit the network
user_pref("extensions.webservice.discoverURL", "http://127.0.0.1:8888/extensions-dummy/discoveryURL");
// Make sure AddonRepository won't hit the network
user_pref("extensions.getAddons.maxResults", 0);
user_pref("extensions.getAddons.get.url", "http://127.0.0.1:8888/extensions-dummy/repositoryGetURL");
user_pref("extensions.getAddons.getWithPerformance.url", "http://127.0.0.1:8888/extensions-dummy/repositoryGetWithPerformanceURL");
user_pref("extensions.getAddons.search.browseURL", "http://127.0.0.1:8888/extensions-dummy/repositoryBrowseURL");
user_pref("extensions.getAddons.search.url", "http://127.0.0.1:8888/extensions-dummy/repositorySearchURL");
// Make sure that opening the plugins check page won't hit the network
user_pref("plugins.update.url", "http://127.0.0.1:8888/plugins-dummy/updateCheckURL");

""" % reftestlist)

        #workaround for jsreftests.
        if options.enablePrivilege:
            fhandle.write("""
user_pref("capability.principal.codebase.p2.granted", "UniversalXPConnect");
user_pref("capability.principal.codebase.p2.id", "http://%s:%s");
""" % (options.remoteWebServer, options.httpPort))

        # Close the file
        fhandle.close()

        try:
            self._devicemanager.pushDir(profileDir, options.remoteProfile)
        except devicemanager.DMError:
            print "Automation Error: Failed to copy profiledir to device"
            raise
예제 #12
0
    def cleanup(self, profileDir):
        # Pull results back from device
        if (self.remoteLogFile):
            try:
                self._devicemanager.getFile(self.remoteLogFile,
                                            self.localLogName)
            except:
                print "ERROR: We were not able to retrieve the info from %s" % self.remoteLogFile
                sys.exit(5)

        # Delete any bundled extensions
        extensionDir = os.path.join(profileDir, 'extensions', 'staged')
        for filename in os.listdir(extensionDir):
            try:
                self._devicemanager._checkCmdAs([
                    'shell', 'rm', '-rf',
                    os.path.join(self.bundlesDir, filename)
                ])
            except devicemanager.DMError:
                pass

        # Restore the original profiles.ini.
        if self.originalProfilesIni:
            try:
                if not self._automation._is_emulator:
                    self.restoreProfilesIni()
                os.remove(self.originalProfilesIni)
            except:
                pass

        if not self._automation._is_emulator:
            self._devicemanager.removeFile(self.remoteLogFile)
            self._devicemanager.removeDir(self.remoteProfile)
            self._devicemanager.removeDir(self.remoteTestRoot)

            # Restore the original user.js.
            self._devicemanager._checkCmdAs(['shell', 'rm', '-f', self.userJS])
            if self._devicemanager._useDDCopy:
                self._devicemanager._checkCmdAs([
                    'shell', 'dd',
                    'if=%s.orig' % self.userJS,
                    'of=%s' % self.userJS
                ])
            else:
                self._devicemanager._checkCmdAs(
                    ['shell', 'cp',
                     '%s.orig' % self.userJS, self.userJS])

            # We've restored the original profile, so reboot the device so that
            # it gets picked up.
            self._automation.rebootDevice()

        RefTest.cleanup(self, profileDir)
        if getattr(self, 'pidFile', '') != '':
            try:
                os.remove(self.pidFile)
                os.remove(self.pidFile + ".xpcshell.pid")
            except:
                print "Warning: cleaning up pidfile '%s' was unsuccessful from the test harness" % self.pidFile
 def __init__(self, marionette_args):
     RefTest.__init__(self)
     self.last_test = os.path.basename(__file__)
     self.marionette_args = marionette_args
     self.profile = None
     self.runner = None
     self.test_script = os.path.join(here, 'b2g_start_script.js')
     self.timeout = None
예제 #14
0
 def __init__(self, marionette_args):
     RefTest.__init__(self)
     self.last_test = os.path.basename(__file__)
     self.marionette_args = marionette_args
     self.profile = None
     self.runner = None
     self.test_script = os.path.join(here, 'b2g_start_script.js')
     self.timeout = None
예제 #15
0
 def copyExtraFilesToProfile(self, options, profile):
     profileDir = profile.profile
     RefTest.copyExtraFilesToProfile(self, options, profile)
     try:
         self._devicemanager.pushDir(profileDir, options.remoteProfile)
         self._devicemanager.chmodDir(options.remoteProfile)
     except mozdevice.DMError:
         print "Automation Error: Failed to copy extra files to device"
         raise
예제 #16
0
 def copyExtraFilesToProfile(self, options, profile):
     profileDir = profile.profile
     RefTest.copyExtraFilesToProfile(self, options, profile)
     try:
         self._devicemanager.pushDir(profileDir, options.remoteProfile)
         self._devicemanager.chmodDir(options.remoteProfile)
     except mozdevice.DMError:
         print "Automation Error: Failed to copy extra files to device"
         raise
예제 #17
0
 def copyExtraFilesToProfile(self, options, profile):
     profileDir = profile.profile
     RefTest.copyExtraFilesToProfile(self, options, profile)
     if len(os.listdir(profileDir)) > 0:
         try:
             self.device.push(profileDir, options.remoteProfile)
             self.device.chmod(options.remoteProfile, recursive=True)
         except Exception:
             print "Automation Error: Failed to copy extra files to device"
             raise
예제 #18
0
    def createReftestProfile(self, options, profileDir, reftestlist):
        RefTest.createReftestProfile(self, options, profileDir, reftestlist, server=options.remoteWebServer)

        # Turn off the locale picker screen
        fhandle = open(os.path.join(profileDir, "user.js"), 'a')
        fhandle.write("""
user_pref("browser.firstrun.show.localepicker", false);
user_pref("font.size.inflation.emPerLine", 0);
user_pref("font.size.inflation.minTwips", 0);
user_pref("reftest.remote", true);
// Set a future policy version to avoid the telemetry prompt.
user_pref("toolkit.telemetry.prompted", 999);
user_pref("toolkit.telemetry.notifiedOptOut", 999);
user_pref("reftest.uri", "%s");
user_pref("datareporting.policy.dataSubmissionPolicyBypassAcceptance", true);

// Point the url-classifier to the local testing server for fast failures
user_pref("browser.safebrowsing.gethashURL", "http://127.0.0.1:8888/safebrowsing-dummy/gethash");
user_pref("browser.safebrowsing.keyURL", "http://127.0.0.1:8888/safebrowsing-dummy/newkey");
user_pref("browser.safebrowsing.updateURL", "http://127.0.0.1:8888/safebrowsing-dummy/update");
// Point update checks to the local testing server for fast failures
user_pref("extensions.update.url", "http://127.0.0.1:8888/extensions-dummy/updateURL");
user_pref("extensions.update.background.url", "http://127.0.0.1:8888/extensions-dummy/updateBackgroundURL");
user_pref("extensions.blocklist.url", "http://127.0.0.1:8888/extensions-dummy/blocklistURL");
user_pref("extensions.hotfix.url", "http://127.0.0.1:8888/extensions-dummy/hotfixURL");
// Turn off extension updates so they don't bother tests
user_pref("extensions.update.enabled", false);
// Make sure opening about:addons won't hit the network
user_pref("extensions.webservice.discoverURL", "http://127.0.0.1:8888/extensions-dummy/discoveryURL");
// Make sure AddonRepository won't hit the network
user_pref("extensions.getAddons.maxResults", 0);
user_pref("extensions.getAddons.get.url", "http://127.0.0.1:8888/extensions-dummy/repositoryGetURL");
user_pref("extensions.getAddons.getWithPerformance.url", "http://127.0.0.1:8888/extensions-dummy/repositoryGetWithPerformanceURL");
user_pref("extensions.getAddons.search.browseURL", "http://127.0.0.1:8888/extensions-dummy/repositoryBrowseURL");
user_pref("extensions.getAddons.search.url", "http://127.0.0.1:8888/extensions-dummy/repositorySearchURL");
// Make sure that opening the plugins check page won't hit the network
user_pref("plugins.update.url", "http://127.0.0.1:8888/plugins-dummy/updateCheckURL");

""" % reftestlist)

        #workaround for jsreftests.
        if options.enablePrivilege:
            fhandle.write("""
user_pref("capability.principal.codebase.p2.granted", "UniversalXPConnect");
user_pref("capability.principal.codebase.p2.id", "http://%s:%s");
""" % (options.remoteWebServer, options.httpPort))

        # Close the file
        fhandle.close()

        try:
            self._devicemanager.pushDir(profileDir, options.remoteProfile)
        except devicemanager.DMError:
            print "Automation Error: Failed to copy profiledir to device"
            raise
예제 #19
0
    def cleanup(self, profileDir):
        # Pull results back from device
        if (self.remoteLogFile):
            try:
                self._devicemanager.getFile(self.remoteLogFile,
                                            self.localLogName)
            except:
                print "ERROR: We were not able to retrieve the info from %s" % self.remoteLogFile
                sys.exit(5)

        # Delete any bundled extensions
        extensionDir = os.path.join(profileDir, 'extensions', 'staged')
        for filename in os.listdir(extensionDir):
            try:
                self._devicemanager._checkCmdAs([
                    'shell', 'rm', '-rf',
                    os.path.join(self.bundlesDir, filename)
                ])
            except devicemanager.DMError:
                pass

        # Restore the original profiles.ini.
        if self.originalProfilesIni:
            try:
                if not self._automation._is_emulator:
                    self.restoreProfilesIni()
                os.remove(self.originalProfilesIni)
            except:
                pass

        if not self._automation._is_emulator:
            self._devicemanager.removeFile(self.remoteLogFile)
            self._devicemanager.removeDir(self.remoteProfile)
            self._devicemanager.removeDir(self.remoteTestRoot)

            # Restore the original user.js.
            self._devicemanager._checkCmdAs(['shell', 'rm', '-f', self.userJS])
            self._devicemanager._checkCmdAs([
                'shell', 'dd',
                'if=%s.orig' % self.userJS,
                'of=%s' % self.userJS
            ])

            # We've restored the original profile, so reboot the device so that
            # it gets picked up.
            self._automation.rebootDevice()

        RefTest.cleanup(self, profileDir)
        if getattr(self, 'pidFile', '') != '':
            try:
                os.remove(self.pidFile)
                os.remove(self.pidFile + ".xpcshell.pid")
            except:
                print "Warning: cleaning up pidfile '%s' was unsuccessful from the test harness" % self.pidFile
예제 #20
0
 def cleanup(self, profileDir):
     self.device.rm(self.remoteTestRoot,
                    force=True,
                    recursive=True,
                    root=True)
     self.device.rm(self.remoteProfile,
                    force=True,
                    recursive=True,
                    root=True)
     self.device.rm(self.remoteCache, force=True, recursive=True, root=True)
     RefTest.cleanup(self, profileDir)
예제 #21
0
 def cleanup(self, profileDir):
     # Pull results back from device
     if (self.remoteLogFile):
         self._devicemanager.getFile(self.remoteLogFile, self.localLogName)
     self._devicemanager.removeDir(self.remoteProfile)
     self._devicemanager.removeDir(self.remoteTestRoot)
     RefTest.cleanup(self, profileDir)
     if (self.pidFile != ""):
         try:
             os.remove(self.pidFile)
         except:
             print "Warning: cleaning up pidfile '%s' was unsuccessful from the test harness" % self.pidFile
예제 #22
0
 def __init__(self, automation, devicemanager, options, scriptDir):
     RefTest.__init__(self, automation)
     self._devicemanager = devicemanager
     self.scriptDir = scriptDir
     self.remoteApp = options.app
     self.remoteProfile = options.remoteProfile
     self.remoteTestRoot = options.remoteTestRoot
     self.remoteLogFile = options.remoteLogFile
     self.localLogName = options.localLogName
     if self.automation.IS_DEBUG_BUILD:
         self.SERVER_STARTUP_TIMEOUT = 180
     else:
         self.SERVER_STARTUP_TIMEOUT = 90
예제 #23
0
 def __init__(self, automation, devicemanager, options, scriptDir):
     RefTest.__init__(self, automation)
     self._devicemanager = devicemanager
     self.scriptDir = scriptDir
     self.remoteApp = options.app
     self.remoteProfile = options.remoteProfile
     self.remoteTestRoot = options.remoteTestRoot
     self.remoteLogFile = options.remoteLogFile
     self.localLogName = options.localLogName
     if self.automation.IS_DEBUG_BUILD:
         self.SERVER_STARTUP_TIMEOUT = 180
     else:
         self.SERVER_STARTUP_TIMEOUT = 90
예제 #24
0
    def createReftestProfile(self, options, profileDir):
        RefTest.createReftestProfile(self, options, profileDir, server=options.remoteWebServer)

        #workaround for jsreftests.
        if options.enablePrivilege:
          fhandle = open(os.path.join(profileDir, "user.js"), 'a')
          fhandle.write("""
user_pref("capability.principal.codebase.p2.granted", "UniversalPreferencesWrite UniversalXPConnect UniversalBrowserWrite UniversalPreferencesRead UniversalBrowserRead");
user_pref("capability.principal.codebase.p2.id", "http://%s:%s");
""" % (options.remoteWebServer, options.httpPort))
          fhandle.close()

        if (self._devicemanager.pushDir(profileDir, options.remoteProfile) == None):
            raise devicemanager.FileError("Failed to copy profiledir to device")
예제 #25
0
    def createReftestProfile(self, options, profileDir):
        RefTest.createReftestProfile(self, options, profileDir, server=options.remoteWebServer)

        #workaround for jsreftests.
        if options.enablePrivilege:
          fhandle = open(os.path.join(profileDir, "user.js"), 'a')
          fhandle.write("""
user_pref("capability.principal.codebase.p2.granted", "UniversalPreferencesWrite UniversalXPConnect UniversalBrowserWrite UniversalPreferencesRead UniversalBrowserRead");
user_pref("capability.principal.codebase.p2.id", "http://%s:%s");
""" % (options.remoteWebServer, options.httpPort))
          fhandle.close()

        if (self._devicemanager.pushDir(profileDir, options.remoteProfile) == None):
            raise devicemanager.FileError("Failed to copy profiledir to device")
예제 #26
0
 def cleanup(self, profileDir):
     # Pull results back from device
     if self.remoteLogFile and self._devicemanager.fileExists(self.remoteLogFile):
         self._devicemanager.getFile(self.remoteLogFile, self.localLogName)
     else:
         print "WARNING: Unable to retrieve log file (%s) from remote " "device" % self.remoteLogFile
     self._devicemanager.removeDir(self.remoteProfile)
     self._devicemanager.removeDir(self.remoteTestRoot)
     RefTest.cleanup(self, profileDir)
     if self.pidFile != "":
         try:
             os.remove(self.pidFile)
             os.remove(self.pidFile + ".xpcshell.pid")
         except:
             print "Warning: cleaning up pidfile '%s' was unsuccessful from the test harness" % self.pidFile
예제 #27
0
    def createReftestProfile(self, options, manifest, startAfter=None):
        profile = RefTest.createReftestProfile(self,
                                               options,
                                               manifest,
                                               server=options.remoteWebServer,
                                               port=options.httpPort)
        if startAfter is not None:
            print ("WARNING: Continuing after a crash is not supported for remote "
                   "reftest yet.")
        profileDir = profile.profile

        prefs = {}
        prefs["app.update.url.android"] = ""
        prefs["browser.firstrun.show.localepicker"] = False
        prefs["reftest.remote"] = True
        prefs["datareporting.policy.dataSubmissionPolicyBypassAcceptance"] = True

        prefs["layout.css.devPixelsPerPx"] = "1.0"
        # Because Fennec is a little wacky (see bug 1156817) we need to load the
        # reftest pages at 1.0 zoom, rather than zooming to fit the CSS viewport.
        prefs["apz.allow_zooming"] = False

        # Set the extra prefs.
        profile.set_preferences(prefs)

        try:
            self._devicemanager.pushDir(profileDir, options.remoteProfile)
            self._devicemanager.chmodDir(options.remoteProfile)
        except mozdevice.DMError:
            print "Automation Error: Failed to copy profiledir to device"
            raise

        return profile
예제 #28
0
    def createReftestProfile(self, options, manifest, startAfter=None):
        profile = RefTest.createReftestProfile(self,
                                               options,
                                               manifest,
                                               server=options.remoteWebServer,
                                               port=options.httpPort)
        if startAfter is not None:
            print ("WARNING: Continuing after a crash is not supported for remote "
                   "reftest yet.")
        profileDir = profile.profile

        prefs = {}
        prefs["app.update.url.android"] = ""
        prefs["browser.firstrun.show.localepicker"] = False
        prefs["reftest.remote"] = True
        prefs["datareporting.policy.dataSubmissionPolicyBypassAcceptance"] = True
        # move necko cache to a location that can be cleaned up
        prefs["browser.cache.disk.parent_directory"] = self.remoteCache

        prefs["layout.css.devPixelsPerPx"] = "1.0"
        # Because Fennec is a little wacky (see bug 1156817) we need to load the
        # reftest pages at 1.0 zoom, rather than zooming to fit the CSS viewport.
        prefs["apz.allow_zooming"] = False

        # Set the extra prefs.
        profile.set_preferences(prefs)

        try:
            self._devicemanager.pushDir(profileDir, options.remoteProfile)
            self._devicemanager.chmodDir(options.remoteProfile)
        except mozdevice.DMError:
            print "Automation Error: Failed to copy profiledir to device"
            raise

        return profile
예제 #29
0
    def createReftestProfile(self, options, manifest):
        profile = RefTest.createReftestProfile(self,
                                               options,
                                               manifest,
                                               server=options.remoteWebServer,
                                               port=options.httpPort)
        profileDir = profile.profile

        prefs = {}
        prefs["app.update.url.android"] = ""
        prefs["browser.firstrun.show.localepicker"] = False
        prefs["reftest.remote"] = True
        prefs[
            "datareporting.policy.dataSubmissionPolicyBypassAcceptance"] = True

        prefs["layout.css.devPixelsPerPx"] = "1.0"
        # Because Fennec is a little wacky (see bug 1156817) we need to load the
        # reftest pages at 1.0 zoom, rather than zooming to fit the CSS viewport.
        prefs["apz.allow_zooming"] = False

        # Set the extra prefs.
        profile.set_preferences(prefs)

        try:
            self._devicemanager.pushDir(profileDir, options.remoteProfile)
            self._devicemanager.chmodDir(options.remoteProfile)
        except mozdevice.DMError:
            print "Automation Error: Failed to copy profiledir to device"
            raise

        return profile
예제 #30
0
    def create_profile(self, options, manifests, profile_to_clone=None):
        profile = RefTest.createReftestProfile(
            self, options, manifests, profile_to_clone=profile_to_clone)

        prefs = {}
        # Turn off the locale picker screen
        prefs["browser.firstrun.show.localepicker"] = False
        if not self.build_type == "mulet":
            # FIXME: With Mulet we can't set this values since Gaia won't launch
            prefs["b2g.system_startup_url"] = \
                    "app://test-container.gaiamobile.org/index.html"
            prefs["b2g.system_manifest_url"] = \
                    "app://test-container.gaiamobile.org/manifest.webapp"
        # Make sure we disable system updates
        prefs["app.update.enabled"] = False
        prefs["app.update.url"] = ""
        prefs["app.update.url.override"] = ""
        # Disable webapp updates
        prefs["webapps.update.enabled"] = False
        # Disable tiles also
        prefs["browser.newtabpage.directory.source"] = ""
        prefs["browser.newtabpage.directory.ping"] = ""
        prefs["dom.ipc.tabs.disabled"] = False
        prefs["dom.mozBrowserFramesEnabled"] = True
        prefs["font.size.inflation.emPerLine"] = 0
        prefs["font.size.inflation.minTwips"] = 0
        prefs[
            "network.dns.localDomains"] = "app://test-container.gaiamobile.org"
        prefs["reftest.browser.iframe.enabled"] = False
        prefs["reftest.remote"] = False

        # Set the extra prefs.
        profile.set_preferences(prefs)
        return profile
예제 #31
0
    def create_profile(self, options, reftestlist, profile_to_clone=None):
        profile = RefTest.createReftestProfile(self, options, reftestlist,
                                               profile_to_clone=profile_to_clone)

        prefs = {}
        # Turn off the locale picker screen
        prefs["browser.firstrun.show.localepicker"] = False
        prefs["browser.homescreenURL"] = "app://test-container.gaiamobile.org/index.html"
        prefs["browser.manifestURL"] = "app://test-container.gaiamobile.org/manifest.webapp"
        prefs["browser.tabs.remote"] = False
        prefs["dom.ipc.tabs.disabled"] = False
        prefs["dom.mozBrowserFramesEnabled"] = True
        prefs["font.size.inflation.emPerLine"] = 0
        prefs["font.size.inflation.minTwips"] = 0
        prefs["network.dns.localDomains"] = "app://test-container.gaiamobile.org"
        prefs["reftest.browser.iframe.enabled"] = False
        prefs["reftest.remote"] = False
        prefs["reftest.uri"] = "%s" % reftestlist
        # Set a future policy version to avoid the telemetry prompt.
        prefs["toolkit.telemetry.prompted"] = 999
        prefs["toolkit.telemetry.notifiedOptOut"] = 999

        # Set the extra prefs.
        profile.set_preferences(prefs)
        return profile
예제 #32
0
    def create_profile(self, options, manifests, profile_to_clone=None):
        profile = RefTest.createReftestProfile(self, options, manifests,
                                               profile_to_clone=profile_to_clone)

        prefs = {}
        # Turn off the locale picker screen
        prefs["browser.firstrun.show.localepicker"] = False
        if not self.build_type == "mulet":
            # FIXME: With Mulet we can't set this values since Gaia won't launch
            prefs["b2g.system_startup_url"] = \
                    "app://test-container.gaiamobile.org/index.html"
            prefs["b2g.system_manifest_url"] = \
                    "app://test-container.gaiamobile.org/manifest.webapp"
        # Make sure we disable system updates
        prefs["app.update.enabled"] = False
        prefs["app.update.url"] = ""
        # Disable webapp updates
        prefs["webapps.update.enabled"] = False
        # Disable tiles also
        prefs["browser.newtabpage.directory.source"] = ""
        prefs["browser.newtabpage.directory.ping"] = ""
        prefs["dom.ipc.tabs.disabled"] = False
        prefs["dom.mozBrowserFramesEnabled"] = True
        prefs["font.size.inflation.emPerLine"] = 0
        prefs["font.size.inflation.minTwips"] = 0
        prefs["network.dns.localDomains"] = "app://test-container.gaiamobile.org"
        prefs["reftest.browser.iframe.enabled"] = False
        prefs["reftest.remote"] = False

        # Set the extra prefs.
        profile.set_preferences(prefs)
        return profile
예제 #33
0
    def create_profile(self, options, reftestlist, profile_to_clone=None):
        profile = RefTest.createReftestProfile(
            self, options, reftestlist, profile_to_clone=profile_to_clone)

        prefs = {}
        # Turn off the locale picker screen
        prefs["browser.firstrun.show.localepicker"] = False
        prefs[
            "b2g.system_startup_url"] = "app://test-container.gaiamobile.org/index.html"
        prefs[
            "b2g.system_manifest_url"] = "app://test-container.gaiamobile.org/manifest.webapp"
        prefs["browser.tabs.remote"] = False
        prefs["dom.ipc.tabs.disabled"] = False
        prefs["dom.mozBrowserFramesEnabled"] = True
        prefs["font.size.inflation.emPerLine"] = 0
        prefs["font.size.inflation.minTwips"] = 0
        prefs[
            "network.dns.localDomains"] = "app://test-container.gaiamobile.org"
        prefs["reftest.browser.iframe.enabled"] = False
        prefs["reftest.remote"] = False
        prefs["reftest.uri"] = "%s" % reftestlist
        # Set a future policy version to avoid the telemetry prompt.
        prefs["toolkit.telemetry.prompted"] = 999
        prefs["toolkit.telemetry.notifiedOptOut"] = 999

        # Set the extra prefs.
        profile.set_preferences(prefs)
        return profile
예제 #34
0
    def create_profile(self, options, reftestlist, profile_to_clone=None):
        profile = RefTest.createReftestProfile(self, options, reftestlist,
                                               profile_to_clone=profile_to_clone)

        prefs = {}
        # Turn off the locale picker screen
        prefs["browser.firstrun.show.localepicker"] = False
        if not self.build_type == "mulet":
            # FIXME: With Mulet we can't set this values since Gaia won't launch
            prefs["b2g.system_startup_url"] = \
                    "app://test-container.gaiamobile.org/index.html"
            prefs["b2g.system_manifest_url"] = \
                    "app://test-container.gaiamobile.org/manifest.webapp"
        prefs["dom.ipc.tabs.disabled"] = False
        prefs["dom.mozBrowserFramesEnabled"] = True
        prefs["font.size.inflation.emPerLine"] = 0
        prefs["font.size.inflation.minTwips"] = 0
        prefs["network.dns.localDomains"] = "app://test-container.gaiamobile.org"
        prefs["reftest.browser.iframe.enabled"] = False
        prefs["reftest.remote"] = False
        prefs["reftest.uri"] = "%s" % reftestlist
        # Set a future policy version to avoid the telemetry prompt.
        prefs["toolkit.telemetry.prompted"] = 999
        prefs["toolkit.telemetry.notifiedOptOut"] = 999

        # Set the extra prefs.
        profile.set_preferences(prefs)
        return profile
예제 #35
0
    def createReftestProfile(self, options, **kwargs):
        profile = RefTest.createReftestProfile(self,
                                               options,
                                               server=options.remoteWebServer,
                                               port=options.httpPort,
                                               **kwargs)
        profileDir = profile.profile
        prefs = {}
        prefs["app.update.url.android"] = ""
        prefs["reftest.remote"] = True
        prefs[
            "datareporting.policy.dataSubmissionPolicyBypassAcceptance"] = True
        # move necko cache to a location that can be cleaned up
        prefs["browser.cache.disk.parent_directory"] = self.remoteCache

        prefs["layout.css.devPixelsPerPx"] = "1.0"
        # Because Fennec is a little wacky (see bug 1156817) we need to load the
        # reftest pages at 1.0 zoom, rather than zooming to fit the CSS viewport.
        prefs["apz.allow_zooming"] = False

        # Set the extra prefs.
        profile.set_preferences(prefs)

        try:
            self.device.push(profileDir, options.remoteProfile)
            self.device.chmod(options.remoteProfile, recursive=True, root=True)
        except Exception:
            print "Automation Error: Failed to copy profiledir to device"
            raise

        return profile
예제 #36
0
    def createReftestProfile(self, options, reftestlist):
        profile = RefTest.createReftestProfile(self, options, reftestlist,
                                               server=options.remoteWebServer,
                                               special_powers=False)
        profileDir = profile.profile

        prefs = {}
        # Turn off the locale picker screen
        prefs["browser.firstrun.show.localepicker"] = False
        prefs["browser.homescreenURL"] = "app://system.gaiamobile.org"
        prefs["browser.manifestURL"] = "app://system.gaiamobile.org/manifest.webapp"
        prefs["browser.tabs.remote"] = False
        prefs["dom.ipc.browser_frames.oop_by_default"] = True
        prefs["dom.ipc.tabs.disabled"] = False
        prefs["dom.mozBrowserFramesEnabled"] = True
        prefs["dom.mozBrowserFramesWhitelist"] = "app://system.gaiamobile.org"
        prefs["network.dns.localDomains"] = "app://system.gaiamobile.org"
        prefs["font.size.inflation.emPerLine"] = 0
        prefs["font.size.inflation.minTwips"] = 0
        prefs["reftest.browser.iframe.enabled"] = False
        prefs["reftest.remote"] = True
        prefs["reftest.uri"] = "%s" % reftestlist
        # Set a future policy version to avoid the telemetry prompt.
        prefs["toolkit.telemetry.prompted"] = 999
        prefs["toolkit.telemetry.notifiedOptOut"] = 999

        # Set the extra prefs.
        profile.set_preferences(prefs)

        # Copy the profile to the device.
        self._devicemanager.removeDir(self.remoteProfile)
        try:
            self._devicemanager.pushDir(profileDir, self.remoteProfile)
        except DMError:
            print "Automation Error: Unable to copy profile to device."
            raise

        # Copy the extensions to the B2G bundles dir.
        extensionDir = os.path.join(profileDir, 'extensions', 'staged')
        # need to write to read-only dir
        self._devicemanager._checkCmdAs(['remount'])
        for filename in os.listdir(extensionDir):
            self._devicemanager._checkCmdAs(['shell', 'rm', '-rf',
                                             os.path.join(self.bundlesDir, filename)])
        try:
            self._devicemanager.pushDir(extensionDir, self.bundlesDir)
        except DMError:
            print "Automation Error: Unable to copy extensions to device."
            raise

        # In B2G, user.js is always read from /data/local, not the profile
        # directory.  Backup the original user.js first so we can restore it.
        self._devicemanager._checkCmdAs(['shell', 'rm', '-f', '%s.orig' % self.userJS])
        self._devicemanager._checkCmdAs(['shell', 'dd', 'if=%s' % self.userJS, 'of=%s.orig' % self.userJS])
        self._devicemanager.pushFile(os.path.join(profileDir, "user.js"), self.userJS)

        self.updateProfilesIni(self.remoteProfile)

        options.profilePath = self.remoteProfile
        return profile
예제 #37
0
 def __init__(self, automation, devicemanager, options, scriptDir):
     RefTest.__init__(self, automation)
     self._devicemanager = devicemanager
     self.runSSLTunnel = False
     self.remoteTestRoot = options.remoteTestRoot
     self.remoteProfile = options.remoteProfile
     self.automation.setRemoteProfile(self.remoteProfile)
     self.localLogName = options.localLogName
     self.remoteLogFile = options.remoteLogFile
     self.bundlesDir = '/system/b2g/distribution/bundles'
     self.remoteMozillaPath = '/data/b2g/mozilla'
     self.remoteProfilesIniPath = os.path.join(self.remoteMozillaPath, 'profiles.ini')
     self.originalProfilesIni = None
     self.scriptDir = scriptDir
     self.SERVER_STARTUP_TIMEOUT = 90
     if self.automation.IS_DEBUG_BUILD:
         self.SERVER_STARTUP_TIMEOUT = 180
예제 #38
0
 def __init__(self, automation, devicemanager, options, scriptDir):
     RefTest.__init__(self, automation)
     self._devicemanager = devicemanager
     self.runSSLTunnel = False
     self.remoteTestRoot = options.remoteTestRoot
     self.remoteProfile = options.remoteProfile
     self.automation.setRemoteProfile(self.remoteProfile)
     self.localLogName = options.localLogName
     self.remoteLogFile = options.remoteLogFile
     self.bundlesDir = '/system/b2g/distribution/bundles'
     self.remoteMozillaPath = '/data/b2g/mozilla'
     self.remoteProfilesIniPath = os.path.join(self.remoteMozillaPath, 'profiles.ini')
     self.originalProfilesIni = None
     self.scriptDir = scriptDir
     self.SERVER_STARTUP_TIMEOUT = 90
     if self.automation.IS_DEBUG_BUILD:
         self.SERVER_STARTUP_TIMEOUT = 180
예제 #39
0
 def cleanup(self, profileDir):
     # Pull results back from device
     if (self.remoteLogFile):
         try:
             self._devicemanager.getFile(self.remoteLogFile, self.localLogName)
         except:
             print "ERROR: We were not able to retrieve the info from %s" % self.remoteLogFile
             sys.exit(5)
     self._devicemanager.removeDir(self.remoteProfile)
     self._devicemanager.removeDir(self.remoteTestRoot)
     RefTest.cleanup(self, profileDir)
     if (self.pidFile != ""):
         try:
             os.remove(self.pidFile)
             os.remove(self.pidFile + ".xpcshell.pid")
         except:
             print "Warning: cleaning up pidfile '%s' was unsuccessful from the test harness" % self.pidFile
예제 #40
0
 def cleanup(self, profileDir):
     # Pull results back from device
     if self.remoteLogFile and \
             self._devicemanager.fileExists(self.remoteLogFile):
         self._devicemanager.getFile(self.remoteLogFile, self.localLogName)
     else:
         print "WARNING: Unable to retrieve log file (%s) from remote " \
             "device" % self.remoteLogFile
     self._devicemanager.removeDir(self.remoteProfile)
     self._devicemanager.removeDir(self.remoteTestRoot)
     RefTest.cleanup(self, profileDir)
     if (self.pidFile != ""):
         try:
             os.remove(self.pidFile)
             os.remove(self.pidFile + ".xpcshell.pid")
         except:
             print "Warning: cleaning up pidfile '%s' was unsuccessful from the test harness" % self.pidFile
예제 #41
0
    def createReftestProfile(self, options, reftestlist):
        profile = RefTest.createReftestProfile(self, options, reftestlist,
                                               server=options.remoteWebServer,
                                               special_powers=False)
        profileDir = profile.profile

        prefs = {}
        # Turn off the locale picker screen
        prefs["browser.firstrun.show.localepicker"] = False
        prefs["browser.homescreenURL"] = "app://test-container.gaiamobile.org/index.html"
        prefs["browser.manifestURL"] = "app://test-container.gaiamobile.org/manifest.webapp"
        prefs["browser.tabs.remote"] = False
        prefs["dom.ipc.tabs.disabled"] = False
        prefs["dom.mozBrowserFramesEnabled"] = True
        prefs["font.size.inflation.emPerLine"] = 0
        prefs["font.size.inflation.minTwips"] = 0
        prefs["network.dns.localDomains"] = "app://test-container.gaiamobile.org"
        prefs["reftest.browser.iframe.enabled"] = False
        prefs["reftest.remote"] = True
        prefs["reftest.uri"] = "%s" % reftestlist
        # Set a future policy version to avoid the telemetry prompt.
        prefs["toolkit.telemetry.prompted"] = 999
        prefs["toolkit.telemetry.notifiedOptOut"] = 999

        # Set the extra prefs.
        profile.set_preferences(prefs)

        # Copy the profile to the device.
        self._devicemanager.removeDir(self.remoteProfile)
        try:
            self._devicemanager.pushDir(profileDir, self.remoteProfile)
        except DMError:
            print "Automation Error: Unable to copy profile to device."
            raise

        # Copy the extensions to the B2G bundles dir.
        extensionDir = os.path.join(profileDir, 'extensions', 'staged')
        # need to write to read-only dir
        self._devicemanager._checkCmd(['remount'])
        for filename in os.listdir(extensionDir):
            self._devicemanager._checkCmd(['shell', 'rm', '-rf',
                                             os.path.join(self.bundlesDir, filename)])
        try:
            self._devicemanager.pushDir(extensionDir, self.bundlesDir)
        except DMError:
            print "Automation Error: Unable to copy extensions to device."
            raise

        # In B2G, user.js is always read from /data/local, not the profile
        # directory.  Backup the original user.js first so we can restore it.
        self._devicemanager._checkCmd(['shell', 'rm', '-f', '%s.orig' % self.userJS])
        self._devicemanager._checkCmd(['shell', 'dd', 'if=%s' % self.userJS, 'of=%s.orig' % self.userJS])
        self._devicemanager.pushFile(os.path.join(profileDir, "user.js"), self.userJS)

        self.updateProfilesIni(self.remoteProfile)

        options.profilePath = self.remoteProfile
        return profile
예제 #42
0
    def createReftestProfile(self, options, reftestlist):
        profile = RefTest.createReftestProfile(self, options, reftestlist,
                                               server=options.remoteWebServer,
                                               special_powers=False)
        profileDir = profile.profile

        prefs = {}

        # Turn off the locale picker screen
        prefs["browser.firstrun.show.localepicker"] = False
        prefs["b2g.system_startup_url"] = "app://test-container.gaiamobile.org/index.html"
        prefs["b2g.system_manifest_url"] = "app://test-container.gaiamobile.org/manifest.webapp"
        prefs["browser.tabs.remote"] = False
        prefs["dom.ipc.tabs.disabled"] = False
        prefs["dom.mozBrowserFramesEnabled"] = True
        prefs["font.size.inflation.emPerLine"] = 0
        prefs["font.size.inflation.minTwips"] = 0
        prefs["network.dns.localDomains"] = "app://test-container.gaiamobile.org"
        prefs["reftest.browser.iframe.enabled"] = False
        prefs["reftest.remote"] = True
        prefs["reftest.uri"] = "%s" % reftestlist
        # Set a future policy version to avoid the telemetry prompt.
        prefs["toolkit.telemetry.prompted"] = 999
        prefs["toolkit.telemetry.notifiedOptOut"] = 999

        if options.oop:
            prefs['browser.tabs.remote'] = True
            prefs['browser.tabs.remote.autostart'] = True
            prefs['reftest.browser.iframe.enabled'] = True

        # Set the extra prefs.
        profile.set_preferences(prefs)

        # Copy the profile to the device.
        self._devicemanager.removeDir(self.remoteProfile)
        try:
            self._devicemanager.pushDir(profileDir, self.remoteProfile)
        except DMError:
            print "Automation Error: Unable to copy profile to device."
            raise

        # Copy the extensions to the B2G bundles dir.
        extensionDir = os.path.join(profileDir, 'extensions', 'staged')
        # need to write to read-only dir
        self._devicemanager._checkCmd(['remount'])
        for filename in os.listdir(extensionDir):
            self._devicemanager._checkCmd(['shell', 'rm', '-rf',
                                             os.path.join(self.bundlesDir, filename)])
        try:
            self._devicemanager.pushDir(extensionDir, self.bundlesDir)
        except DMError:
            print "Automation Error: Unable to copy extensions to device."
            raise

        self.updateProfilesIni(self.remoteProfile)

        options.profilePath = self.remoteProfile
        return profile
예제 #43
0
    def createReftestProfile(self, options, reftestlist):
        profile = RefTest.createReftestProfile(self, options, reftestlist,
                                               server=options.remoteWebServer,
                                               special_powers=False)
        profileDir = profile.profile

        prefs = {}

        # Turn off the locale picker screen
        prefs["browser.firstrun.show.localepicker"] = False
        prefs["b2g.system_startup_url"] = "app://test-container.gaiamobile.org/index.html"
        prefs["b2g.system_manifest_url"] = "app://test-container.gaiamobile.org/manifest.webapp"
        prefs["browser.tabs.remote"] = False
        prefs["dom.ipc.tabs.disabled"] = False
        prefs["dom.mozBrowserFramesEnabled"] = True
        prefs["font.size.inflation.emPerLine"] = 0
        prefs["font.size.inflation.minTwips"] = 0
        prefs["network.dns.localDomains"] = "app://test-container.gaiamobile.org"
        prefs["reftest.browser.iframe.enabled"] = False
        prefs["reftest.remote"] = True
        prefs["reftest.uri"] = "%s" % reftestlist
        # Set a future policy version to avoid the telemetry prompt.
        prefs["toolkit.telemetry.prompted"] = 999
        prefs["toolkit.telemetry.notifiedOptOut"] = 999

        if options.oop:
            prefs['browser.tabs.remote'] = True
            prefs['browser.tabs.remote.autostart'] = True
            prefs['reftest.browser.iframe.enabled'] = True

        # Set the extra prefs.
        profile.set_preferences(prefs)

        # Copy the profile to the device.
        self._devicemanager.removeDir(self.remoteProfile)
        try:
            self._devicemanager.pushDir(profileDir, self.remoteProfile)
        except DMError:
            print "Automation Error: Unable to copy profile to device."
            raise

        # Copy the extensions to the B2G bundles dir.
        extensionDir = os.path.join(profileDir, 'extensions', 'staged')
        # need to write to read-only dir
        self._devicemanager._checkCmd(['remount'])
        for filename in os.listdir(extensionDir):
            self._devicemanager._checkCmd(['shell', 'rm', '-rf',
                                             os.path.join(self.bundlesDir, filename)])
        try:
            self._devicemanager.pushDir(extensionDir, self.bundlesDir)
        except DMError:
            print "Automation Error: Unable to copy extensions to device."
            raise

        self.updateProfilesIni(self.remoteProfile)

        options.profilePath = self.remoteProfile
        return profile
 def cleanup(self, profileDir):
     # Pull results back from device
     if (self.remoteLogFile):
         try:
             self._devicemanager.getFile(self.remoteLogFile,
                                         self.localLogName)
         except:
             print "ERROR: We were not able to retrieve the info from %s" % self.remoteLogFile
             sys.exit(5)
     self._devicemanager.removeDir(self.remoteProfile)
     self._devicemanager.removeDir(self.remoteTestRoot)
     RefTest.cleanup(self, profileDir)
     if (self.pidFile != ""):
         try:
             os.remove(self.pidFile)
             os.remove(self.pidFile + ".xpcshell.pid")
         except:
             print "Warning: cleaning up pidfile '%s' was unsuccessful from the test harness" % self.pidFile
예제 #45
0
    def createReftestProfile(self, options, manifests):
        profile = RefTest.createReftestProfile(self, options, manifests,
                                               server=options.remoteWebServer)
        profileDir = profile.profile

        prefs = {}

        # Turn off the locale picker screen
        prefs["browser.firstrun.show.localepicker"] = False
        prefs["b2g.system_startup_url"] = "app://test-container.gaiamobile.org/index.html"
        prefs["b2g.system_manifest_url"] = "app://test-container.gaiamobile.org/manifest.webapp"
        prefs["dom.ipc.tabs.disabled"] = False
        prefs["dom.mozBrowserFramesEnabled"] = True
        prefs["font.size.inflation.emPerLine"] = 0
        prefs["font.size.inflation.minTwips"] = 0
        prefs["network.dns.localDomains"] = "app://test-container.gaiamobile.org"
        prefs["reftest.browser.iframe.enabled"] = False
        prefs["reftest.remote"] = True

        # Make sure we disable system updates
        prefs["app.update.enabled"] = False
        prefs["app.update.url"] = ""
        # Disable webapp updates
        prefs["webapps.update.enabled"] = False
        # Disable tiles also
        prefs["browser.newtabpage.directory.source"] = ""
        prefs["browser.newtabpage.directory.ping"] = ""

        # Set the extra prefs.
        profile.set_preferences(prefs)

        # Copy the profile to the device.
        self._devicemanager.removeDir(self.remoteProfile)
        try:
            self._devicemanager.pushDir(profileDir, self.remoteProfile)
        except DMError:
            print "Automation Error: Unable to copy profile to device."
            raise

        # Copy the extensions to the B2G bundles dir.
        extensionDir = os.path.join(profileDir, 'extensions', 'staged')
        # need to write to read-only dir
        self._devicemanager._checkCmd(['remount'])
        for filename in os.listdir(extensionDir):
            self._devicemanager._checkCmd(['shell', 'rm', '-rf',
                                             os.path.join(self.bundlesDir, filename)])
        try:
            self._devicemanager.pushDir(extensionDir, self.bundlesDir)
        except DMError:
            print "Automation Error: Unable to copy extensions to device."
            raise

        self.updateProfilesIni(self.remoteProfile)

        options.profilePath = self.remoteProfile
        return profile
예제 #46
0
    def createReftestProfile(self, options, manifests):
        profile = RefTest.createReftestProfile(self, options, manifests,
                                               server=options.remoteWebServer)
        profileDir = profile.profile

        prefs = {}

        # Turn off the locale picker screen
        prefs["browser.firstrun.show.localepicker"] = False
        prefs["b2g.system_startup_url"] = "app://test-container.gaiamobile.org/index.html"
        prefs["b2g.system_manifest_url"] = "app://test-container.gaiamobile.org/manifest.webapp"
        prefs["dom.ipc.tabs.disabled"] = False
        prefs["dom.mozBrowserFramesEnabled"] = True
        prefs["font.size.inflation.emPerLine"] = 0
        prefs["font.size.inflation.minTwips"] = 0
        prefs["network.dns.localDomains"] = "app://test-container.gaiamobile.org"
        prefs["reftest.browser.iframe.enabled"] = False
        prefs["reftest.remote"] = True

        # Make sure we disable system updates
        prefs["app.update.enabled"] = False
        prefs["app.update.url"] = ""
        # Disable webapp updates
        prefs["webapps.update.enabled"] = False
        # Disable tiles also
        prefs["browser.newtabpage.directory.source"] = ""
        prefs["browser.newtabpage.directory.ping"] = ""

        # Set the extra prefs.
        profile.set_preferences(prefs)

        # Copy the profile to the device.
        self._devicemanager.removeDir(self.remoteProfile)
        try:
            self._devicemanager.pushDir(profileDir, self.remoteProfile)
        except DMError:
            print "Automation Error: Unable to copy profile to device."
            raise

        # Copy the extensions to the B2G bundles dir.
        extensionDir = os.path.join(profileDir, 'extensions', 'staged')
        # need to write to read-only dir
        self._devicemanager._checkCmd(['remount'])
        for filename in os.listdir(extensionDir):
            self._devicemanager._checkCmd(['shell', 'rm', '-rf',
                                             os.path.join(self.bundlesDir, filename)])
        try:
            self._devicemanager.pushDir(extensionDir, self.bundlesDir)
        except DMError:
            print "Automation Error: Unable to copy extensions to device."
            raise

        self.updateProfilesIni(self.remoteProfile)

        options.profilePath = self.remoteProfile
        return profile
예제 #47
0
    def createReftestProfile(self, options, reftestlist):
        profile = RefTest.createReftestProfile(self, options, reftestlist, server=options.remoteWebServer, port=options.httpPort)
        profileDir = profile.profile

        prefs = {}
        prefs["app.update.url.android"] = ""
        prefs["browser.firstrun.show.localepicker"] = False
        prefs["font.size.inflation.emPerLine"] = 0
        prefs["font.size.inflation.minTwips"] = 0
        prefs["reftest.remote"] = True
        # Set a future policy version to avoid the telemetry prompt.
        prefs["toolkit.telemetry.prompted"] = 999
        prefs["toolkit.telemetry.notifiedOptOut"] = 999
        prefs["reftest.uri"] = "%s" % reftestlist
        prefs["datareporting.policy.dataSubmissionPolicyBypassAcceptance"] = True

        # Point the url-classifier to the local testing server for fast failures
        prefs["browser.safebrowsing.gethashURL"] = "http://127.0.0.1:8888/safebrowsing-dummy/gethash"
        prefs["browser.safebrowsing.updateURL"] = "http://127.0.0.1:8888/safebrowsing-dummy/update"
        # Point update checks to the local testing server for fast failures
        prefs["extensions.update.url"] = "http://127.0.0.1:8888/extensions-dummy/updateURL"
        prefs["extensions.update.background.url"] = "http://127.0.0.1:8888/extensions-dummy/updateBackgroundURL"
        prefs["extensions.blocklist.url"] = "http://127.0.0.1:8888/extensions-dummy/blocklistURL"
        prefs["extensions.hotfix.url"] = "http://127.0.0.1:8888/extensions-dummy/hotfixURL"
        # Turn off extension updates so they don't bother tests
        prefs["extensions.update.enabled"] = False
        # Make sure opening about:addons won't hit the network
        prefs["extensions.webservice.discoverURL"] = "http://127.0.0.1:8888/extensions-dummy/discoveryURL"
        # Make sure AddonRepository won't hit the network
        prefs["extensions.getAddons.maxResults"] = 0
        prefs["extensions.getAddons.get.url"] = "http://127.0.0.1:8888/extensions-dummy/repositoryGetURL"
        prefs["extensions.getAddons.getWithPerformance.url"] = "http://127.0.0.1:8888/extensions-dummy/repositoryGetWithPerformanceURL"
        prefs["extensions.getAddons.search.browseURL"] = "http://127.0.0.1:8888/extensions-dummy/repositoryBrowseURL"
        prefs["extensions.getAddons.search.url"] = "http://127.0.0.1:8888/extensions-dummy/repositorySearchURL"
        # Make sure that opening the plugins check page won't hit the network
        prefs["plugins.update.url"] = "http://127.0.0.1:8888/plugins-dummy/updateCheckURL"
        # Make sure the GMPInstallManager won't hit the network
        prefs["media.gmp-manager.url.override"] = "http://127.0.0.1:8888/dummy-gmp-manager.xml";
        prefs["layout.css.devPixelsPerPx"] = "1.0"
        # Because Fennec is a little wacky (see bug 1156817) we need to load the
        # reftest pages at 1.0 zoom, rather than zooming to fit the CSS viewport.
        prefs["apz.allow_zooming"] = False

        # Disable skia-gl: see bug 907351
        prefs["gfx.canvas.azure.accelerated"] = False

        # Set the extra prefs.
        profile.set_preferences(prefs)

        try:
            self._devicemanager.pushDir(profileDir, options.remoteProfile)
        except devicemanager.DMError:
            print "Automation Error: Failed to copy profiledir to device"
            raise

        return profile
예제 #48
0
    def createReftestProfile(self, options, profileDir, reftestlist):
        print "profileDir: " + str(profileDir)
        retVal = RefTest.createReftestProfile(self, options, profileDir, reftestlist, server=options.remoteWebServer)

        # Turn off the locale picker screen
        fhandle = open(os.path.join(profileDir, "user.js"), 'a')
        fhandle.write("""
user_pref("browser.firstrun.show.localepicker", false);
user_pref("browser.homescreenURL","app://system.gaiamobile.org");\n
user_pref("browser.manifestURL","app://system.gaiamobile.org/manifest.webapp");\n
user_pref("browser.tabs.remote", false);\n
user_pref("dom.ipc.browser_frames.oop_by_default", true);\n
user_pref("dom.ipc.tabs.disabled", false);\n
user_pref("dom.mozBrowserFramesEnabled", true);\n
user_pref("dom.mozBrowserFramesWhitelist","app://system.gaiamobile.org");\n
user_pref("network.dns.localDomains","app://system.gaiamobile.org");\n
user_pref("font.size.inflation.emPerLine", 0);
user_pref("font.size.inflation.minTwips", 0);
user_pref("reftest.browser.iframe.enabled", true);
user_pref("reftest.remote", true);
user_pref("reftest.uri", "%s");
user_pref("toolkit.telemetry.prompted", true);
""" % reftestlist)

        #workaround for jsreftests.
        if getattr(options, 'enablePrivilege', False):
            fhandle.write("""
user_pref("capability.principal.codebase.p2.granted", "UniversalXPConnect");
user_pref("capability.principal.codebase.p2.id", "http://%s:%s");
""" % (options.remoteWebServer, options.httpPort))

        # Close the file
        fhandle.close()

        # Copy the profile to the device.
        self._devicemanager.removeDir(self.remoteProfile)
        try:
            self._devicemanager.pushDir(profileDir, self.remoteProfile)
        except devicemanager.DMError:
            print "Automation Error: Unable to copy profile to device."
            raise

        # In B2G, user.js is always read from /data/local, not the profile
        # directory.  Backup the original user.js first so we can restore it.
        self._devicemanager._checkCmdAs(['shell', 'rm', '-f', '%s.orig' % self.userJS])
        if self._devicemanager.useDDCopy:
            self._devicemanager._checkCmdAs(['shell', 'dd', 'if=%s' % self.userJS, 'of=%s.orig' % self.userJS])
        else:
            self._devicemanager._checkCmdAs(['shell', 'cp', self.userJS, '%s.orig' % self.userJS])
        self._devicemanager.pushFile(os.path.join(profileDir, "user.js"), self.userJS)

        self.updateProfilesIni(self.remoteProfile)

        options.profilePath = self.remoteProfile
        return retVal
예제 #49
0
    def cleanup(self, profileDir):
        # Pull results back from device
        if (self.remoteLogFile):
            try:
                self._devicemanager.getFile(self.remoteLogFile, self.localLogName)
            except:
                print "ERROR: We were not able to retrieve the info from %s" % self.remoteLogFile
                sys.exit(5)

        # Restore the original profiles.ini.
        if self.originalProfilesIni:
            try:
                if not self._automation._is_emulator:
                    self.restoreProfilesIni()
                os.remove(self.originalProfilesIni)
            except:
                pass

        if not self._automation._is_emulator:
            self._devicemanager.removeFile(self.remoteLogFile)
            self._devicemanager.removeDir(self.remoteProfile)
            self._devicemanager.removeDir(self.remoteTestRoot)

            # Restore the original user.js.
            self._devicemanager.checkCmdAs(['shell', 'rm', '-f', self.userJS])
            if self._devicemanager.useDDCopy:
                self._devicemanager.checkCmdAs(['shell', 'dd', 'if=%s.orig' % self.userJS, 'of=%s' % self.userJS])
            else:
                self._devicemanager.checkCmdAs(['shell', 'cp', '%s.orig' % self.userJS, self.userJS])

            # We've restored the original profile, so reboot the device so that
            # it gets picked up.
            self._automation.rebootDevice()

        RefTest.cleanup(self, profileDir)
        if getattr(self, 'pidFile', '') != '':
            try:
                os.remove(self.pidFile)
                os.remove(self.pidFile + ".xpcshell.pid")
            except:
                print "Warning: cleaning up pidfile '%s' was unsuccessful from the test harness" % self.pidFile
예제 #50
0
    def createReftestProfile(self, options, reftestlist):
        profile = RefTest.createReftestProfile(self, options, reftestlist, server=options.remoteWebServer)
        profileDir = profile.profile

        prefs = {}
        prefs["app.update.url.android"] = ""
        prefs["browser.firstrun.show.localepicker"] = False
        prefs["font.size.inflation.emPerLine"] = 0
        prefs["font.size.inflation.minTwips"] = 0
        prefs["reftest.remote"] = True
        # Set a future policy version to avoid the telemetry prompt.
        prefs["toolkit.telemetry.prompted"] = 999
        prefs["toolkit.telemetry.notifiedOptOut"] = 999
        prefs["reftest.uri"] = "%s" % reftestlist
        prefs["datareporting.policy.dataSubmissionPolicyBypassAcceptance"] = True

        # Point the url-classifier to the local testing server for fast failures
        prefs["browser.safebrowsing.gethashURL"] = "http://127.0.0.1:8888/safebrowsing-dummy/gethash"
        prefs["browser.safebrowsing.updateURL"] = "http://127.0.0.1:8888/safebrowsing-dummy/update"
        # Point update checks to the local testing server for fast failures
        prefs["extensions.update.url"] = "http://127.0.0.1:8888/extensions-dummy/updateURL"
        prefs["extensions.update.background.url"] = "http://127.0.0.1:8888/extensions-dummy/updateBackgroundURL"
        prefs["extensions.blocklist.url"] = "http://127.0.0.1:8888/extensions-dummy/blocklistURL"
        prefs["extensions.hotfix.url"] = "http://127.0.0.1:8888/extensions-dummy/hotfixURL"
        # Turn off extension updates so they don't bother tests
        prefs["extensions.update.enabled"] = False
        # Make sure opening about:addons won't hit the network
        prefs["extensions.webservice.discoverURL"] = "http://127.0.0.1:8888/extensions-dummy/discoveryURL"
        # Make sure AddonRepository won't hit the network
        prefs["extensions.getAddons.maxResults"] = 0
        prefs["extensions.getAddons.get.url"] = "http://127.0.0.1:8888/extensions-dummy/repositoryGetURL"
        prefs["extensions.getAddons.getWithPerformance.url"] = "http://127.0.0.1:8888/extensions-dummy/repositoryGetWithPerformanceURL"
        prefs["extensions.getAddons.search.browseURL"] = "http://127.0.0.1:8888/extensions-dummy/repositoryBrowseURL"
        prefs["extensions.getAddons.search.url"] = "http://127.0.0.1:8888/extensions-dummy/repositorySearchURL"
        # Make sure that opening the plugins check page won't hit the network
        prefs["plugins.update.url"] = "http://127.0.0.1:8888/plugins-dummy/updateCheckURL"
        # Make sure the GMPInstallManager won't hit the network
        prefs["media.gmp-manager.url.override"] = "http://127.0.0.1:8888/dummy-gmp-manager.xml";
        prefs["layout.css.devPixelsPerPx"] = "1.0"

        # Disable skia-gl: see bug 907351
        prefs["gfx.canvas.azure.accelerated"] = False

        # Set the extra prefs.
        profile.set_preferences(prefs)

        try:
            self._devicemanager.pushDir(profileDir, options.remoteProfile)
        except devicemanager.DMError:
            print "Automation Error: Failed to copy profiledir to device"
            raise

        return profile
    def createReftestProfile(self, options, reftestlist):
        profile = RefTest.createReftestProfile(self, options, reftestlist, server=options.remoteWebServer)
        profileDir = profile.profile

        prefs = {}
        prefs["browser.firstrun.show.localepicker"] = False
        prefs["font.size.inflation.emPerLine"] = 0
        prefs["font.size.inflation.minTwips"] = 0
        prefs["reftest.remote"] = True
        # Set a future policy version to avoid the telemetry prompt.
        prefs["toolkit.telemetry.prompted"] = 999
        prefs["toolkit.telemetry.notifiedOptOut"] = 999
        prefs["reftest.uri"] = "%s" % reftestlist
        prefs["datareporting.policy.dataSubmissionPolicyBypassAcceptance"] = True

        # Point the url-classifier to the local testing server for fast failures
        prefs["browser.safebrowsing.gethashURL"] = "http://127.0.0.1:8888/safebrowsing-dummy/gethash"
        prefs["browser.safebrowsing.keyURL"] = "http://127.0.0.1:8888/safebrowsing-dummy/newkey"
        prefs["browser.safebrowsing.updateURL"] = "http://127.0.0.1:8888/safebrowsing-dummy/update"
        # Point update checks to the local testing server for fast failures
        prefs["extensions.update.url"] = "http://127.0.0.1:8888/extensions-dummy/updateURL"
        prefs["extensions.update.background.url"] = "http://127.0.0.1:8888/extensions-dummy/updateBackgroundURL"
        prefs["extensions.blocklist.url"] = "http://127.0.0.1:8888/extensions-dummy/blocklistURL"
        prefs["extensions.hotfix.url"] = "http://127.0.0.1:8888/extensions-dummy/hotfixURL"
        # Turn off extension updates so they don't bother tests
        prefs["extensions.update.enabled"] = False
        # Make sure opening about:addons won't hit the network
        prefs["extensions.webservice.discoverURL"] = "http://127.0.0.1:8888/extensions-dummy/discoveryURL"
        # Make sure AddonRepository won't hit the network
        prefs["extensions.getAddons.maxResults"] = 0
        prefs["extensions.getAddons.get.url"] = "http://127.0.0.1:8888/extensions-dummy/repositoryGetURL"
        prefs["extensions.getAddons.getWithPerformance.url"] = "http://127.0.0.1:8888/extensions-dummy/repositoryGetWithPerformanceURL"
        prefs["extensions.getAddons.search.browseURL"] = "http://127.0.0.1:8888/extensions-dummy/repositoryBrowseURL"
        prefs["extensions.getAddons.search.url"] = "http://127.0.0.1:8888/extensions-dummy/repositorySearchURL"
        # Make sure that opening the plugins check page won't hit the network
        prefs["plugins.update.url"] = "http://127.0.0.1:8888/plugins-dummy/updateCheckURL"

        # Workaround for jsreftests.
        if options.enablePrivilege:
            prefs["capability.principal.codebase.p2.granted"] = "UniversalXPConnect"
            prefs["capability.principal.codebase.p2.id"] = "http://%s:%s" % (options.remoteWebServer, options.httpPort)

        # Set the extra prefs.
        profile.set_preferences(prefs)

        try:
            self._devicemanager.pushDir(profileDir, options.remoteProfile)
        except devicemanager.DMError:
            print "Automation Error: Failed to copy profiledir to device"
            raise

        return profile
    def createReftestProfile(self, options, profileDir, reftestlist):
        print "profileDir: " + str(profileDir)
        retVal = RefTest.createReftestProfile(self, options, profileDir, reftestlist, server=options.remoteWebServer)

        # Turn off the locale picker screen
        fhandle = open(os.path.join(profileDir, "user.js"), 'a')
        fhandle.write("""
user_pref("browser.firstrun.show.localepicker", false);
user_pref("browser.homescreenURL","app://system.gaiamobile.org");\n
user_pref("browser.manifestURL","app://system.gaiamobile.org/manifest.webapp");\n
user_pref("browser.tabs.remote", false);\n
user_pref("dom.ipc.browser_frames.oop_by_default", true);\n
user_pref("dom.ipc.tabs.disabled", false);\n
user_pref("dom.mozBrowserFramesEnabled", true);\n
user_pref("dom.mozBrowserFramesWhitelist","app://system.gaiamobile.org");\n
user_pref("network.dns.localDomains","app://system.gaiamobile.org");\n
user_pref("font.size.inflation.emPerLine", 0);
user_pref("font.size.inflation.minTwips", 0);
user_pref("reftest.browser.iframe.enabled", true);
user_pref("reftest.remote", true);
user_pref("reftest.uri", "%s");
user_pref("toolkit.telemetry.prompted", true);
""" % reftestlist)

        #workaround for jsreftests.
        if getattr(options, 'enablePrivilege', False):
            fhandle.write("""
user_pref("capability.principal.codebase.p2.granted", "UniversalXPConnect");
user_pref("capability.principal.codebase.p2.id", "http://%s:%s");
""" % (options.remoteWebServer, options.httpPort))

        # Close the file
        fhandle.close()

        # Copy the profile to the device.
        self._devicemanager.removeDir(self.remoteProfile)
        if self._devicemanager.pushDir(profileDir, self.remoteProfile) == None:
            raise devicemanager.FileError("Unable to copy profile to device.")

        # In B2G, user.js is always read from /data/local, not the profile
        # directory.  Backup the original user.js first so we can restore it.
        self._devicemanager.checkCmdAs(['shell', 'rm', '-f', '%s.orig' % self.userJS])
        if self._devicemanager.useDDCopy:
            self._devicemanager.checkCmdAs(['shell', 'dd', 'if=%s' % self.userJS, 'of=%s.orig' % self.userJS])
        else:
            self._devicemanager.checkCmdAs(['shell', 'cp', self.userJS, '%s.orig' % self.userJS])
        self._devicemanager.pushFile(os.path.join(profileDir, "user.js"), self.userJS)

        self.updateProfilesIni(self.remoteProfile)

        options.profilePath = self.remoteProfile
        return retVal
예제 #53
0
    def createReftestProfile(self, options, profileDir, reftestlist):
        print "profileDir: " + str(profileDir)
        retVal = RefTest.createReftestProfile(self, options, profileDir, reftestlist, server=options.remoteWebServer)

        # Turn off the locale picker screen
        fhandle = open(os.path.join(profileDir, "user.js"), 'a')
        fhandle.write("""
user_pref("browser.homescreenURL", "data:text/html,<h1>reftests should start soon</h1>");
user_pref("browser.manifestURL", "dummy (bug 772307)");
user_pref("browser.firstrun.show.localepicker", false);
user_pref("browser.dom.window.dump.enabled", true);
user_pref("font.size.inflation.emPerLine", 0);
user_pref("font.size.inflation.minTwips", 0);
user_pref("reftest.remote", true);
user_pref("toolkit.telemetry.prompted", true);
user_pref("reftest.uri", "%s");
""" % reftestlist)

        #workaround for jsreftests.
        if getattr(options, 'enablePrivilege', False):
            fhandle.write("""
user_pref("capability.principal.codebase.p2.granted", "UniversalXPConnect");
user_pref("capability.principal.codebase.p2.id", "http://%s:%s");
""" % (options.remoteWebServer, options.httpPort))

        # Close the file
        fhandle.close()

        # Copy the profile to the device.
        self._devicemanager.removeDir(self.remoteProfile)
        if self._devicemanager.pushDir(profileDir, self.remoteProfile) == None:
            raise devicemanager.FileError("Unable to copy profile to device.")

        # In B2G, user.js is always read from /data/local, not the profile
        # directory.  Backup the original user.js first so we can restore it.
        self._devicemanager.checkCmdAs(['shell', 'rm', '-f', '%s.orig' % self.userJS])
        if self._devicemanager.useDDCopy:
            self._devicemanager.checkCmdAs(['shell', 'dd', 'if=%s' % self.userJS, 'of=%s.orig' % self.userJS])
        else:
            self._devicemanager.checkCmdAs(['shell', 'cp', self.userJS, '%s.orig' % self.userJS])
        self._devicemanager.pushFile(os.path.join(profileDir, "user.js"), self.userJS)

        self.updateProfilesIni(self.remoteProfile)

        options.profilePath = self.remoteProfile
        return retVal
예제 #54
0
 def copyExtraFilesToProfile(self, options, profileDir):
     RefTest.copyExtraFilesToProfile(self, options, profileDir)
     if (self._devicemanager.pushDir(profileDir, options.remoteProfile) == None):
         raise devicemanager.FileError("Failed to copy extra files to device") 
예제 #55
0
 def buildBrowserEnv(self, options, profileDir):
     browserEnv = RefTest.buildBrowserEnv(self, options, profileDir)
     # remove desktop environment not used on device
     if "XPCOM_MEM_BLOAT_LOG" in browserEnv:
         del browserEnv["XPCOM_MEM_BLOAT_LOG"]
     return browserEnv
예제 #56
0
 def buildBrowserEnv(self, options, profileDir):
     browserEnv = RefTest.buildBrowserEnv(self, options, profileDir)
     # remove desktop environment not used on device
     if "XPCOM_MEM_BLOAT_LOG" in browserEnv:
         del browserEnv["XPCOM_MEM_BLOAT_LOG"]
     return browserEnv
예제 #57
0
    def __init__(self, options, scriptDir):
        RefTest.__init__(self, options.suite)
        self.run_by_manifest = False
        self.scriptDir = scriptDir
        self.localLogName = options.localLogName

        verbose = False
        if options.log_tbpl_level == 'debug' or options.log_mach_level == 'debug':
            verbose = True
            print "set verbose!"
        self.device = ADBDevice(adb=options.adb_path or 'adb',
                                device=options.deviceSerial,
                                test_root=options.remoteTestRoot,
                                verbose=verbose)
        if options.remoteTestRoot is None:
            options.remoteTestRoot = posixpath.join(self.device.test_root,
                                                    "reftest")
        options.remoteProfile = posixpath.join(options.remoteTestRoot,
                                               "profile")
        options.remoteLogFile = posixpath.join(options.remoteTestRoot,
                                               "reftest.log")
        options.logFile = options.remoteLogFile
        self.remoteProfile = options.remoteProfile
        self.remoteTestRoot = options.remoteTestRoot

        if not options.ignoreWindowSize:
            parts = self.device.get_info('screen')['screen'][0].split()
            width = int(parts[0].split(':')[1])
            height = int(parts[1].split(':')[1])
            if (width < 1366 or height < 1050):
                self.error("ERROR: Invalid screen resolution %sx%s, "
                           "please adjust to 1366x1050 or higher" %
                           (width, height))

        self._populate_logger(options)
        self.outputHandler = OutputHandler(self.log, options.utilityPath,
                                           options.symbolsPath)
        # RemoteAutomation.py's 'messageLogger' is also used by mochitest. Mimic a mochitest
        # MessageLogger object to re-use this code path.
        self.outputHandler.write = self.outputHandler.__call__
        args = {'messageLogger': self.outputHandler}
        self.automation = RemoteAutomation(self.device,
                                           appName=options.app,
                                           remoteProfile=self.remoteProfile,
                                           remoteLog=options.remoteLogFile,
                                           processArgs=args)

        self.environment = self.automation.environment
        if self.automation.IS_DEBUG_BUILD:
            self.SERVER_STARTUP_TIMEOUT = 180
        else:
            self.SERVER_STARTUP_TIMEOUT = 90

        self.remoteCache = os.path.join(options.remoteTestRoot, "cache/")

        # Check that Firefox is installed
        expected = options.app.split('/')[-1]
        if not self.device.is_app_installed(expected):
            raise Exception("%s is not installed on this device" % expected)

        self.device.clear_logcat()

        self.device.rm(self.remoteCache, force=True, recursive=True)

        procName = options.app.split('/')[-1]
        self.device.stop_application(procName)
        if self.device.process_exist(procName):
            self.log.error("unable to kill %s before starting tests!" %
                           procName)
예제 #58
0
    def createReftestProfile(self, options, profileDir, reftestlist):
        print "profileDir: " + str(profileDir)
        retVal = RefTest.createReftestProfile(self, options, profileDir, reftestlist, server=options.remoteWebServer)

        # Turn off the locale picker screen
        fhandle = open(os.path.join(profileDir, "user.js"), "a")
        fhandle.write(
            """
user_pref("browser.firstrun.show.localepicker", false);
user_pref("browser.homescreenURL","app://system.gaiamobile.org");\n
user_pref("browser.manifestURL","app://system.gaiamobile.org/manifest.webapp");\n
user_pref("browser.tabs.remote", false);\n
user_pref("dom.ipc.browser_frames.oop_by_default", true);\n
user_pref("dom.ipc.tabs.disabled", false);\n
user_pref("dom.mozBrowserFramesEnabled", true);\n
user_pref("dom.mozBrowserFramesWhitelist","app://system.gaiamobile.org");\n
user_pref("network.dns.localDomains","app://system.gaiamobile.org");\n
user_pref("font.size.inflation.emPerLine", 0);
user_pref("font.size.inflation.minTwips", 0);
user_pref("reftest.browser.iframe.enabled", false);
user_pref("reftest.remote", true);
user_pref("reftest.uri", "%s");
// Set a future policy version to avoid the telemetry prompt.
user_pref("toolkit.telemetry.prompted", 999);
user_pref("toolkit.telemetry.notifiedOptOut", 999);
"""
            % reftestlist
        )

        # workaround for jsreftests.
        if getattr(options, "enablePrivilege", False):
            fhandle.write(
                """
user_pref("capability.principal.codebase.p2.granted", "UniversalXPConnect");
user_pref("capability.principal.codebase.p2.id", "http://%s:%s");
"""
                % (options.remoteWebServer, options.httpPort)
            )

        # Close the file
        fhandle.close()

        # Copy the profile to the device.
        self._devicemanager.removeDir(self.remoteProfile)
        try:
            self._devicemanager.pushDir(profileDir, self.remoteProfile)
        except devicemanager.DMError:
            print "Automation Error: Unable to copy profile to device."
            raise

        # Copy the extensions to the B2G bundles dir.
        extensionDir = os.path.join(profileDir, "extensions", "staged")
        # need to write to read-only dir
        self._devicemanager._checkCmdAs(["remount"])
        for filename in os.listdir(extensionDir):
            self._devicemanager._checkCmdAs(["shell", "rm", "-rf", os.path.join(self.bundlesDir, filename)])
        try:
            self._devicemanager.pushDir(extensionDir, self.bundlesDir)
        except devicemanager.DMError:
            print "Automation Error: Unable to copy extensions to device."
            raise

        # In B2G, user.js is always read from /data/local, not the profile
        # directory.  Backup the original user.js first so we can restore it.
        self._devicemanager._checkCmdAs(["shell", "rm", "-f", "%s.orig" % self.userJS])
        if self._devicemanager._useDDCopy:
            self._devicemanager._checkCmdAs(["shell", "dd", "if=%s" % self.userJS, "of=%s.orig" % self.userJS])
        else:
            self._devicemanager._checkCmdAs(["shell", "cp", self.userJS, "%s.orig" % self.userJS])
        self._devicemanager.pushFile(os.path.join(profileDir, "user.js"), self.userJS)

        self.updateProfilesIni(self.remoteProfile)

        options.profilePath = self.remoteProfile
        return retVal