New script to downgrade .mojom files from the new to the old mojo types

Following the discussion in chromium-mojo and platform-architecture-dev,
we're proposing to add this script to the chromium repository so that
external repositories that still depend on the old mojo types (e.g.
Android's and ChromeOS's libchrome repos) have a simple and maintained
way to downgrade Chromium's .mojom files to the old syntax, while they
can't support the new one.

This CL includes a new script that can be
integrates with those external builds requiring it, plus the necessary
unit tests to guarantee that the downgraded files can still be parsed
correctly by the bindings generator (i.e.

For extra context, see the relevant discussion in the chromium-mojo ML:

Bug: 1035484
Change-Id: I4c92345e82a188052b06efce9a1bc749d561cca1
Commit-Queue: Mario Sanchez Prada <>
Reviewed-by: Ken Rockot <>
Cr-Commit-Position: refs/heads/master@{#745386}
4 files changed