Add port forwarding for the Remote Agent when testing mobile builds on Android
Categories
(Testing :: geckodriver, enhancement, P2)
Tracking
(firefox92 fixed)
| Tracking | Status | |
|---|---|---|
| firefox92 | --- | fixed |
People
(Reporter: whimboo, Assigned: whimboo)
References
Details
(Whiteboard: [bidi-m1-mvp])
Attachments
(1 file)
Port forwarding only works for Marionette at the moment. But to easily use the Remote Agent on Android its port also needs to be reachable by the host machine.
A simple call like device.forward_port(host_port, AGENT_PORT)?; would be enough similar to how we set it for Marionette:
https://searchfox.org/mozilla-central/source/testing/geckodriver/src/android.rs#159
Also in the drop handler we will have to remove the forward.
The port will announced in the webSocketUrl capability, which is BiDi conformant, or via moz:debuggerAddress that is used for allowing CDP access. And if one of those is set the forward has to be created, whereby webSocketUrl has precedence.
| Assignee | ||
Updated•4 years ago
|
| Assignee | ||
Comment 1•4 years ago
|
||
Before implementing the forward it would be good to have the WebSocket support landed in Remote Protocol.
| Assignee | ||
Comment 2•4 years ago
|
||
It would still be good to have it as part of the 0.30 release of geckodriver. When working on it we should clearly also update the moz:debuggerAddress capability, which would need the exact same forwarding.
| Assignee | ||
Comment 3•4 years ago
|
||
Here some updates of the latest state: Setting up the port forwarding is actually easy, but there is a problem with the HTTP host header, which is not rewritten for the port changes. That results in httpd.js bailing out because it runs on a different port on the device. I tried to find some resources in how to get adb to also update HTTP headers, but as it looks like that level of the TCP stack is not supported.
As such the easiest solution here should be to have the same port used on the host machine and the device / emulator. We could try to find a free port on both devices, or support a new command line argument like --websocket-port to allow consumers to specify a port to use. If not set we could default to 9222. By having such an argument we might also have to move the --remote-debugging-port argument handling out of capabilities, and pass capabiities to the AndroidHandler.
James, what do you think?
| Assignee | ||
Comment 4•4 years ago
|
||
As discussed with James on Elements we will use the --websocket-port approach for now. That means some refactoring is required because the firefox arguments can no longer be set in capabilities.rs. Further we also have to take the moz:debuggerAddress capability into account for it.
| Assignee | ||
Comment 5•4 years ago
|
||
Depends on D120380
Updated•4 years ago
|
Updated•4 years ago
|
Comment 7•4 years ago
|
||
| bugherder | ||
Description
•