chrome.test.* API schema [1] and its supporting code [2] are compiled into chrome binary, which are only used in tests. We should compile them in test targets only.
The reason this is a bit tricky is because we need to register the API's function in the browser/ process [3], and make the schemas available in the renderer/ processes [4]. Therefore, it should(?) be done during compile time.
I've started out with a simpler test only API: idltest.idl
This bug is here to track the effort.
[1] extensions/common/api/test.json
[2] extensions/browser/api/test/*
[3] https://cs.chromium.org/chromium/src/chrome/browser/extensions/chrome_extensions_browser_client.cc?rcl=1474989594&l=256
[4] See ExtensionsClient implementations, e.g.
bool ChromeExtensionsClient::IsAPISchemaGenerated()
base::StringPiece ChromeExtensionsClient::GetAPISchema()
?: I'm not sure whether anything other than compile time would work here, because we need to make the test only API available in the renderer/ process right at the point where we spin up the renderer process.
Comment 1 by rdevlin....@chromium.org
, Aug 30 2017