• C
    Make it easy to write embedder unit tests by creating a fixture and config builder. (#8276) · d6ead18f
    Chinmay Garde 提交于
    All embedder unit-tests have to setup the Flutter project arguments from scratch
    before launching the engine. The boilerplate and having to deal with the low
    level C API during each engine launch is a hinderance to writing tests.
    
    This patch introduces an EmbedderTest fixture that sets up all the embedder side snapshots before allowing the unit test to create a FlutterConfigBuilder` that
    the test can use to incrementally build and edit the Flutter project
    configuration. From the given state state of a configuration, multiple engines
    can be launched with their lifecylces managed by appropriate RAII wrappers.
    
    This allows the a fully configured Flutter engine to be launched using 4 lines
    of code in a fixture.
    
    ```
    EmbedderConfigBuilder builder;
    builder.SetSoftwareRendererConfig();
    builder.SetAssetsPathFromFixture(this);
    builder.SetSnapshotsFromFixture(this);
    auto engine = builder.LaunchEngine();
    ```
    d6ead18f
BUILD.gn 5.8 KB