Unverified Commit df3fe587 authored by Kaushik Iska's avatar Kaushik Iska Committed by GitHub

Validate that min frame number is numeric (#86498)

parent dacfda07
...@@ -1628,6 +1628,14 @@ targets: ...@@ -1628,6 +1628,14 @@ targets:
["devicelab"] ["devicelab"]
scheduler: luci scheduler: luci
- name: Mac_android integration_ui_frame_number
builder: Mac_android integration_ui_frame_number
presubmit: false
properties:
tags: >
["devicelab"]
scheduler: luci
- name: Mac_android integration_ui_screenshot - name: Mac_android integration_ui_screenshot
builder: Mac_android integration_ui_screenshot builder: Mac_android integration_ui_screenshot
presubmit: false presubmit: false
...@@ -1912,6 +1920,14 @@ targets: ...@@ -1912,6 +1920,14 @@ targets:
["devicelab"] ["devicelab"]
scheduler: luci scheduler: luci
- name: Mac_ios integration_ui_ios_frame_number
builder: Mac_ios integration_ui_ios_frame_number
presubmit: false
properties:
tags: >
["devicelab"]
scheduler: luci
- name: Mac_ios integration_ui_ios_screenshot - name: Mac_ios integration_ui_ios_screenshot
builder: Mac_ios integration_ui_ios_screenshot builder: Mac_ios integration_ui_ios_screenshot
presubmit: false presubmit: false
......
...@@ -93,6 +93,7 @@ ...@@ -93,6 +93,7 @@
/dev/devicelab/bin/tasks/imagefiltered_transform_animation_perf__timeline_summary.dart @zanderso @flutter/engine /dev/devicelab/bin/tasks/imagefiltered_transform_animation_perf__timeline_summary.dart @zanderso @flutter/engine
/dev/devicelab/bin/tasks/integration_test_test.dart @zanderso @flutter/tool /dev/devicelab/bin/tasks/integration_test_test.dart @zanderso @flutter/tool
/dev/devicelab/bin/tasks/integration_ui_driver.dart @zanderso @flutter/tool /dev/devicelab/bin/tasks/integration_ui_driver.dart @zanderso @flutter/tool
/dev/devicelab/bin/tasks/integration_ui_frame_number.dart @iskakaushik @flutter/engine
/dev/devicelab/bin/tasks/integration_ui_keyboard_resize.dart @zanderso @flutter/tool /dev/devicelab/bin/tasks/integration_ui_keyboard_resize.dart @zanderso @flutter/tool
/dev/devicelab/bin/tasks/integration_ui_screenshot.dart @zanderso @flutter/tool /dev/devicelab/bin/tasks/integration_ui_screenshot.dart @zanderso @flutter/tool
/dev/devicelab/bin/tasks/integration_ui_textfield.dart @zanderso @flutter/tool /dev/devicelab/bin/tasks/integration_ui_textfield.dart @zanderso @flutter/tool
...@@ -126,6 +127,7 @@ ...@@ -126,6 +127,7 @@
/dev/devicelab/bin/tasks/hot_mode_dev_cycle_macos_target__benchmark.dart @zanderso @flutter/tool /dev/devicelab/bin/tasks/hot_mode_dev_cycle_macos_target__benchmark.dart @zanderso @flutter/tool
/dev/devicelab/bin/tasks/integration_test_test_ios.dart @zanderso @flutter/engine /dev/devicelab/bin/tasks/integration_test_test_ios.dart @zanderso @flutter/engine
/dev/devicelab/bin/tasks/integration_ui_ios_driver.dart @zanderso @flutter/tool /dev/devicelab/bin/tasks/integration_ui_ios_driver.dart @zanderso @flutter/tool
/dev/devicelab/bin/tasks/integration_ui_ios_frame_number.dart @iskakaushik @flutter/engine
/dev/devicelab/bin/tasks/integration_ui_ios_keyboard_resize.dart @zanderso @flutter/engine /dev/devicelab/bin/tasks/integration_ui_ios_keyboard_resize.dart @zanderso @flutter/engine
/dev/devicelab/bin/tasks/integration_ui_ios_screenshot.dart @zanderso @flutter/tool /dev/devicelab/bin/tasks/integration_ui_ios_screenshot.dart @zanderso @flutter/tool
/dev/devicelab/bin/tasks/integration_ui_ios_textfield.dart @zanderso @flutter/tool /dev/devicelab/bin/tasks/integration_ui_ios_textfield.dart @zanderso @flutter/tool
......
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_devicelab/framework/devices.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/tasks/integration_tests.dart';
Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.android;
await task(createEndToEndFrameNumberTest());
}
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_devicelab/framework/devices.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/tasks/integration_tests.dart';
Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.ios;
await task(createEndToEndFrameNumberTest());
}
...@@ -92,6 +92,13 @@ TaskFunction createEndToEndKeyboardTest() { ...@@ -92,6 +92,13 @@ TaskFunction createEndToEndKeyboardTest() {
); );
} }
TaskFunction createEndToEndFrameNumberTest() {
return DriverTest(
'${flutterDirectory.path}/dev/integration_tests/ui',
'lib/frame_number.dart',
);
}
TaskFunction createEndToEndDriverTest() { TaskFunction createEndToEndDriverTest() {
return DriverTest( return DriverTest(
'${flutterDirectory.path}/dev/integration_tests/ui', '${flutterDirectory.path}/dev/integration_tests/ui',
......
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter_driver/driver_extension.dart';
/// This application shows empty screen until first frame timings are acquired.
void main() {
enableFlutterDriverExtension();
final Completer<List<FrameTiming>> completer = Completer<List<FrameTiming>>();
SchedulerBinding.instance!.addTimingsCallback((List<FrameTiming> timings) {
completer.complete(timings);
});
runApp(Directionality(
textDirection: TextDirection.ltr,
child: _FirstFrameTimings(completer: completer),
));
}
class _FirstFrameTimings extends StatefulWidget {
const _FirstFrameTimings({
Key? key,
required this.completer,
}) : super(key: key);
final Completer<List<FrameTiming>> completer;
@override
_FirstFrameTimingsState createState() => _FirstFrameTimingsState();
}
class _FirstFrameTimingsState extends State<_FirstFrameTimings> {
int? _minFrameNumber;
@override
Widget build(BuildContext context) {
widget.completer.future.then(_setMinFrameNumber);
if (_minFrameNumber != null) {
return Text(
_minFrameNumber.toString(),
key: const Key('minFrameNumber'),
);
} else {
return const Text('Waiting...');
}
}
void _setMinFrameNumber(List<FrameTiming> timings) {
final int minFrameNumber = timings
.map((FrameTiming timing) => timing.frameNumber)
.reduce(min);
setState(() {
_minFrameNumber = minFrameNumber;
});
}
}
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
bool _isNumeric(String s) {
return double.tryParse(s) != null;
}
// Connect and disconnect from the empty app.
void main() {
group('FrameNumber', () {
late FlutterDriver driver;
setUpAll(() async {
driver = await FlutterDriver.connect();
});
tearDownAll(() async {
await driver.close();
});
test('minFrameNumber is numeric', () async {
final SerializableFinder minFrameNumberFinder =
find.byValueKey('minFrameNumber');
await driver.waitFor(
minFrameNumberFinder,
timeout: const Duration(seconds: 5),
);
final String minFrameNumber = await driver.getText(minFrameNumberFinder);
// TODO(iskakaushik): enable the stronger check of _minFrameNumber == '1',
// once this is fixed. https://github.com/flutter/flutter/issues/86487
expect(_isNumeric(minFrameNumber), true);
}, timeout: Timeout.none);
});
}
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
// Generated file. Do not edit. // Generated file. Do not edit.
// //
// clang-format off
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
......
...@@ -72,6 +72,7 @@ Future<void> main() async { ...@@ -72,6 +72,7 @@ Future<void> main() async {
testWidgets('Test traceAction', (WidgetTester tester) async { testWidgets('Test traceAction', (WidgetTester tester) async {
await integrationBinding.enableTimeline(vmService: fakeVM); await integrationBinding.enableTimeline(vmService: fakeVM);
await integrationBinding.traceAction(() async {}); await integrationBinding.traceAction(() async {});
print(integrationBinding.reportData);
expect(integrationBinding.reportData, isNotNull); expect(integrationBinding.reportData, isNotNull);
expect(integrationBinding.reportData!.containsKey('timeline'), true); expect(integrationBinding.reportData!.containsKey('timeline'), true);
expect( expect(
......
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