Commit 45a4f639 authored by Yegor's avatar Yegor Committed by GitHub

devicelab: make specifying device OS less confusing (#7132)

parent 4da4ca89
......@@ -9,5 +9,6 @@ import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart';
Future<Null> main() async {
await task(createComplexLayoutStartupTest(os: DeviceOperatingSystem.android));
deviceOperatingSystem = DeviceOperatingSystem.android;
await task(createComplexLayoutStartupTest());
}
......@@ -9,5 +9,6 @@ import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart';
Future<Null> main() async {
await task(createComplexLayoutStartupTest(os: DeviceOperatingSystem.ios));
deviceOperatingSystem = DeviceOperatingSystem.ios;
await task(createComplexLayoutStartupTest());
}
......@@ -9,5 +9,6 @@ import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart';
Future<Null> main() async {
await task(createComplexLayoutScrollMemoryTest(os: DeviceOperatingSystem.android));
deviceOperatingSystem = DeviceOperatingSystem.android;
await task(createComplexLayoutScrollMemoryTest());
}
......@@ -9,5 +9,6 @@ import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart';
Future<Null> main() async {
await task(createComplexLayoutScrollPerfTest(os: DeviceOperatingSystem.android));
deviceOperatingSystem = DeviceOperatingSystem.android;
await task(createComplexLayoutScrollPerfTest());
}
......@@ -9,5 +9,6 @@ import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart';
Future<Null> main() async {
await task(createComplexLayoutScrollPerfTest(os: DeviceOperatingSystem.ios));
deviceOperatingSystem = DeviceOperatingSystem.ios;
await task(createComplexLayoutScrollPerfTest());
}
......@@ -9,5 +9,6 @@ import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart';
Future<Null> main() async {
await task(createFlutterGalleryStartupTest(os: DeviceOperatingSystem.android));
deviceOperatingSystem = DeviceOperatingSystem.android;
await task(createFlutterGalleryStartupTest());
}
......@@ -9,5 +9,6 @@ import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart';
Future<Null> main() async {
await task(createGalleryTransitionTest(os: DeviceOperatingSystem.android));
deviceOperatingSystem = DeviceOperatingSystem.android;
await task(createGalleryTransitionTest());
}
......@@ -9,5 +9,6 @@ import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart';
Future<Null> main() async {
await task(createFlutterGalleryStartupTest(os: DeviceOperatingSystem.ios));
deviceOperatingSystem = DeviceOperatingSystem.ios;
await task(createFlutterGalleryStartupTest());
}
......@@ -9,5 +9,6 @@ import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart';
Future<Null> main() async {
await task(createGalleryTransitionTest(os: DeviceOperatingSystem.ios));
deviceOperatingSystem = DeviceOperatingSystem.ios;
await task(createGalleryTransitionTest());
}
......@@ -6,22 +6,15 @@ import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:meta/meta.dart';
import '../framework/adb.dart';
import '../framework/framework.dart';
import '../framework/utils.dart';
TaskFunction createGalleryTransitionTest({ @required DeviceOperatingSystem os }) {
return new GalleryTransitionTest(os: os);
TaskFunction createGalleryTransitionTest() {
return new GalleryTransitionTest();
}
class GalleryTransitionTest {
GalleryTransitionTest({ this.os }) {
deviceOperatingSystem = os;
}
final DeviceOperatingSystem os;
Future<TaskResult> call() async {
Device device = await devices.workingDevice;
......@@ -32,7 +25,7 @@ class GalleryTransitionTest {
await inDirectory(galleryDirectory, () async {
await flutter('packages', options: <String>['get']);
if (os == DeviceOperatingSystem.ios) {
if (deviceOperatingSystem == DeviceOperatingSystem.ios) {
// This causes an Xcode project to be created.
await flutter('build', options: <String>['ios', '--profile']);
}
......
......@@ -5,42 +5,36 @@
import 'dart:async';
import 'dart:convert' show JSON;
import 'package:meta/meta.dart';
import '../framework/adb.dart';
import '../framework/framework.dart';
import '../framework/utils.dart';
TaskFunction createComplexLayoutScrollPerfTest({ @required DeviceOperatingSystem os }) {
TaskFunction createComplexLayoutScrollPerfTest() {
return new PerfTest(
'${flutterDirectory.path}/dev/benchmarks/complex_layout',
'test_driver/scroll_perf.dart',
'complex_layout_scroll_perf',
os: os,
);
}
TaskFunction createComplexLayoutScrollMemoryTest({ @required DeviceOperatingSystem os }) {
TaskFunction createComplexLayoutScrollMemoryTest() {
return new MemoryTest(
'${flutterDirectory.path}/dev/benchmarks/complex_layout',
'test_driver/scroll_perf.dart',
'complex_layout_scroll_perf',
'com.yourcompany.complexLayout',
os: os,
);
}
TaskFunction createFlutterGalleryStartupTest({ @required DeviceOperatingSystem os }) {
TaskFunction createFlutterGalleryStartupTest() {
return new StartupTest(
'${flutterDirectory.path}/examples/flutter_gallery',
os: os,
);
}
TaskFunction createComplexLayoutStartupTest({ @required DeviceOperatingSystem os }) {
TaskFunction createComplexLayoutStartupTest() {
return new StartupTest(
'${flutterDirectory.path}/dev/benchmarks/complex_layout',
os: os,
);
}
......@@ -56,19 +50,16 @@ TaskFunction createComplexLayoutBuildTest() {
class StartupTest {
static const Duration _startupTimeout = const Duration(minutes: 2);
StartupTest(this.testDirectory, { this.os }) {
deviceOperatingSystem = os;
}
StartupTest(this.testDirectory);
final String testDirectory;
final DeviceOperatingSystem os;
Future<TaskResult> call() async {
return await inDirectory(testDirectory, () async {
String deviceId = (await devices.workingDevice).deviceId;
await flutter('packages', options: <String>['get']);
if (os == DeviceOperatingSystem.ios) {
if (deviceOperatingSystem == DeviceOperatingSystem.ios) {
// This causes an Xcode project to be created.
await flutter('build', options: <String>['ios', '--profile']);
}
......@@ -91,12 +82,11 @@ class StartupTest {
/// performance.
class PerfTest {
PerfTest(this.testDirectory, this.testTarget, this.timelineFileName, { this.os });
PerfTest(this.testDirectory, this.testTarget, this.timelineFileName);
final String testDirectory;
final String testTarget;
final String timelineFileName;
final DeviceOperatingSystem os;
Future<TaskResult> call() {
return inDirectory(testDirectory, () async {
......@@ -105,7 +95,7 @@ class PerfTest {
String deviceId = device.deviceId;
await flutter('packages', options: <String>['get']);
if (os == DeviceOperatingSystem.ios) {
if (deviceOperatingSystem == DeviceOperatingSystem.ios) {
// This causes an Xcode project to be created.
await flutter('build', options: <String>['ios', '--profile']);
}
......@@ -185,13 +175,12 @@ class BuildTest {
}
class MemoryTest {
MemoryTest(this.testDirectory, this.testTarget, this.timelineFileName, this.packageName, { this.os });
MemoryTest(this.testDirectory, this.testTarget, this.timelineFileName, this.packageName);
final String testDirectory;
final String testTarget;
final String timelineFileName;
final String packageName;
final DeviceOperatingSystem os;
Future<TaskResult> call() {
return inDirectory(testDirectory, () async {
......@@ -200,7 +189,7 @@ class MemoryTest {
String deviceId = device.deviceId;
await flutter('packages', options: <String>['get']);
if (os == DeviceOperatingSystem.ios) {
if (deviceOperatingSystem == DeviceOperatingSystem.ios) {
// This causes an Xcode project to be created.
await flutter('build', options: <String>['ios', '--profile']);
}
......
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