Closed
Description
We have a number of backdoor flags in the web engine that the framework uses to set up its test environment. Out of all of them, I dislike debugEmulateFlutterTesterEnvironment
the most.
- This flag does too many completely orthogonal things.
- Many of the things it does could be achieved through normal publicly visible APIs.
- Using special modes that don't actually apply to users' apps lowers the fidelity of our tests.
- The flag is not well documented in how it changes the engine's behavior.
- The flag creates leaky abstractions between the engine and the framework. If the APIs we expose through normal channels are not sufficient for the framework's unit tests, we should consider augmenting those APIs so that any consumer of the engine could set up their own test environment without the use of a special handshake flag like this.
From what I can tell, this flag does a couple different things:
- Changes the size of the implicit view. This could be done in the framework's test harness.
- Sets a special mode that uses only some specific test fonts, instead of what the user passes in. I think it would be better if the test harness in the framework explicitly loads the test fonts and explicitly uses them in each of the tests.
- Suppresses platform messages in the
PlatformDispatcher
. I'm not entirely sure why this is necessary, but I have to imagine it can be possible to suppress these at the framework level. If not, and we truly need a flag for suppressing these, I would rather have an explicit flag as part of theui_web
API or something similar, rather than it just being a undocumented side effect of this flag. - Turns semantics off. I'm pretty sure this can be also be done with our normal APIs.
- Sets a special test
UrlStrategy
. This could also be done from the framework side with normal APIs.
I think we should consider removing this flag and being more explicit about how we set up any given test.