From b54eae3efa8715078bd9fe04b2292506d422b301 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Fri, 20 Oct 2023 10:30:16 -0700 Subject: [PATCH] [macOS] Eliminate extraneous loadView calls (#47166) Eliminate unnecessary calls to [NSViewController loadView]. To quote the [documentation][loadview] for this method: "Do not call this method. If you require this method to be called, access the view property." In several of the existing tests, we do read viewController.view, and the other tests pass without this line regardless. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- .../macos/framework/Source/AccessibilityBridgeMacTest.mm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/shell/platform/darwin/macos/framework/Source/AccessibilityBridgeMacTest.mm b/shell/platform/darwin/macos/framework/Source/AccessibilityBridgeMacTest.mm index f499e80dc642a..1b3c10a00230e 100644 --- a/shell/platform/darwin/macos/framework/Source/AccessibilityBridgeMacTest.mm +++ b/shell/platform/darwin/macos/framework/Source/AccessibilityBridgeMacTest.mm @@ -61,7 +61,6 @@ @implementation AccessibilityBridgeTestViewController TEST(AccessibilityBridgeMacTest, SendsAccessibilityCreateNotificationToWindowOfFlutterView) { FlutterViewController* viewController = CreateTestViewController(); FlutterEngine* engine = viewController.engine; - [viewController loadView]; NSWindow* expectedTarget = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600) styleMask:NSBorderlessWindowMask @@ -122,7 +121,6 @@ @implementation AccessibilityBridgeTestViewController TEST(AccessibilityBridgeMacTest, NonZeroRootNodeId) { FlutterViewController* viewController = CreateTestViewController(); FlutterEngine* engine = viewController.engine; - [viewController loadView]; NSWindow* expectedTarget = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600) styleMask:NSBorderlessWindowMask @@ -192,7 +190,7 @@ @implementation AccessibilityBridgeTestViewController TEST(AccessibilityBridgeMacTest, DoesNotSendAccessibilityCreateNotificationWhenHeadless) { FlutterViewController* viewController = CreateTestViewController(); FlutterEngine* engine = viewController.engine; - [viewController loadView]; + // Setting up bridge so that the AccessibilityBridgeMacDelegateSpy // can query semantics information from. engine.semanticsEnabled = YES; @@ -238,7 +236,6 @@ @implementation AccessibilityBridgeTestViewController TEST(AccessibilityBridgeMacTest, DoesNotSendAccessibilityCreateNotificationWhenNoWindow) { FlutterViewController* viewController = CreateTestViewController(); FlutterEngine* engine = viewController.engine; - [viewController loadView]; // Setting up bridge so that the AccessibilityBridgeMacDelegateSpy // can query semantics information from.