Skip to content

Commit 2832611

Browse files
authored
Refactor add_to_app_life_cycle_tests (#145546)
Refactor add_to_app_life_cycle_tests in order to reduce testing logic in test.dart, create a suite_runners directory and allow for later implementing package:test onto add_to_app_life_cycle_tests Part of flutter/flutter#145482
1 parent b05937d commit 2832611

File tree

2 files changed

+25
-14
lines changed

2 files changed

+25
-14
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'dart:io' show Platform;
6+
7+
import 'package:path/path.dart' as path;
8+
9+
import '../run_command.dart';
10+
import '../utils.dart';
11+
12+
Future<void> addToAppLifeCycleRunner(String flutterRoot) async {
13+
if (Platform.isMacOS) {
14+
printProgress('${green}Running add-to-app life cycle iOS integration tests$reset...');
15+
final String addToAppDir = path.join(flutterRoot, 'dev', 'integration_tests', 'ios_add2app_life_cycle');
16+
await runCommand('./build_and_test.sh',
17+
<String>[],
18+
workingDirectory: addToAppDir,
19+
);
20+
} else {
21+
throw Exception('Only iOS has add-to-add lifecycle tests at this time.');
22+
}
23+
}

dev/bots/test.dart

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ import 'package:process/process.dart';
6666
import 'browser.dart';
6767
import 'run_command.dart';
6868
import 'service_worker_test.dart';
69+
import 'suite_runners/run_add_to_app_life_cycle_tests.dart';
6970
import 'tool_subsharding.dart';
7071
import 'utils.dart';
7172

@@ -230,7 +231,7 @@ Future<void> main(List<String> args) async {
230231
printProgress('Running task: ${Platform.environment[CIRRUS_TASK_NAME]}');
231232
}
232233
await selectShard(<String, ShardRunner>{
233-
'add_to_app_life_cycle_tests': _runAddToAppLifeCycleTests,
234+
'add_to_app_life_cycle_tests': () => addToAppLifeCycleRunner(flutterRoot),
234235
'build_tests': _runBuildTests,
235236
'framework_coverage': _runFrameworkCoverage,
236237
'framework_tests': _runFrameworkTests,
@@ -790,19 +791,6 @@ Future<void> _flutterBuildDart2js(String relativePathToApplication, String targe
790791
);
791792
}
792793

793-
Future<void> _runAddToAppLifeCycleTests() async {
794-
if (Platform.isMacOS) {
795-
printProgress('${green}Running add-to-app life cycle iOS integration tests$reset...');
796-
final String addToAppDir = path.join(flutterRoot, 'dev', 'integration_tests', 'ios_add2app_life_cycle');
797-
await runCommand('./build_and_test.sh',
798-
<String>[],
799-
workingDirectory: addToAppDir,
800-
);
801-
} else {
802-
printProgress('${yellow}Skipped on this platform (only iOS has add-to-add lifecycle tests at this time).$reset');
803-
}
804-
}
805-
806794
Future<void> _runFrameworkTests() async {
807795
final List<String> trackWidgetCreationAlternatives = <String>['--track-widget-creation', '--no-track-widget-creation'];
808796

0 commit comments

Comments
 (0)