web-platform-tests / results-collection

Other
41 stars 46 forks source link

Run Chrome with Mojo test API flags #81

Open reillyeon opened 7 years ago

reillyeon commented 7 years ago

The WebUSB tests rely on a polyfill of the WebUSB Testing API that uses the Mojo JavaScript bindings which can be enabled for web content by launching Chrome with the --enable-blink-features=MojoJS,MojoJSTest flag. This flag allows the tests to override Mojo interfaces normally provided by the browser with mocks running within the test itself. This is a pattern used in many Blink LayoutTests and WebUSB is the first API to attempt this in a Web Platform Test. Other browsers may implement the WebUSB Testing API directly or with a similar polyfill. The polyfill approach allows Chrome to support this API without shipping a large amount of bindings code that will not be used outside of Web Platform Tests.

jugglinmike commented 6 years ago

@reillyeon @Hexcles In light of https://github.com/w3c/web-platform-tests/issues/10452, I'm wondering if the desired functionality can also be enabled via --enable-experimental-web-platform-features. Do either of you know?

reillyeon commented 6 years ago

No, this flag is separate from the --enable-experimental-web-platform-features flag.

jugglinmike commented 6 years ago

Got it. Thanks!

reillyeon commented 6 years ago

Is there anything blocking us from adding this flag when running Chrome?

rakuco commented 6 years ago

Passing those flags seems to be quite simple. @jugglinmike / @Hexcles are we depending on a bigger decision or can I just send a PR adding the flags to src/master/wpt_run_step.py?

Hexcles commented 6 years ago

Ping @foolip WDYT?

At first I didn't like the idea of adding special flags for each browser, but recently I'm not against the idea as much. Firefox uses testing-only prefs. And we already enabled some special flags to Chrome to test WebRTC.

If you're fine with it, I can send a PR to enable the Mojo flags on Chrome dev first.

foolip commented 6 years ago

I'm OK with this. There is still a small problem with the mojo files and code to create the testing APIs being checked into WPT, since actually they evolve together with Chrome and would make sense to release alongside Chrome similar to ChromeDriver. But to even work on fixing that requires enabling this first.