Closed Bug 1708633 Opened 4 years ago Closed 4 years ago

Add port forwarding for the Remote Agent when testing mobile builds on Android

Categories

(Testing :: geckodriver, enhancement, P2)

enhancement
Points:
2

Tracking

(firefox92 fixed)

RESOLVED FIXED
92 Branch
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.

Component: WebDriver BiDi → geckodriver
Product: Remote Protocol → Testing
Depends on: 1693004

Before implementing the forward it would be good to have the WebSocket support landed in Remote Protocol.

Depends on: 1693812
Blocks: 1686110

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.

Points: --- → 2
Priority: -- → P3
Whiteboard: [bidi-m1-mvp]
Depends on: 1721447

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?

Flags: needinfo?(james)

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.

Flags: needinfo?(james)
See Also: → 1722471
Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Priority: P3 → P2
Pushed by hskupin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ff1c62fc3f13 [geckodriver] Forward WebSocket connection for Firefox on Android. r=webdriver-reviewers,jgraham
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 92 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: