@@ -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 ;
@@ -353,7 +351,7 @@ TEST_F(EmbedderA11yTest, A11yTreeIsConsistentUsingUnstableCallbacks) {
353
351
auto engine = builder.LaunchEngine ();
354
352
ASSERT_TRUE (engine.is_valid ());
355
353
356
- // Wait for initial NotifySemanticsEnabled (false).
354
+ // 1: Wait for initial notifySemanticsEnabled (false).
357
355
fml::AutoResetWaitableEvent notify_semantics_enabled_latch;
358
356
notify_semantics_enabled_callback = [&](Dart_NativeArguments args) {
359
357
Dart_Handle exception = nullptr ;
@@ -364,17 +362,7 @@ TEST_F(EmbedderA11yTest, A11yTreeIsConsistentUsingUnstableCallbacks) {
364
362
};
365
363
notify_semantics_enabled_latch.Wait ();
366
364
367
- // Prepare to NotifyAccessibilityFeatures call
368
- fml::AutoResetWaitableEvent notify_features_latch;
369
- notify_accessibility_features_callback = [&](Dart_NativeArguments args) {
370
- Dart_Handle exception = nullptr ;
371
- bool enabled =
372
- ::tonic::DartConverter<bool >::FromArguments (args, 0 , exception);
373
- ASSERT_FALSE (enabled);
374
- notify_features_latch.Signal ();
375
- };
376
-
377
- // Enable semantics. Wait for NotifySemanticsEnabled(true).
365
+ // 2: Enable semantics. Wait for notifySemanticsEnabled(true).
378
366
fml::AutoResetWaitableEvent notify_semantics_enabled_latch_2;
379
367
notify_semantics_enabled_callback = [&](Dart_NativeArguments args) {
380
368
Dart_Handle exception = nullptr ;
@@ -387,10 +375,18 @@ TEST_F(EmbedderA11yTest, A11yTreeIsConsistentUsingUnstableCallbacks) {
387
375
ASSERT_EQ (result, FlutterEngineResult::kSuccess );
388
376
notify_semantics_enabled_latch_2.Wait ();
389
377
390
- // Wait for initial accessibility features (reduce_motion == false)
378
+ // 3: Wait for notifyAccessibilityFeatures (reduce_motion == false)
379
+ fml::AutoResetWaitableEvent notify_features_latch;
380
+ notify_accessibility_features_callback = [&](Dart_NativeArguments args) {
381
+ Dart_Handle exception = nullptr ;
382
+ bool enabled =
383
+ ::tonic::DartConverter<bool >::FromArguments (args, 0 , exception);
384
+ ASSERT_FALSE (enabled);
385
+ notify_features_latch.Signal ();
386
+ };
391
387
notify_features_latch.Wait ();
392
388
393
- // Set accessibility features: (reduce_motion == true)
389
+ // 4: Wait for notifyAccessibilityFeatures (reduce_motion == true)
394
390
fml::AutoResetWaitableEvent notify_features_latch_2;
395
391
notify_accessibility_features_callback = [&](Dart_NativeArguments args) {
396
392
Dart_Handle exception = nullptr ;
@@ -404,12 +400,12 @@ TEST_F(EmbedderA11yTest, A11yTreeIsConsistentUsingUnstableCallbacks) {
404
400
ASSERT_EQ (result, FlutterEngineResult::kSuccess );
405
401
notify_features_latch_2.Wait ();
406
402
407
- // Wait for UpdateSemantics callback on platform (current) thread.
403
+ // 5: Wait for UpdateSemantics callback on platform (current) thread.
408
404
signal_native_latch.Wait ();
409
405
fml::MessageLoop::GetCurrent ().RunExpiredTasksNow ();
410
406
semantics_update_latch.Wait ();
411
407
412
- // Dispatch a tap to semantics node 42. Wait for NotifySemanticsAction.
408
+ // 6: Dispatch a tap to semantics node 42. Wait for NotifySemanticsAction.
413
409
fml::AutoResetWaitableEvent notify_semantics_action_latch;
414
410
notify_semantics_action_callback = [&](Dart_NativeArguments args) {
415
411
Dart_Handle exception = nullptr ;
@@ -433,7 +429,7 @@ TEST_F(EmbedderA11yTest, A11yTreeIsConsistentUsingUnstableCallbacks) {
433
429
ASSERT_EQ (result, FlutterEngineResult::kSuccess );
434
430
notify_semantics_action_latch.Wait ();
435
431
436
- // Disable semantics. Wait for NotifySemanticsEnabled(false).
432
+ // 7: Disable semantics. Wait for NotifySemanticsEnabled(false).
437
433
fml::AutoResetWaitableEvent notify_semantics_enabled_latch_3;
438
434
notify_semantics_enabled_callback = [&](Dart_NativeArguments args) {
439
435
Dart_Handle exception = nullptr ;
@@ -546,7 +542,7 @@ TEST_F(EmbedderA11yTest, A11yTreeIsConsistentUsingLegacyCallbacks) {
546
542
auto engine = builder.LaunchEngine ();
547
543
ASSERT_TRUE (engine.is_valid ());
548
544
549
- // Wait for initial NotifySemanticsEnabled (false).
545
+ // 1: Wait for initial notifySemanticsEnabled (false).
550
546
fml::AutoResetWaitableEvent notify_semantics_enabled_latch;
551
547
notify_semantics_enabled_callback = [&](Dart_NativeArguments args) {
552
548
Dart_Handle exception = nullptr ;
@@ -557,17 +553,7 @@ TEST_F(EmbedderA11yTest, A11yTreeIsConsistentUsingLegacyCallbacks) {
557
553
};
558
554
notify_semantics_enabled_latch.Wait ();
559
555
560
- // Prepare to NotifyAccessibilityFeatures call
561
- fml::AutoResetWaitableEvent notify_features_latch;
562
- notify_accessibility_features_callback = [&](Dart_NativeArguments args) {
563
- Dart_Handle exception = nullptr ;
564
- bool enabled =
565
- ::tonic::DartConverter<bool >::FromArguments (args, 0 , exception);
566
- ASSERT_FALSE (enabled);
567
- notify_features_latch.Signal ();
568
- };
569
-
570
- // Enable semantics. Wait for NotifySemanticsEnabled(true).
556
+ // 2: Enable semantics. Wait for notifySemanticsEnabled(true).
571
557
fml::AutoResetWaitableEvent notify_semantics_enabled_latch_2;
572
558
notify_semantics_enabled_callback = [&](Dart_NativeArguments args) {
573
559
Dart_Handle exception = nullptr ;
@@ -580,10 +566,18 @@ TEST_F(EmbedderA11yTest, A11yTreeIsConsistentUsingLegacyCallbacks) {
580
566
ASSERT_EQ (result, FlutterEngineResult::kSuccess );
581
567
notify_semantics_enabled_latch_2.Wait ();
582
568
583
- // Wait for initial accessibility features (reduce_motion == false)
569
+ // 3: Wait for notifyAccessibilityFeatures (reduce_motion == false)
570
+ fml::AutoResetWaitableEvent notify_features_latch;
571
+ notify_accessibility_features_callback = [&](Dart_NativeArguments args) {
572
+ Dart_Handle exception = nullptr ;
573
+ bool enabled =
574
+ ::tonic::DartConverter<bool >::FromArguments (args, 0 , exception);
575
+ ASSERT_FALSE (enabled);
576
+ notify_features_latch.Signal ();
577
+ };
584
578
notify_features_latch.Wait ();
585
579
586
- // Set accessibility features: (reduce_motion == true)
580
+ // 4: Wait for notifyAccessibilityFeatures (reduce_motion == true)
587
581
fml::AutoResetWaitableEvent notify_features_latch_2;
588
582
notify_accessibility_features_callback = [&](Dart_NativeArguments args) {
589
583
Dart_Handle exception = nullptr ;
@@ -597,7 +591,7 @@ TEST_F(EmbedderA11yTest, A11yTreeIsConsistentUsingLegacyCallbacks) {
597
591
ASSERT_EQ (result, FlutterEngineResult::kSuccess );
598
592
notify_features_latch_2.Wait ();
599
593
600
- // Wait for UpdateSemantics callback on platform (current) thread.
594
+ // 5: Wait for UpdateSemantics callback on platform (current) thread.
601
595
signal_native_latch.Wait ();
602
596
fml::MessageLoop::GetCurrent ().RunExpiredTasksNow ();
603
597
semantics_node_latch.Wait ();
@@ -607,7 +601,7 @@ TEST_F(EmbedderA11yTest, A11yTreeIsConsistentUsingLegacyCallbacks) {
607
601
ASSERT_EQ (1 , action_count);
608
602
ASSERT_EQ (1 , action_batch_end_count);
609
603
610
- // Dispatch a tap to semantics node 42. Wait for NotifySemanticsAction.
604
+ // 6: Dispatch a tap to semantics node 42. Wait for NotifySemanticsAction.
611
605
fml::AutoResetWaitableEvent notify_semantics_action_latch;
612
606
notify_semantics_action_callback = [&](Dart_NativeArguments args) {
613
607
Dart_Handle exception = nullptr ;
@@ -631,7 +625,7 @@ TEST_F(EmbedderA11yTest, A11yTreeIsConsistentUsingLegacyCallbacks) {
631
625
ASSERT_EQ (result, FlutterEngineResult::kSuccess );
632
626
notify_semantics_action_latch.Wait ();
633
627
634
- // Disable semantics. Wait for NotifySemanticsEnabled(false).
628
+ // 7: Disable semantics. Wait for NotifySemanticsEnabled(false).
635
629
fml::AutoResetWaitableEvent notify_semantics_enabled_latch_3;
636
630
notify_semantics_enabled_callback = [&](Dart_NativeArguments args) {
637
631
Dart_Handle exception = nullptr ;
0 commit comments