Platform view devicelab ad banner scroll list real ads (#145239)
Reland https://github.com/flutter/flutter/pull/144745, which was reverted due to a the Android app ads not being set up correctly, crashing on launch: https://github.com/flutter/flutter/pull/145228 Add the missing [`com.google.android.gms.ads.APPLICATION_ID` `meta-data` tag](https://developers.google.com/admob/android/quick-start#import_the_mobile_ads_sdk) to the manifest. Validated both `platform_views_scroll_perf__timeline_summary` and `platform_views_scroll_perf_impeller__timeline_summary` ran locally on an Android emulator. Successful presubmit runs: https://ci.chromium.org/ui/p/flutter/builders/try/Linux_pixel_7pro%20platform_views_scroll_perf__timeline_summary/4/overview https://ci.chromium.org/ui/p/flutter/builders/try/Linux_pixel_7pro%20platform_views_scroll_perf_impeller__timeline_summary/4/overview Original commit message: _________ This benchmark is to measure the platform view performance improvement. It is similar to https://github.com/lucalooz/flutter_ads_list_perf There's still a pending issue https://github.com/flutter/flutter/issues/144339 Fixes https://github.com/flutter/flutter/issues/143534 Fixes https://github.com/flutter/flutter/issues/143257
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
// 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;
|
||||
|
||||
void main() {
|
||||
group('scrolling performance test', () {
|
||||
late FlutterDriver driver;
|
||||
|
||||
setUpAll(() async {
|
||||
driver = await FlutterDriver.connect();
|
||||
|
||||
await driver.waitUntilFirstFrameRasterized();
|
||||
});
|
||||
|
||||
tearDownAll(() async {
|
||||
driver.close();
|
||||
});
|
||||
|
||||
Future<void> testScrollPerf(String listKey, String summaryName) async {
|
||||
// The slight initial delay avoids starting the timing during a
|
||||
// period of increased load on the device. Without this delay, the
|
||||
// benchmark has greater noise.
|
||||
// See: https://github.com/flutter/flutter/issues/19434
|
||||
await Future<void>.delayed(const Duration(milliseconds: 250));
|
||||
|
||||
final Timeline timeline = await driver.traceAction(() async {
|
||||
// Find the scrollable stock list
|
||||
final SerializableFinder list = find.byValueKey(listKey);
|
||||
|
||||
for (int j = 0; j < 5; j += 1) {
|
||||
// Scroll down
|
||||
for (int i = 0; i < 5; i += 1) {
|
||||
await driver.scroll(list, 0.0, -300.0, const Duration(milliseconds: 300));
|
||||
await Future<void>.delayed(const Duration(milliseconds: 500));
|
||||
}
|
||||
|
||||
// Scroll up
|
||||
for (int i = 0; i < 5; i += 1) {
|
||||
await driver.scroll(list, 0.0, 300.0, const Duration(milliseconds: 300));
|
||||
await Future<void>.delayed(const Duration(milliseconds: 500));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
final TimelineSummary summary = TimelineSummary.summarize(timeline);
|
||||
await summary.writeTimelineToFile(summaryName, pretty: true);
|
||||
}
|
||||
|
||||
test('platform_views_scroll_perf', () async {
|
||||
// Disable frame sync, since there are ongoing animations.
|
||||
await driver.runUnsynchronized(() async {
|
||||
await testScrollPerf('platform-views-scroll', 'platform_views_scroll_perf_ad_banners');
|
||||
});
|
||||
}, timeout: Timeout.none);
|
||||
});
|
||||
}
|
||||
@@ -31,9 +31,8 @@ void main() {
|
||||
final Timeline timeline = await driver.traceAction(() async {
|
||||
// Find the scrollable stock list
|
||||
final SerializableFinder list = find.byValueKey(listKey);
|
||||
expect(list, isNotNull);
|
||||
|
||||
for (int j = 0; j < 5; j ++) {
|
||||
for (int j = 0; j < 5; j += 1) {
|
||||
// Scroll down
|
||||
for (int i = 0; i < 5; i += 1) {
|
||||
await driver.scroll(list, 0.0, -300.0, const Duration(milliseconds: 300));
|
||||
|
||||
@@ -31,9 +31,8 @@ void main() {
|
||||
final Timeline timeline = await driver.traceAction(() async {
|
||||
// Find the scrollable stock list
|
||||
final SerializableFinder list = find.byValueKey(listKey);
|
||||
expect(list, isNotNull);
|
||||
|
||||
for (int j = 0; j < 5; j ++) {
|
||||
for (int j = 0; j < 5; j += 1) {
|
||||
// Scroll down
|
||||
for (int i = 0; i < 5; i += 1) {
|
||||
await driver.scroll(list, 0.0, -300.0, const Duration(milliseconds: 300));
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// 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/widgets.dart';
|
||||
import 'package:flutter_driver/driver_extension.dart';
|
||||
|
||||
import 'package:platform_views_layout/main_ad_banners.dart' as app;
|
||||
|
||||
void main() {
|
||||
enableFlutterDriverExtension();
|
||||
runApp(const app.PlatformViewApp());
|
||||
}
|
||||
Reference in New Issue
Block a user