30 Commits

Author SHA1 Message Date
Chris Bracken
0f1ff3bdb3
Correct typos, adopt US spellings (#9081)
Corects a bnuch of typeos throughout teh engien codebsae. Also makes
a couple minor Commonwealth -> US spelling adjustments for consistency
with the rest of Flutter's codebase.

Made use of `misspell` tool:
https://github.com/client9/misspell
2019-05-25 13:14:46 -07:00
Chinmay Garde
2e4f0a4a72
Put the testing lib in the flutter namespace. (#8661) 2019-04-20 20:42:46 -07:00
Chinmay Garde
6257dfeb53
Add factory methods to FileMapping that make it easy to create common mappings. (#8652)
The GetMapping calls removed in this patch had the same code and had to be repeated across different test harnesses as well as in dart_snapshot.cc. Just make this a factory method so the code is less verbose.
2019-04-19 12:48:53 -07:00
Chinmay Garde
56052c70af
Rename the shell namespace to flutter. (#8520) 2019-04-09 17:10:46 -07:00
Chinmay Garde
eec74e5c92
Rename the blink namespace to flutter. (#8517)
Some components in the Flutter engine were derived from the forked blink codebase. While the forked components have either been removed or rewritten, the use of the blink namespace has mostly (and inconsistently) remained. This renames the blink namesapce to flutter for consistency. There are no functional changes in this patch.
2019-04-09 12:44:42 -07:00
Chinmay Garde
131cc625a1
Allow native entrypoint registration for runtime unittests. (#8379) 2019-03-29 17:53:49 -07:00
Chinmay Garde
8d56284cda
Remove the standalone a11y test runners and merge its tests into embedder_unittests. (#8338)
Also cleans up the a11y unittests to use the new builder API and avoids polluting the global namespace with state for assertions.
2019-03-28 11:22:06 -07:00
Chinmay Garde
975fe8776c
Reset min log levels on each engine launch. (#8343) 2019-03-28 11:21:25 -07:00
Chinmay Garde
cb8eb801a4
Allow embedders to specify their own task runner interfaces. (#8273)
Currently, all Flutter threads are managed by the engine itself. This works for
all threads except the platform thread. On this thread, the engine cannot see
the underlying event multiplexing mechanism. Using the new task runner
interfaces, the engine can relinquish the task of setting up the event
multiplexing mechanism and instead have the embedder provide one for it during
setup.

This scheme is only wired up for the platform thread. But, the eventual goal
is to expose this message loop interoperability for all threads.
2019-03-27 16:16:59 -07:00
Chinmay Garde
3a3f707d5a
Reland "Allow specification of std::functions as native entrypoints from Dart code." (#8329)
This reverts commit 7e77d5c484a08cc1c189619e80ae71a7f1df62fb after fixing Windows issues.
2019-03-27 12:22:48 -07:00
Chinmay Garde
7e77d5c484
Revert "Allow specification of std::functions as native entrypoints from Dart code. (#8309)" (#8312)
This reverts commit 400a86a62efd3c8504672b8a63323cc837282135.
2019-03-26 13:49:41 -07:00
Chinmay Garde
400a86a62e
Allow specification of std::functions as native entrypoints from Dart code. (#8309)
This allows for the specification of std::functions (using EmbedderContext::NativeEntry) with their captures as native entrypoints. Earlier, only C functions we allowed which meant that there were no captures and assertions had to use globals which could introduce bugs when used with gtest_repeat.
2019-03-26 12:56:23 -07:00
Chinmay Garde
78de8dcb42
Enable lambda like native callbacks in tests and add support for custom entrypoints. (#8299) 2019-03-26 11:29:08 -07:00
Chinmay Garde
22ee8ee08f
Migrate existing embedder unit tests to use the fixture. (#8296)
Also allows tests to specify their own embedder contexts.
2019-03-25 15:10:24 -07:00
Chinmay Garde
d6ead18f43
Make it easy to write embedder unit tests by creating a fixture and config builder. (#8276)
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();
```
2019-03-25 11:58:38 -07:00
Chris Bracken
99f3f7a9c2
Fix incorrect transformation matrix (#8001)
Previously the transformation matrix returned on semantics nodes was
fetched by matrix col,row (incorrectly). This uses the SkMatrix
constants instead and adds a test.
2019-02-28 19:19:06 -08:00
Chris Bracken
3e4e6f5c54
Provide batching for semantics updates (#7988)
Some embedders prefer to minimise the number of semantics node/custom
action updates sent back to the host platform -- for example due to
expensive serialisation mechanisms, etc.

This patch provides a 'batch end' signal that provides embedders with an
indication of when a self-consistent set of semantics node or custom action
updates have been sent.

We overload the node/action ID with information that conveys a batch end
by using an ID (-1) that is never allotted to semantics nodes by the
framework.
2019-02-27 12:12:45 -08:00
Chris Bracken
abe9826a9d
Add accessibility semantics support to embedder (#7891)
Flutter's accessibility APIs consist of three main calls from the
embedder to the Dart application:

  1. FlutterEngineUpdateSemanticsEnabled: enables/disables semantics support.

  2. FlutterEngineUpdateAccessibilityFeatures: sets embedder-specific
     accessibility features.

  3. FlutterEngineDispatchSemanticsAction: dispatches an action (tap,
     long-press, scroll, etc.) to a semantics node.

and two main callbacks triggered by Dart code:

  1. FlutterUpdateSemanticsNodeCallback: notifies the embedder of
     updates to the properties of a given semantics node.

  2. FlutterUpdateSemanticsCustomActionCallback: notifies the embedder
     of updates to custom semantics actions registered in Dart code.

In the Flutter framework, when accessibility is first enabled, the
embedder will receive a stream of update callbacks notifying the
embedder of the full semantics tree. On further changes in the Dart
application, only updates will be sent.
2019-02-20 18:59:29 -08:00
Jason Simmons
0ca1d1f318
Remove the Dart JIT snapshot data from AOT builds of the embedder library (#7806)
Also extend the embedder unit tests to cover AOT execution
2019-02-15 09:43:23 -08:00
Chris Bracken
ce07399180
Add FlutterProjectArgs::root_isolate_create_callback (#7651)
Allows embedders to specify a callback to be invoked in isolate scope
once root isolate has been created and marked runnable.

As an example of where this is useful, embedder unit test fixtures may
want to include Dart functions backed by a native implementation. On
isolate creation, this patch allows the unit test author to call
Dart_SetNativeResolver in root isolate scope.
2019-02-06 14:16:47 -08:00
stuartmorgan
474d8837a9
Rename FlutterResult in embedder.h (#7567)
FlutterResult is also the name of a class in the Objective-C API
surface, which is problematic when building a framework that contains
both (such as a macOS implementation of the Flutter framework).
2019-01-29 14:01:31 -08:00
Chris Bracken
1e93a8eb39
Deprecate FlutterProjectArgs.main_path, packages_path (#7497)
As of Dart 2, running from Dart source is no longer supported.  Dart
code should now be compiled to kernel form and will be loaded by from
kernel.blob in the assets directory. We retain the struct members for ABI
stability. package_path is also not required since kernel blobs are
self-contained.
2019-01-16 12:47:39 -08:00
Chris Bracken
67cd7d4d3b
Compile embedder unit test Dart to kernel (#7231)
As of the migration to Dart 2, it has been necessary to compile Dart to
kernel prior to execution. The embedder currently requires that the
resulting kernel file be named `kernel_blob.bin` and be located at the
root of the assets directory passed to the embedder API.

This patch updates the test_fixtures build rule to perform a kernel
compile using frontend_server, outputting `kernel_blob.bin` to
`fixtures/test_target_name` directory, and updates the embedder
unittests to specify the kernel file rather than the Dart source file.

Since the kernel compiler requires a `main()` function to be defined, it
also updates `simple_main.dart` from runtime_unittests to define
`main()` rather than `simple_main()`.

This also updates all existing sub-targets to be testonly.

This relands commit ac9e521a1ddbb99816a93d92ce9fb70e950b3763, which was
reverted in commit 494112582932af98b282617d7a34b1fbb8c90307. Rather than
running as prebuilt_dart_action, we use dart_action to ensure the
frontend snapshot it compatible with the VM on which it's executed.
2018-12-16 12:23:18 -08:00
Chris Bracken
4941125829
Revert "Compile embedder unit test Dart to kernel (#7227)" (#7230)
This reverts commit ac9e521a1ddbb99816a93d92ce9fb70e950b3763.

This broke dynamic release mode builds of
//flutter/runtime:runtime_fixtures_kernel (likely all product-mode
builds).
2018-12-15 14:43:26 -08:00
Chris Bracken
ac9e521a1d
Compile embedder unit test Dart to kernel (#7227)
Compile embedder unit test Dart to kernel

As of the migration to Dart 2, it has been necessary to compile Dart to
kernel prior to execution. The embedder currently requires that the
resulting kernel file be named `kernel_blob.bin` and be located at the
root of the assets directory passed to the embedder API.

This patch updates the test_fixtures build rule to perform a kernel
compile using frontend_server, outputting `kernel_blob.bin` to
`fixtures/test_target_name` directory, and updates the embedder
unittests to specify the kernel file rather than the Dart source file.

Since the kernel compiler requires a `main()` function to be defined, it
also updates `simple_main.dart` from runtime_unittests to define
`main()` rather than `simple_main()`.

This also updates all existing sub-targets to be testonly.
2018-12-15 13:59:58 -08:00
Chris Bracken
25d99cd257
Use software renderer in embedder unittests (#6928)
Reduces spurious error log messages in GLContextMakeCurrent() attempting
set up the GR context:

  [ERROR:flutter/shell/gpu/gpu_surface_gl.cc(42)] Could not make the context current to setup the gr context.
2018-11-26 10:48:37 -08:00
Michael Goderbauer
70a1106b50
Unify copyright lines (#6757) 2018-11-07 12:24:35 -08:00
Chinmay Garde
b537231b7a
Fix build issues for the embedder on Windows. (#5386) 2018-05-25 15:20:36 -07:00
Chinmay Garde
f781f928d1
Test that the embedder can be launched and shut down correctly. (#4281) 2017-10-30 14:15:32 -07:00
Chinmay Garde
144dea37cd Add a unittest stub for the embedder. (#4276) 2017-10-25 13:09:59 -07:00