Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Impeller] Run simulator tests with Impeller enabled. #56740

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 9 additions & 17 deletions shell/platform/darwin/ios/framework/Source/FlutterEngineTest.mm
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,13 @@ - (void)testSetHandlerAfterRun {
fml::AutoResetWaitableEvent latch;
[engine run];
flutter::Shell& shell = engine.shell;
engine.shell.GetTaskRunners().GetUITaskRunner()->PostTask([&latch, &shell] {
flutter::Engine::Delegate& delegate = shell;
auto message = std::make_unique<flutter::PlatformMessage>("foo", nullptr);
delegate.OnEngineHandlePlatformMessage(std::move(message));
latch.Signal();
});
fml::TaskRunner::RunNowOrPostTask(
engine.shell.GetTaskRunners().GetUITaskRunner(), [&latch, &shell] {
flutter::Engine::Delegate& delegate = shell;
auto message = std::make_unique<flutter::PlatformMessage>("foo", nullptr);
delegate.OnEngineHandlePlatformMessage(std::move(message));
latch.Signal();
});
latch.Wait();
[registrar.messenger setMessageHandlerOnChannel:@"foo"
binaryMessageHandler:^(NSData* message, FlutterBinaryReply reply) {
Expand All @@ -287,14 +288,11 @@ - (void)testSetHandlerAfterRun {

- (void)testThreadPrioritySetCorrectly {
XCTestExpectation* prioritiesSet = [self expectationWithDescription:@"prioritiesSet"];
prioritiesSet.expectedFulfillmentCount = 3;
prioritiesSet.expectedFulfillmentCount = 2;

IMP mockSetThreadPriority =
imp_implementationWithBlock(^(NSThread* thread, double threadPriority) {
if ([thread.name hasSuffix:@".ui"]) {
XCTAssertEqual(threadPriority, 1.0);
[prioritiesSet fulfill];
} else if ([thread.name hasSuffix:@".raster"]) {
if ([thread.name hasSuffix:@".raster"]) {
XCTAssertEqual(threadPriority, 1.0);
[prioritiesSet fulfill];
} else if ([thread.name hasSuffix:@".io"]) {
Expand Down Expand Up @@ -429,10 +427,6 @@ - (void)testSpawnsShareGpuContext {
std::shared_ptr<flutter::IOSContext> engine_context = [engine iosPlatformView]->GetIosContext();
std::shared_ptr<flutter::IOSContext> spawn_context = [spawn iosPlatformView]->GetIosContext();
XCTAssertEqual(engine_context, spawn_context);
// If this assert fails it means we may be using the software. For software rendering, this is
// expected to be nullptr.
XCTAssertTrue(engine_context->GetMainContext() != nullptr);
XCTAssertEqual(engine_context->GetMainContext(), spawn_context->GetMainContext());
}

- (void)testEnableSemanticsWhenFlutterViewAccessibilityDidCall {
Expand All @@ -445,7 +439,6 @@ - (void)testEnableSemanticsWhenFlutterViewAccessibilityDidCall {
- (void)testCanMergePlatformAndUIThread {
#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
auto settings = FLTDefaultSettingsForBundle();
settings.enable_impeller = true;
FlutterDartProject* project = [[FlutterDartProject alloc] initWithSettings:settings];
FlutterEngine* engine = [[FlutterEngine alloc] initWithName:@"foobar" project:project];
[engine run];
Expand All @@ -458,7 +451,6 @@ - (void)testCanMergePlatformAndUIThread {
- (void)testCanUnMergePlatformAndUIThread {
#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
auto settings = FLTDefaultSettingsForBundle();
settings.enable_impeller = true;
settings.merged_platform_ui_thread = false;
FlutterDartProject* project = [[FlutterDartProject alloc] initWithSettings:settings];
FlutterEngine* engine = [[FlutterEngine alloc] initWithName:@"foobar" project:project];
Expand Down
1 change: 1 addition & 0 deletions shell/platform/darwin/ios/ios_context.mm
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
}

IOSRenderingBackend IOSContext::GetBackend() const {
// Overridden by Impeller subclasses.
return IOSRenderingBackend::kSkia;
}

Expand Down
2 changes: 0 additions & 2 deletions testing/ios/IosUnitTests/App/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@
</dict>
<key>FLTLeakDartVM</key>
<false/>
<key>FLTEnableImpeller</key>
<false/>
<key>FLTTraceSystrace</key>
<false/>
<key>FLTEnableDartProfiling</key>
Expand Down