web-platform-tests / wpt

Test suites for Web platform specs — including WHATWG, W3C, and others
https://web-platform-tests.org/
Other
4.82k stars 3k forks source link

Unclear how access h3 / webtransport server on Android #43291

Open jgraham opened 8 months ago

jgraham commented 8 months ago

In general for Android testing we set up reverse port forwarding with adb so that the browser running on the device / in the emulator can use the normal web-platform.test URLs with the servers running on the host machine.

However afaik adb reverse only allows forwarding TCP packets. That doesn't work for HTTP/3 which is based on UDP. Therefore the web-transport tests don't work on Android.

The redir command on Android may work for forwarding UDP from the host to the device, but it's not clear if it can also be used for reverse forwarding UDP connections.

If this does work, we need to add these additional forwards to the setup code for the android browsers.

CC @past

WeizhongX commented 7 months ago

https://developer.android.com/studio/run/emulator-networking#connecting

I checked the above document. Looks like what we need to do is the following:

  1. start emulator with network connection enabled: (avd.py start --enable-network --avd-config ...)
  2. When doing dns resolving, translate "web-platform.test" to 10.0.2.2, the packets will then be automatically forwarded between host/the emulator.

redir is not needed because we only want to connections between the host and the emulator. We might also want to do this for TCP. But the problem is that this won't work with a real device.

WeizhongX commented 7 months ago

With this solution, the browser will think Wpt server is running at 10.0.2.2 but the Wpt server itself will think it is running at 127.0.0.1. We might need to update the certificate used?