@@ -15,6 +15,21 @@ void main() {
1515 late FlutterDriver driver;
1616
1717 setUpAll (() async {
18+ // Turn off any accessibility services that may be running. The purpose of
19+ // the test is to measure the time it takes to create the initial
20+ // semantics tree in isolation. If accessibility services are on, the
21+ // semantics tree gets generated during the first frame and we can't
22+ // measure it in isolation.
23+ final Process run = await Process .start (_adbPath (), const < String > [
24+ 'shell' ,
25+ 'settings' ,
26+ 'put' ,
27+ 'secure' ,
28+ 'enabled_accessibility_services' ,
29+ 'null' ,
30+ ]);
31+ await run.exitCode;
32+
1833 driver = await FlutterDriver .connect (printCommunication: true );
1934 });
2035
@@ -31,7 +46,13 @@ void main() {
3146 await driver.forceGC ();
3247
3348 final Timeline timeline = await driver.traceAction (() async {
34- expect (await driver.setSemantics (true ), isTrue);
49+ expect (
50+ await driver.setSemantics (true ),
51+ isTrue,
52+ reason: 'Could not toggle semantics to on because semantics were already '
53+ 'on, but the test needs to toggle semantics to measure the initial '
54+ 'semantics tree generation in isolation.'
55+ );
3556 });
3657
3758 final Iterable <TimelineEvent >? semanticsEvents = timeline.events? .where ((TimelineEvent event) => event.name == 'SEMANTICS' );
@@ -45,3 +66,12 @@ void main() {
4566 }, timeout: Timeout .none);
4667 });
4768}
69+
70+ String _adbPath () {
71+ final String ? androidHome = Platform .environment['ANDROID_HOME' ] ?? Platform .environment['ANDROID_SDK_ROOT' ];
72+ if (androidHome == null ) {
73+ return 'adb' ;
74+ } else {
75+ return p.join (androidHome, 'platform-tools' , 'adb' );
76+ }
77+ }
0 commit comments