2021-03-05 02:49:03 +00:00
|
|
|
// 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.
|
|
|
|
|
2021-06-07 17:33:00 +00:00
|
|
|
import 'package:flutter_devicelab/framework/devices.dart';
|
2021-04-21 20:49:03 +00:00
|
|
|
import 'package:flutter_devicelab/framework/framework.dart';
|
2021-03-05 02:49:03 +00:00
|
|
|
import 'package:flutter_devicelab/framework/task_result.dart';
|
2021-04-21 20:49:03 +00:00
|
|
|
import 'package:flutter_devicelab/tasks/build_test_task.dart';
|
2021-03-05 02:49:03 +00:00
|
|
|
|
|
|
|
/// Smoke test of a successful task.
|
|
|
|
Future<void> main(List<String> args) async {
|
|
|
|
deviceOperatingSystem = DeviceOperatingSystem.fake;
|
2022-12-20 22:15:39 +00:00
|
|
|
await task(FakeBuildTestTask(args).call);
|
2021-03-05 02:49:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class FakeBuildTestTask extends BuildTestTask {
|
2022-03-29 19:52:42 +00:00
|
|
|
FakeBuildTestTask(super.args) : super(runFlutterClean: false) {
|
2021-04-06 23:28:54 +00:00
|
|
|
deviceOperatingSystem = DeviceOperatingSystem.fake;
|
|
|
|
}
|
2021-03-05 02:49:03 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
// In prod, tasks always run some unit of work and the test framework assumes
|
|
|
|
// there will be some work done when managing the isolate. To fake this, add a delay.
|
2021-04-06 23:28:54 +00:00
|
|
|
Future<void> build() => Future<void>.delayed(const Duration(milliseconds: 500));
|
2021-03-05 02:49:03 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Future<TaskResult> test() async {
|
2021-04-06 23:28:54 +00:00
|
|
|
await Future<void>.delayed(const Duration(milliseconds: 500));
|
2021-03-05 02:49:03 +00:00
|
|
|
return TaskResult.success(<String, String>{'benchmark': 'data'});
|
|
|
|
}
|
|
|
|
}
|