Skip to content

Commit 43932aa

Browse files
authored
Benchmark for un-triaged image results on Flutter Gold (#40634)
1 parent 0ca5e71 commit 43932aa

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright 2019 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'dart:async';
6+
import 'dart:convert';
7+
import 'dart:io';
8+
9+
import 'package:flutter_devicelab/framework/framework.dart';
10+
11+
const String _kTriageCountKey = 'count';
12+
13+
Future<TaskResult> getTriageCount() async {
14+
final HttpClient skiaClient = HttpClient();
15+
int digestCount = 0;
16+
try {
17+
final HttpClientRequest request = await skiaClient.getUrl(Uri.parse(
18+
'https://flutter-gold.skia.org/json/trstatus'
19+
));
20+
final HttpClientResponse response = await request.close();
21+
final String responseBody = await response.transform(utf8.decoder).join();
22+
final Map<String, dynamic> json = jsonDecode(responseBody);
23+
digestCount = json['corpStatus'][0]['untriagedCount'];
24+
} catch(e) {
25+
return TaskResult.failure(e.toString());
26+
}
27+
return TaskResult.success(
28+
<String, dynamic>{_kTriageCountKey: digestCount},
29+
benchmarkScoreKeys: <String>[_kTriageCountKey],
30+
);
31+
}
32+
33+
Future<void> main() async {
34+
await task(() => getTriageCount());
35+
}

dev/devicelab/manifest.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,12 @@ tasks:
655655
stage: devicelab
656656
required_agent_capabilities: ["linux/android"]
657657

658+
flutter_gold_triage:
659+
description: >
660+
Checks the number of un-triaged image digests from Flutter Gold.
661+
stage: devicelab
662+
required_agent_capabilities: ["linux/android"]
663+
658664
# run_without_leak_linux:
659665
# description: >
660666
# Checks that `flutter run` does not leak dart on Linux.

0 commit comments

Comments
 (0)