Unverified Commit ec2621f7 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Force a11y services to off for complex_layout_semantics_perf test (#108906)

parent c6aeaa30
......@@ -15,6 +15,21 @@ void main() {
late FlutterDriver driver;
setUpAll(() async {
// Turn off any accessibility services that may be running. The purpose of
// the test is to measure the time it takes to create the initial
// semantics tree in isolation. If accessibility services are on, the
// semantics tree gets generated during the first frame and we can't
// measure it in isolation.
final Process run = await Process.start(_adbPath(), const <String>[
'shell',
'settings',
'put',
'secure',
'enabled_accessibility_services',
'null',
]);
await run.exitCode;
driver = await FlutterDriver.connect(printCommunication: true);
});
......@@ -31,7 +46,13 @@ void main() {
await driver.forceGC();
final Timeline timeline = await driver.traceAction(() async {
expect(await driver.setSemantics(true), isTrue);
expect(
await driver.setSemantics(true),
isTrue,
reason: 'Could not toggle semantics to on because semantics were already '
'on, but the test needs to toggle semantics to measure the initial '
'semantics tree generation in isolation.'
);
});
final Iterable<TimelineEvent>? semanticsEvents = timeline.events?.where((TimelineEvent event) => event.name == 'SEMANTICS');
......@@ -45,3 +66,12 @@ void main() {
}, timeout: Timeout.none);
});
}
String _adbPath() {
final String? androidHome = Platform.environment['ANDROID_HOME'] ?? Platform.environment['ANDROID_SDK_ROOT'];
if (androidHome == null) {
return 'adb';
} else {
return p.join(androidHome, 'platform-tools', 'adb');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment