We have a large number of end-to-end extension API tests which consist of the extension executing some javascript and ensuring the correct result. Unfortunately, there's currently no good way to share common utility code between these tests, since the test packages an extension and extensions aren't allowed to access code from outside their directory. This leads us to do a number of bad alternatives:
- copy-paste code around (webnavigation api tests [1] are a good example of this - the same framework.js file is copied >20 times).
- making mutant tests that include tons of different unrelated files so that they can all be in one extension
- adding unnecessary methods to the chrome.test API.
Instead, we should have an easy way to share these common test resources, allowing us to effectively "#include" these files through either
<script src=...></script>
or
<link rel="import" href=...>
Looking further ahead, there's also the chance that we greatly reduce (or even totally remove) our chrome.test API - which would be very useful, as it's currently compiled in release builds for reasons*.
*TL;DR: no good way to pass test information to the renderer or conditionally compile resources chrome-included based on built target.
[1] https://chromium.googlesource.com/chromium/src/+/d69748c97ae3e11a2611f498b745fd6fc5b5f301/chrome/test/data/extensions/api_test/webnavigation
Comment 1 by bugdroid1@chromium.org
, Dec 3 2016