From 97e005d46af055a300bbbd19c3e12e4b5b2e3966 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Wed, 21 Feb 2024 11:12:16 -0800 Subject: [PATCH] [macOS] Wrap FlutterEngineTest in autoreleasepool Previously, these were not freeing allocations. This resulted in a lot of running engines/threads which triggered issues with running out of resources (Metal resources in particular). This also re-enables two disabled unit tests for view background colour. Issue: https://github.com/flutter/flutter/issues/124677 --- .../darwin/macos/framework/Source/FlutterEngineTest.mm | 6 ++---- .../darwin/macos/framework/Source/FlutterEngineTestUtils.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/shell/platform/darwin/macos/framework/Source/FlutterEngineTest.mm b/shell/platform/darwin/macos/framework/Source/FlutterEngineTest.mm index 857ef26afe43e..f6e692058030b 100644 --- a/shell/platform/darwin/macos/framework/Source/FlutterEngineTest.mm +++ b/shell/platform/darwin/macos/framework/Source/FlutterEngineTest.mm @@ -222,8 +222,7 @@ @implementation MockableFlutterEngine EXPECT_TRUE(stdout_capture.GetOutput().find("Hello logging") != std::string::npos); } -// TODO(cbracken): Needs deflaking. https://github.com/flutter/flutter/issues/124677 -TEST_F(FlutterEngineTest, DISABLED_BackgroundIsBlack) { +TEST_F(FlutterEngineTest, BackgroundIsBlack) { FlutterEngine* engine = GetFlutterEngine(); // Latch to ensure the entire layer tree has been generated and presented. @@ -252,8 +251,7 @@ @implementation MockableFlutterEngine latch.Wait(); } -// TODO(cbracken): Needs deflaking. https://github.com/flutter/flutter/issues/124677 -TEST_F(FlutterEngineTest, DISABLED_CanOverrideBackgroundColor) { +TEST_F(FlutterEngineTest, CanOverrideBackgroundColor) { FlutterEngine* engine = GetFlutterEngine(); // Latch to ensure the entire layer tree has been generated and presented. diff --git a/shell/platform/darwin/macos/framework/Source/FlutterEngineTestUtils.h b/shell/platform/darwin/macos/framework/Source/FlutterEngineTestUtils.h index 3e8cb595e8d5e..d9d78f88d1072 100644 --- a/shell/platform/darwin/macos/framework/Source/FlutterEngineTestUtils.h +++ b/shell/platform/darwin/macos/framework/Source/FlutterEngineTestUtils.h @@ -15,7 +15,7 @@ namespace flutter::testing { -class FlutterEngineTest : public ::testing::Test { +class FlutterEngineTest : public AutoreleasePoolTest { public: FlutterEngineTest();