Hi all,
I am working on setting up an Origin Trial for
StorageAccessHeaders, and we are facing some challenges with the current behavior for browser tests with OT tokens.
We are trying to set up a persistent origin trial for the feature, and in order to properly test it, we need to be able to check the content of a header on follow-up requests to the same domain after opting the origin into the trial. The current practice for testing OT tokens in Chrome seems to rely on using a URLLoaderInterceptor to intercept requests to the enabled domain and creating a request header with the token's value (
example). Since our feature involves
code in URLRequestHTTPJob, we cannot properly test the behavior of StorageAccessHeaders when the load is intercepted since the StorageAccessHeaders code will not be called in that case.
Is there a recommended solution to this situation? We didn't see any similar cases in the documentation or the codebase.
The current solution we've been testing locally has been to use
an EmbeddedTestServer with a preselected port value that we also use when generating the token in the command line by passing something like `
https://example.test:<port>` to generate_token.py. This works on our local machine, but we expect it would be unreliable and prone to flakeyness since the preselected port may not always be available.
A possibly stronger solution we thought of would be the capability to dynamically generate an OT token from within a browser test - that way we could create a token with a port value that the EmbeddedTestServer has already determined to be available at the time of test. If there is a way to do this already we would love to learn about it as well as other possible solutions that may exist.
Best,
Sam