[Impeller] Run simulator tests with Impeller enabled. (flutter/engine#56740)

The Info.plist override was missed earlier.

The main changes to the tests are due to the UI thread merge with the platform thread. The amendment to the "spawn" API are due to the fact that the assertions checked for the presence of GrDirectContext which will never exist with Impeller.

Unblocks https://github.com/flutter/engine/pull/56706
This commit is contained in:
Chinmay Garde 2024-11-21 15:48:59 -08:00 committed by GitHub
parent 8958ff46da
commit daa09b9a64
3 changed files with 10 additions and 19 deletions

View File

@ -270,12 +270,13 @@ FLUTTER_ASSERT_ARC
fml::AutoResetWaitableEvent latch; fml::AutoResetWaitableEvent latch;
[engine run]; [engine run];
flutter::Shell& shell = engine.shell; flutter::Shell& shell = engine.shell;
engine.shell.GetTaskRunners().GetUITaskRunner()->PostTask([&latch, &shell] { fml::TaskRunner::RunNowOrPostTask(
flutter::Engine::Delegate& delegate = shell; engine.shell.GetTaskRunners().GetUITaskRunner(), [&latch, &shell] {
auto message = std::make_unique<flutter::PlatformMessage>("foo", nullptr); flutter::Engine::Delegate& delegate = shell;
delegate.OnEngineHandlePlatformMessage(std::move(message)); auto message = std::make_unique<flutter::PlatformMessage>("foo", nullptr);
latch.Signal(); delegate.OnEngineHandlePlatformMessage(std::move(message));
}); latch.Signal();
});
latch.Wait(); latch.Wait();
[registrar.messenger setMessageHandlerOnChannel:@"foo" [registrar.messenger setMessageHandlerOnChannel:@"foo"
binaryMessageHandler:^(NSData* message, FlutterBinaryReply reply) { binaryMessageHandler:^(NSData* message, FlutterBinaryReply reply) {
@ -287,14 +288,11 @@ FLUTTER_ASSERT_ARC
- (void)testThreadPrioritySetCorrectly { - (void)testThreadPrioritySetCorrectly {
XCTestExpectation* prioritiesSet = [self expectationWithDescription:@"prioritiesSet"]; XCTestExpectation* prioritiesSet = [self expectationWithDescription:@"prioritiesSet"];
prioritiesSet.expectedFulfillmentCount = 3; prioritiesSet.expectedFulfillmentCount = 2;
IMP mockSetThreadPriority = IMP mockSetThreadPriority =
imp_implementationWithBlock(^(NSThread* thread, double threadPriority) { imp_implementationWithBlock(^(NSThread* thread, double threadPriority) {
if ([thread.name hasSuffix:@".ui"]) { if ([thread.name hasSuffix:@".raster"]) {
XCTAssertEqual(threadPriority, 1.0);
[prioritiesSet fulfill];
} else if ([thread.name hasSuffix:@".raster"]) {
XCTAssertEqual(threadPriority, 1.0); XCTAssertEqual(threadPriority, 1.0);
[prioritiesSet fulfill]; [prioritiesSet fulfill];
} else if ([thread.name hasSuffix:@".io"]) { } else if ([thread.name hasSuffix:@".io"]) {
@ -429,10 +427,6 @@ FLUTTER_ASSERT_ARC
std::shared_ptr<flutter::IOSContext> engine_context = [engine iosPlatformView]->GetIosContext(); std::shared_ptr<flutter::IOSContext> engine_context = [engine iosPlatformView]->GetIosContext();
std::shared_ptr<flutter::IOSContext> spawn_context = [spawn iosPlatformView]->GetIosContext(); std::shared_ptr<flutter::IOSContext> spawn_context = [spawn iosPlatformView]->GetIosContext();
XCTAssertEqual(engine_context, spawn_context); 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 { - (void)testEnableSemanticsWhenFlutterViewAccessibilityDidCall {
@ -445,7 +439,6 @@ FLUTTER_ASSERT_ARC
- (void)testCanMergePlatformAndUIThread { - (void)testCanMergePlatformAndUIThread {
#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR #if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
auto settings = FLTDefaultSettingsForBundle(); auto settings = FLTDefaultSettingsForBundle();
settings.enable_impeller = true;
FlutterDartProject* project = [[FlutterDartProject alloc] initWithSettings:settings]; FlutterDartProject* project = [[FlutterDartProject alloc] initWithSettings:settings];
FlutterEngine* engine = [[FlutterEngine alloc] initWithName:@"foobar" project:project]; FlutterEngine* engine = [[FlutterEngine alloc] initWithName:@"foobar" project:project];
[engine run]; [engine run];
@ -458,7 +451,6 @@ FLUTTER_ASSERT_ARC
- (void)testCanUnMergePlatformAndUIThread { - (void)testCanUnMergePlatformAndUIThread {
#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR #if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
auto settings = FLTDefaultSettingsForBundle(); auto settings = FLTDefaultSettingsForBundle();
settings.enable_impeller = true;
settings.merged_platform_ui_thread = false; settings.merged_platform_ui_thread = false;
FlutterDartProject* project = [[FlutterDartProject alloc] initWithSettings:settings]; FlutterDartProject* project = [[FlutterDartProject alloc] initWithSettings:settings];
FlutterEngine* engine = [[FlutterEngine alloc] initWithName:@"foobar" project:project]; FlutterEngine* engine = [[FlutterEngine alloc] initWithName:@"foobar" project:project];

View File

@ -56,6 +56,7 @@ std::unique_ptr<IOSContext> IOSContext::Create(
} }
IOSRenderingBackend IOSContext::GetBackend() const { IOSRenderingBackend IOSContext::GetBackend() const {
// Overridden by Impeller subclasses.
return IOSRenderingBackend::kSkia; return IOSRenderingBackend::kSkia;
} }

View File

@ -46,8 +46,6 @@
</dict> </dict>
<key>FLTLeakDartVM</key> <key>FLTLeakDartVM</key>
<false/> <false/>
<key>FLTEnableImpeller</key>
<false/>
<key>FLTTraceSystrace</key> <key>FLTTraceSystrace</key>
<false/> <false/>
<key>FLTEnableDartProfiling</key> <key>FLTEnableDartProfiling</key>