This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
FlutterEngineGroup for Android #23675
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
64a1778
half of the plumbing
xster 37acd45
piped through, start manual testing
xster 78dd4d4
autoformat
xster 3241679
patched Android together
xster 3a0d864
Simplified shell spawn down to just take run configuration
xster e2b91ff
a round of comments and docs
xster 9767a6a
add tests
xster 08654a5
autoformat
xster bb201cf
fix
xster 25520ad
reviews
xster 1b4b7c6
fix licenses + forgot to document some methods on FlutterEngineGroup
xster 4ec9cdd
forgot to refactor scenario test
xster 02fbbc6
revert the nativeInit crash for now since our tests rely on it
xster 4dc1f9b
having trouble getting the golden images to look right, I suspect onl…
xster 94fe64e
fix golden size
xster f402440
refactor jni
xster 01d1057
local and ci autoformats fighting each other
xster 448bdd6
review
xster a591f5f
autoformat fighting each other again
xster File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
| .*.sw? | ||
| .DS_Store | ||
| .ccls-cache | ||
| .cache | ||
| .classpath | ||
| .clangd/ | ||
| .cproject | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2438,39 +2438,61 @@ TEST_F(ShellTest, Spawn) { | |
| ASSERT_TRUE(configuration.IsValid()); | ||
| configuration.SetEntrypoint("fixturesAreFunctionalMain"); | ||
|
|
||
| auto second_configuration = RunConfiguration::InferFromSettings(settings); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tweaked the test slightly to make sure it can get 2 different entrypoints. |
||
| ASSERT_TRUE(second_configuration.IsValid()); | ||
| second_configuration.SetEntrypoint("testCanLaunchSecondaryIsolate"); | ||
|
|
||
| fml::AutoResetWaitableEvent main_latch; | ||
| std::string last_entry_point; | ||
| // Fulfill native function for the first Shell's entrypoint. | ||
| AddNativeCallback( | ||
| "SayHiFromFixturesAreFunctionalMain", | ||
| CREATE_NATIVE_ENTRY([&main_latch](auto args) { main_latch.Signal(); })); | ||
| "SayHiFromFixturesAreFunctionalMain", CREATE_NATIVE_ENTRY([&](auto args) { | ||
| last_entry_point = shell->GetEngine()->GetLastEntrypoint(); | ||
| main_latch.Signal(); | ||
| })); | ||
| // Fulfill native function for the second Shell's entrypoint. | ||
| AddNativeCallback( | ||
| // The Dart native function names aren't very consistent but this is just | ||
| // the native function name of the second vm entrypoint in the fixture. | ||
| "NotifyNative", CREATE_NATIVE_ENTRY([&](auto args) {})); | ||
|
|
||
| RunEngine(shell.get(), std::move(configuration)); | ||
| main_latch.Wait(); | ||
| ASSERT_TRUE(DartVMRef::IsInstanceRunning()); | ||
| // Check first Shell ran the first entrypoint. | ||
| ASSERT_EQ("fixturesAreFunctionalMain", last_entry_point); | ||
|
|
||
| PostSync(shell->GetTaskRunners().GetPlatformTaskRunner(), [this, | ||
| &spawner = shell, | ||
| settings]() { | ||
| MockPlatformViewDelegate platform_view_delegate; | ||
| auto spawn = spawner->Spawn( | ||
| settings, | ||
| [&platform_view_delegate](Shell& shell) { | ||
| auto result = std::make_unique<MockPlatformView>( | ||
| platform_view_delegate, shell.GetTaskRunners()); | ||
| ON_CALL(*result, CreateRenderingSurface()) | ||
| .WillByDefault(::testing::Invoke( | ||
| [] { return std::make_unique<MockSurface>(); })); | ||
| return result; | ||
| }, | ||
| [](Shell& shell) { return std::make_unique<Rasterizer>(shell); }); | ||
| ASSERT_NE(nullptr, spawn.get()); | ||
| ASSERT_TRUE(ValidateShell(spawn.get())); | ||
|
|
||
| PostSync(spawner->GetTaskRunners().GetIOTaskRunner(), [&spawner, &spawn] { | ||
| ASSERT_EQ(spawner->GetIOManager()->GetResourceContext().get(), | ||
| spawn->GetIOManager()->GetResourceContext().get()); | ||
| }); | ||
| DestroyShell(std::move(spawn)); | ||
| }); | ||
| PostSync( | ||
| shell->GetTaskRunners().GetPlatformTaskRunner(), | ||
| [this, &spawner = shell, &second_configuration]() { | ||
| MockPlatformViewDelegate platform_view_delegate; | ||
| auto spawn = spawner->Spawn( | ||
| std::move(second_configuration), | ||
| [&platform_view_delegate](Shell& shell) { | ||
| auto result = std::make_unique<MockPlatformView>( | ||
| platform_view_delegate, shell.GetTaskRunners()); | ||
| ON_CALL(*result, CreateRenderingSurface()) | ||
| .WillByDefault(::testing::Invoke( | ||
| [] { return std::make_unique<MockSurface>(); })); | ||
| return result; | ||
| }, | ||
| [](Shell& shell) { return std::make_unique<Rasterizer>(shell); }); | ||
| ASSERT_NE(nullptr, spawn.get()); | ||
| ASSERT_TRUE(ValidateShell(spawn.get())); | ||
|
|
||
| PostSync(spawner->GetTaskRunners().GetUITaskRunner(), [&spawn] { | ||
| // Check second shell ran the second entrypoint. | ||
| ASSERT_EQ("testCanLaunchSecondaryIsolate", | ||
| spawn->GetEngine()->GetLastEntrypoint()); | ||
| }); | ||
|
|
||
| PostSync( | ||
| spawner->GetTaskRunners().GetIOTaskRunner(), [&spawner, &spawn] { | ||
| ASSERT_EQ(spawner->GetIOManager()->GetResourceContext().get(), | ||
| spawn->GetIOManager()->GetResourceContext().get()); | ||
| }); | ||
| DestroyShell(std::move(spawn)); | ||
| }); | ||
|
|
||
| DestroyShell(std::move(shell)); | ||
| ASSERT_FALSE(DartVMRef::IsInstanceRunning()); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was changed from Settings to RunConfiguration since the spawning mechanism can't consume most of the Settings data anyway (since we're spawing off of a previous Shell which was already built using existing Settings data).