[macOS] Fail early when no a11y notification (flutter/engine#47129)
In the SendsAccessibilityCreateNotificationToWindowOfFlutterView test in AccessibilityBridgeMacTest, we look for an accessibility notification by name in a map stored in the test accessibility bridge. If there is no such notification, bail out immediately. Previously we got a crash since we called `second` to retrieve the value associated with the map entry we find, without actually checking that we'd actually found an entry. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
@@ -105,10 +105,10 @@ TEST(AccessibilityBridgeMacTest, SendsAccessibilityCreateNotificationToWindowOfF
|
||||
|
||||
bridge->OnAccessibilityEvent(targeted_event);
|
||||
|
||||
EXPECT_EQ(bridge->actual_notifications.size(), 1u);
|
||||
EXPECT_EQ(
|
||||
bridge->actual_notifications.find([NSAccessibilityCreatedNotification UTF8String])->second,
|
||||
expectedTarget);
|
||||
ASSERT_EQ(bridge->actual_notifications.size(), 1u);
|
||||
auto target = bridge->actual_notifications.find([NSAccessibilityCreatedNotification UTF8String]);
|
||||
ASSERT_NE(target, bridge->actual_notifications.end());
|
||||
EXPECT_EQ(target->second, expectedTarget);
|
||||
[engine shutDownEngine];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user