@@ -15,6 +15,21 @@ void main() {
15
15
late FlutterDriver driver;
16
16
17
17
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
+
18
33
driver = await FlutterDriver .connect (printCommunication: true );
19
34
});
20
35
@@ -31,7 +46,13 @@ void main() {
31
46
await driver.forceGC ();
32
47
33
48
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
+ );
35
56
});
36
57
37
58
final Iterable <TimelineEvent >? semanticsEvents = timeline.events? .where ((TimelineEvent event) => event.name == 'SEMANTICS' );
@@ -45,3 +66,12 @@ void main() {
45
66
}, timeout: Timeout .none);
46
67
});
47
68
}
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