mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 770490 - Add ability to specify emulator resolution, r=jgriffin, DONTBUILD because NPOTB,
This commit is contained in:
parent
643f3f15f5
commit
8f3aa62469
@ -38,7 +38,7 @@ class Emulator(object):
|
|||||||
deviceRe = re.compile(r"^emulator-(\d+)(\s*)(.*)$")
|
deviceRe = re.compile(r"^emulator-(\d+)(\s*)(.*)$")
|
||||||
|
|
||||||
def __init__(self, homedir=None, noWindow=False, logcat_dir=None, arch="x86",
|
def __init__(self, homedir=None, noWindow=False, logcat_dir=None, arch="x86",
|
||||||
emulatorBinary=None, userdata=None):
|
emulatorBinary=None, res='480x800', userdata=None):
|
||||||
self.port = None
|
self.port = None
|
||||||
self._emulator_launched = False
|
self._emulator_launched = False
|
||||||
self.proc = None
|
self.proc = None
|
||||||
@ -50,6 +50,7 @@ class Emulator(object):
|
|||||||
self.logcat_proc = None
|
self.logcat_proc = None
|
||||||
self.arch = arch
|
self.arch = arch
|
||||||
self.binary = emulatorBinary
|
self.binary = emulatorBinary
|
||||||
|
self.res = res
|
||||||
self.battery = EmulatorBattery(self)
|
self.battery = EmulatorBattery(self)
|
||||||
self.homedir = homedir
|
self.homedir = homedir
|
||||||
self.noWindow = noWindow
|
self.noWindow = noWindow
|
||||||
@ -131,7 +132,7 @@ class Emulator(object):
|
|||||||
qemuArgs.extend(['-memory', '512',
|
qemuArgs.extend(['-memory', '512',
|
||||||
'-partition-size', '512',
|
'-partition-size', '512',
|
||||||
'-verbose',
|
'-verbose',
|
||||||
'-skin', '480x800',
|
'-skin', self.res,
|
||||||
'-qemu'] + self.tail_args)
|
'-qemu'] + self.tail_args)
|
||||||
return qemuArgs
|
return qemuArgs
|
||||||
|
|
||||||
|
@ -71,8 +71,9 @@ class Marionette(object):
|
|||||||
CONTEXT_CONTENT = 'content'
|
CONTEXT_CONTENT = 'content'
|
||||||
|
|
||||||
def __init__(self, host='localhost', port=2828, bin=None, profile=None,
|
def __init__(self, host='localhost', port=2828, bin=None, profile=None,
|
||||||
emulator=None, emulatorBinary=None, connectToRunningEmulator=False,
|
emulator=None, emulatorBinary=None, emulator_res='480x800',
|
||||||
homedir=None, baseurl=None, noWindow=False, logcat_dir=None):
|
connectToRunningEmulator=False, homedir=None, baseurl=None,
|
||||||
|
noWindow=False, logcat_dir=None):
|
||||||
self.host = host
|
self.host = host
|
||||||
self.port = self.local_port = port
|
self.port = self.local_port = port
|
||||||
self.bin = bin
|
self.bin = bin
|
||||||
@ -96,7 +97,8 @@ class Marionette(object):
|
|||||||
noWindow=self.noWindow,
|
noWindow=self.noWindow,
|
||||||
logcat_dir=self.logcat_dir,
|
logcat_dir=self.logcat_dir,
|
||||||
arch=emulator,
|
arch=emulator,
|
||||||
emulatorBinary=emulatorBinary)
|
emulatorBinary=emulatorBinary,
|
||||||
|
res=emulator_res)
|
||||||
self.emulator.start()
|
self.emulator.start()
|
||||||
self.port = self.emulator.setup_port_forwarding(self.port)
|
self.port = self.emulator.setup_port_forwarding(self.port)
|
||||||
assert(self.emulator.wait_for_port())
|
assert(self.emulator.wait_for_port())
|
||||||
|
@ -21,7 +21,7 @@ try:
|
|||||||
from mozhttpd import iface, MozHttpd
|
from mozhttpd import iface, MozHttpd
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print "manifestparser or mozhttpd not found! Please install mozbase:\n"
|
print "manifestparser or mozhttpd not found! Please install mozbase:\n"
|
||||||
print "\tgit clone git clone git://github.com/mozilla/mozbase.git"
|
print "\tgit clone git://github.com/mozilla/mozbase.git"
|
||||||
print "\tpython setup_development.py\n"
|
print "\tpython setup_development.py\n"
|
||||||
import sys
|
import sys
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -144,13 +144,15 @@ class MarionetteTextTestRunner(unittest.TextTestRunner):
|
|||||||
|
|
||||||
class MarionetteTestRunner(object):
|
class MarionetteTestRunner(object):
|
||||||
|
|
||||||
def __init__(self, address=None, emulator=None, emulatorBinary=None, homedir=None,
|
def __init__(self, address=None, emulator=None, emulatorBinary=None,
|
||||||
bin=None, profile=None, autolog=False, revision=None, es_server=None,
|
emulator_res='480x800', homedir=None, bin=None, profile=None,
|
||||||
|
autolog=False, revision=None, es_server=None,
|
||||||
rest_server=None, logger=None, testgroup="marionette",
|
rest_server=None, logger=None, testgroup="marionette",
|
||||||
noWindow=False, logcat_dir=None):
|
noWindow=False, logcat_dir=None):
|
||||||
self.address = address
|
self.address = address
|
||||||
self.emulator = emulator
|
self.emulator = emulator
|
||||||
self.emulatorBinary = emulatorBinary
|
self.emulatorBinary = emulatorBinary
|
||||||
|
self.emulator_res = emulator_res
|
||||||
self.homedir = homedir
|
self.homedir = homedir
|
||||||
self.bin = bin
|
self.bin = bin
|
||||||
self.profile = profile
|
self.profile = profile
|
||||||
@ -224,6 +226,7 @@ class MarionetteTestRunner(object):
|
|||||||
elif self.emulator:
|
elif self.emulator:
|
||||||
self.marionette = Marionette(emulator=self.emulator,
|
self.marionette = Marionette(emulator=self.emulator,
|
||||||
emulatorBinary=self.emulatorBinary,
|
emulatorBinary=self.emulatorBinary,
|
||||||
|
emulator_res=self.emulator_res,
|
||||||
homedir=self.homedir,
|
homedir=self.homedir,
|
||||||
baseurl=self.baseurl,
|
baseurl=self.baseurl,
|
||||||
noWindow=self.noWindow,
|
noWindow=self.noWindow,
|
||||||
@ -418,6 +421,11 @@ if __name__ == "__main__":
|
|||||||
default = None,
|
default = None,
|
||||||
help = "Launch a specific emulator binary rather than "
|
help = "Launch a specific emulator binary rather than "
|
||||||
"launching from the B2G built emulator")
|
"launching from the B2G built emulator")
|
||||||
|
parser.add_option('--emulator-res',
|
||||||
|
action = 'store', dest = 'emulator_res',
|
||||||
|
default = '480x800', type= 'str',
|
||||||
|
help = 'Set a custom resolution for the emulator. '
|
||||||
|
'Example: "480x800"')
|
||||||
parser.add_option("--no-window",
|
parser.add_option("--no-window",
|
||||||
action = "store_true", dest = "noWindow",
|
action = "store_true", dest = "noWindow",
|
||||||
default = False,
|
default = False,
|
||||||
@ -469,9 +477,21 @@ if __name__ == "__main__":
|
|||||||
if options.emulator and not options.logcat_dir:
|
if options.emulator and not options.logcat_dir:
|
||||||
options.logcat_dir = 'logcat'
|
options.logcat_dir = 'logcat'
|
||||||
|
|
||||||
|
# check for valid resolution string, strip whitespaces
|
||||||
|
try:
|
||||||
|
dims = options.emulator_res.split('x')
|
||||||
|
assert len(dims) == 2
|
||||||
|
width = str(int(dims[0]))
|
||||||
|
height = str(int(dims[1]))
|
||||||
|
res = 'x'.join([width, height])
|
||||||
|
except:
|
||||||
|
raise ValueError('Invalid emulator resolution format. '
|
||||||
|
'Should be like "480x800".\n')
|
||||||
|
|
||||||
runner = MarionetteTestRunner(address=options.address,
|
runner = MarionetteTestRunner(address=options.address,
|
||||||
emulator=options.emulator,
|
emulator=options.emulator,
|
||||||
emulatorBinary=options.emulatorBinary,
|
emulatorBinary=options.emulatorBinary,
|
||||||
|
emulator_res=res,
|
||||||
homedir=options.homedir,
|
homedir=options.homedir,
|
||||||
logcat_dir=options.logcat_dir,
|
logcat_dir=options.logcat_dir,
|
||||||
bin=options.bin,
|
bin=options.bin,
|
||||||
|
Loading…
Reference in New Issue
Block a user