@@ -177,7 +177,7 @@ TEST_F(EmbedderA11yTest, A11yTreeIsConsistent) {
177
177
auto engine = builder.LaunchEngine ();
178
178
ASSERT_TRUE (engine.is_valid ());
179
179
180
- // Wait for initial NotifySemanticsEnabled (false).
180
+ // 1: Wait for initial notifySemanticsEnabled (false).
181
181
fml::AutoResetWaitableEvent notify_semantics_enabled_latch;
182
182
notify_semantics_enabled_callback = [&](Dart_NativeArguments args) {
183
183
Dart_Handle exception = nullptr ;
@@ -188,17 +188,7 @@ TEST_F(EmbedderA11yTest, A11yTreeIsConsistent) {
188
188
};
189
189
notify_semantics_enabled_latch.Wait ();
190
190
191
- // Prepare to NotifyAccessibilityFeatures call
192
- fml::AutoResetWaitableEvent notify_features_latch;
193
- notify_accessibility_features_callback = [&](Dart_NativeArguments args) {
194
- Dart_Handle exception = nullptr ;
195
- bool enabled =
196
- ::tonic::DartConverter<bool >::FromArguments (args, 0 , exception);
197
- ASSERT_FALSE (enabled);
198
- notify_features_latch.Signal ();
199
- };
200
-
201
- // Enable semantics. Wait for NotifySemanticsEnabled(true).
191
+ // 2: Enable semantics. Wait for notifySemanticsEnabled(true).
202
192
fml::AutoResetWaitableEvent notify_semantics_enabled_latch_2;
203
193
notify_semantics_enabled_callback = [&](Dart_NativeArguments args) {
204
194
Dart_Handle exception = nullptr ;
@@ -211,10 +201,18 @@ TEST_F(EmbedderA11yTest, A11yTreeIsConsistent) {
211
201
ASSERT_EQ (result, FlutterEngineResult::kSuccess );
212
202
notify_semantics_enabled_latch_2.Wait ();
213
203
214
- // Wait for initial accessibility features (reduce_motion == false)
204
+ // 3: Wait for notifyAccessibilityFeatures (reduce_motion == false)
205
+ fml::AutoResetWaitableEvent notify_features_latch;
206
+ notify_accessibility_features_callback = [&](Dart_NativeArguments args) {
207
+ Dart_Handle exception = nullptr ;
208
+ bool enabled =
209
+ ::tonic::DartConverter<bool >::FromArguments (args, 0 , exception);
210
+ ASSERT_FALSE (enabled);
211
+ notify_features_latch.Signal ();
212
+ };
215
213
notify_features_latch.Wait ();
216
214
217
- // Set accessibility features: (reduce_motion == true)
215
+ // 4: Wait for notifyAccessibilityFeatures (reduce_motion == true)
218
216
fml::AutoResetWaitableEvent notify_features_latch_2;
219
217
notify_accessibility_features_callback = [&](Dart_NativeArguments args) {
220
218
Dart_Handle exception = nullptr ;
@@ -228,12 +226,12 @@ TEST_F(EmbedderA11yTest, A11yTreeIsConsistent) {
228
226
ASSERT_EQ (result, FlutterEngineResult::kSuccess );
229
227
notify_features_latch_2.Wait ();
230
228
231
- // Wait for UpdateSemantics callback on platform (current) thread.
229
+ // 5: Wait for UpdateSemantics callback on platform (current) thread.
232
230
signal_native_latch.Wait ();
233
231
fml::MessageLoop::GetCurrent ().RunExpiredTasksNow ();
234
232
semantics_update_latch.Wait ();
235
233
236
- // Dispatch a tap to semantics node 42. Wait for NotifySemanticsAction.
234
+ // 6: Dispatch a tap to semantics node 42. Wait for NotifySemanticsAction.
237
235
fml::AutoResetWaitableEvent notify_semantics_action_latch;
238
236
notify_semantics_action_callback = [&](Dart_NativeArguments args) {
239
237
Dart_Handle exception = nullptr ;
@@ -257,7 +255,7 @@ TEST_F(EmbedderA11yTest, A11yTreeIsConsistent) {
257
255
ASSERT_EQ (result, FlutterEngineResult::kSuccess );
258
256
notify_semantics_action_latch.Wait ();
259
257
260
- // Disable semantics. Wait for NotifySemanticsEnabled(false).
258
+ // 7: Disable semantics. Wait for NotifySemanticsEnabled(false).
261
259
fml::AutoResetWaitableEvent notify_semantics_enabled_latch_3;
262
260
notify_semantics_enabled_callback = [&](Dart_NativeArguments args) {
263
261
Dart_Handle exception = nullptr ;
0 commit comments