Unnecessary new (#20138)
* enable lint unnecessary_new * fix tests * fix tests * fix tests
This commit is contained in:
committed by
GitHub
parent
d7a0dcaa4a
commit
d927c93310
@@ -20,16 +20,16 @@ const int maxIterations = 4;
|
||||
const Duration pauses = Duration(milliseconds: 500);
|
||||
|
||||
Future<void> main() async {
|
||||
final Completer<void> ready = new Completer<void>();
|
||||
runApp(new GestureDetector(
|
||||
final Completer<void> ready = Completer<void>();
|
||||
runApp(GestureDetector(
|
||||
onTap: () {
|
||||
debugPrint('Received tap.');
|
||||
ready.complete();
|
||||
},
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: new IgnorePointer(
|
||||
child: IgnorePointer(
|
||||
ignoring: true,
|
||||
child: new ComplexLayoutApp(),
|
||||
child: ComplexLayoutApp(),
|
||||
),
|
||||
));
|
||||
await SchedulerBinding.instance.endOfFrame;
|
||||
@@ -37,35 +37,35 @@ Future<void> main() async {
|
||||
/// Wait 50ms to allow the GPU thread to actually put up the frame. (The
|
||||
/// endOfFrame future ends when we send the data to the engine, before the GPU
|
||||
/// thread has had a chance to rasterize, etc.)
|
||||
await new Future<Null>.delayed(const Duration(milliseconds: 50));
|
||||
await Future<Null>.delayed(const Duration(milliseconds: 50));
|
||||
debugPrint('==== MEMORY BENCHMARK ==== READY ====');
|
||||
|
||||
await ready.future; // waits for tap sent by devicelab task
|
||||
debugPrint('Continuing...');
|
||||
|
||||
// remove onTap handler, enable pointer events for app
|
||||
runApp(new GestureDetector(
|
||||
child: new IgnorePointer(
|
||||
runApp(GestureDetector(
|
||||
child: IgnorePointer(
|
||||
ignoring: false,
|
||||
child: new ComplexLayoutApp(),
|
||||
child: ComplexLayoutApp(),
|
||||
),
|
||||
));
|
||||
await SchedulerBinding.instance.endOfFrame;
|
||||
|
||||
final WidgetController controller = new LiveWidgetController(WidgetsBinding.instance);
|
||||
final WidgetController controller = LiveWidgetController(WidgetsBinding.instance);
|
||||
|
||||
// Scroll down
|
||||
for (int iteration = 0; iteration < maxIterations; iteration += 1) {
|
||||
debugPrint('Scroll down... $iteration/$maxIterations');
|
||||
await controller.fling(find.byType(ListView), const Offset(0.0, -700.0), speed);
|
||||
await new Future<Null>.delayed(pauses);
|
||||
await Future<Null>.delayed(pauses);
|
||||
}
|
||||
|
||||
// Scroll up
|
||||
for (int iteration = 0; iteration < maxIterations; iteration += 1) {
|
||||
debugPrint('Scroll up... $iteration/$maxIterations');
|
||||
await controller.fling(find.byType(ListView), const Offset(0.0, 300.0), speed);
|
||||
await new Future<Null>.delayed(pauses);
|
||||
await Future<Null>.delayed(pauses);
|
||||
}
|
||||
|
||||
debugPrint('==== MEMORY BENCHMARK ==== DONE ====');
|
||||
|
||||
Reference in New Issue
Block a user