@@ -33,48 +33,12 @@ def kwargs_common(self, kwargs):
33
33
34
34
tests_src_path = os .path .join (self ._here , "tests" )
35
35
36
- if (
37
- kwargs ["product" ] in {"firefox" , "firefox_android" }
38
- and kwargs ["specialpowers_path" ] is None
39
- ):
40
- kwargs ["specialpowers_path" ] = os .path .join (
41
- self .
distdir ,
"xpi-stage" ,
"[email protected] "
42
- )
43
-
44
- if kwargs ["product" ] == "firefox_android" :
45
- # package_name may be different in the future
46
- package_name = kwargs ["package_name" ]
47
- if not package_name :
48
- kwargs [
49
- "package_name"
50
- ] = package_name = "org.mozilla.geckoview.test_runner"
51
-
52
- # Note that this import may fail in non-firefox-for-android trees
53
- from mozrunner .devices .android_device import (
54
- InstallIntent ,
55
- get_adb_path ,
56
- verify_android_device ,
57
- )
58
-
59
- kwargs ["adb_binary" ] = get_adb_path (self )
60
- install = (
61
- InstallIntent .NO if kwargs .pop ("no_install" ) else InstallIntent .YES
62
- )
63
- verify_android_device (
64
- self , install = install , verbose = False , xre = True , app = package_name
65
- )
66
-
67
- if kwargs ["certutil_binary" ] is None :
68
- kwargs ["certutil_binary" ] = os .path .join (
69
- os .environ .get ("MOZ_HOST_BIN" ), "certutil"
36
+ if kwargs ["product" ] in {"firefox" , "firefox_android" }:
37
+ if kwargs ["specialpowers_path" ] is None :
38
+ kwargs ["specialpowers_path" ] = os .path .join (
39
+ self .
distdir ,
"xpi-stage" ,
"[email protected] "
70
40
)
71
41
72
- if kwargs ["install_fonts" ] is None :
73
- kwargs ["install_fonts" ] = True
74
-
75
- if not kwargs ["device_serial" ]:
76
- kwargs ["device_serial" ] = ["emulator-5554" ]
77
-
78
42
if kwargs ["config" ] is None :
79
43
kwargs ["config" ] = os .path .join (
80
44
self .topobjdir , "_tests" , "web-platform" , "wptrunner.local.ini"
@@ -118,27 +82,11 @@ def kwargs_firefox(self, kwargs):
118
82
if kwargs ["binary" ] is None :
119
83
kwargs ["binary" ] = self .get_binary_path ()
120
84
121
- if kwargs ["certutil_binary" ] is None :
122
- kwargs ["certutil_binary" ] = self .get_binary_path ("certutil" )
123
-
124
85
if kwargs ["webdriver_binary" ] is None :
125
- try_paths = [self .get_binary_path ("geckodriver" , validate_exists = False )]
126
- ext = ".exe" if sys .platform in ["win32" , "msys" , "cygwin" ] else ""
127
- for build_type in ["release" , "debug" ]:
128
- try_paths .append (
129
- os .path .join (
130
- self .topsrcdir , "target" , build_type , f"geckodriver{ ext } "
131
- )
132
- )
133
- found_paths = []
134
- for path in try_paths :
135
- if os .path .exists (path ):
136
- found_paths .append (path )
86
+ kwargs ["webdriver_binary" ] = self .find_webdriver_binary ()
137
87
138
- if found_paths :
139
- # Pick the most recently modified version
140
- found_paths .sort (key = os .path .getmtime )
141
- kwargs ["webdriver_binary" ] = found_paths [- 1 ]
88
+ if kwargs ["certutil_binary" ] is None :
89
+ kwargs ["certutil_binary" ] = self .get_binary_path ("certutil" )
142
90
143
91
if kwargs ["install_fonts" ] is None :
144
92
kwargs ["install_fonts" ] = True
@@ -156,6 +104,47 @@ def kwargs_firefox(self, kwargs):
156
104
157
105
return kwargs
158
106
107
+ def kwargs_firefox_android (self , kwargs ):
108
+ from wptrunner import wptcommandline
109
+
110
+ kwargs = self .kwargs_common (kwargs )
111
+
112
+ # package_name may be different in the future
113
+ package_name = kwargs ["package_name" ]
114
+ if not package_name :
115
+ kwargs ["package_name" ] = package_name = "org.mozilla.geckoview.test_runner"
116
+
117
+ # Note that this import may fail in non-firefox-for-android trees
118
+ from mozrunner .devices .android_device import (
119
+ InstallIntent ,
120
+ get_adb_path ,
121
+ verify_android_device ,
122
+ )
123
+
124
+ kwargs ["adb_binary" ] = get_adb_path (self )
125
+ install = InstallIntent .NO if kwargs .pop ("no_install" ) else InstallIntent .YES
126
+ verify_android_device (
127
+ self , install = install , verbose = False , xre = True , app = package_name
128
+ )
129
+
130
+ if kwargs ["webdriver_binary" ] is None :
131
+ kwargs ["webdriver_binary" ] = self .find_webdriver_binary ()
132
+
133
+ if kwargs ["certutil_binary" ] is None :
134
+ kwargs ["certutil_binary" ] = os .path .join (
135
+ os .environ .get ("MOZ_HOST_BIN" ), "certutil"
136
+ )
137
+
138
+ if kwargs ["install_fonts" ] is None :
139
+ kwargs ["install_fonts" ] = True
140
+
141
+ if not kwargs ["device_serial" ]:
142
+ kwargs ["device_serial" ] = ["emulator-5554" ]
143
+
144
+ kwargs = wptcommandline .check_args (kwargs )
145
+
146
+ return kwargs
147
+
159
148
def kwargs_wptrun (self , kwargs ):
160
149
"""Setup kwargs for wpt-run which is only used for non-gecko browser products"""
161
150
from tools .wpt import run , virtualenv
@@ -233,6 +222,27 @@ def setup_fonts_firefox(self):
233
222
with open (ahem_src , "rb" ) as src , open (ahem_dest , "wb" ) as dest :
234
223
dest .write (src .read ())
235
224
225
+ def find_webdriver_binary (self ):
226
+ ext = ".exe" if sys .platform in ["win32" , "msys" , "cygwin" ] else ""
227
+ try_paths = [
228
+ self .get_binary_path ("geckodriver" , validate_exists = False ),
229
+ os .path .join (self .topobjdir , "dist" , "host" , "bin" , f"geckodriver{ ext } " ),
230
+ ]
231
+
232
+ for build_type in ["release" , "debug" ]:
233
+ try_paths .append (
234
+ os .path .join (self .topsrcdir , "target" , build_type , f"geckodriver{ ext } " )
235
+ )
236
+ found_paths = []
237
+ for path in try_paths :
238
+ if os .path .exists (path ):
239
+ found_paths .append (path )
240
+
241
+ if found_paths :
242
+ # Pick the most recently modified version
243
+ found_paths .sort (key = os .path .getmtime )
244
+ return found_paths [- 1 ]
245
+
236
246
237
247
class WebPlatformTestsServeRunner (MozbuildObject ):
238
248
def run (self , ** kwargs ):
0 commit comments