Skip to content

Commit 55f49e2

Browse files
matanlureyjesswrd
authored andcommitted
Move more of the tests in the engine to package:test (flutter#55083)
Partial work towards flutter/flutter#133569.
1 parent 5aba8ce commit 55f49e2

File tree

5 files changed

+44
-33
lines changed

5 files changed

+44
-33
lines changed

testing/benchmark/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ dependencies:
1818
path: any
1919

2020
dev_dependencies:
21-
litetest: any
21+
test: any

testing/benchmark/test/parse_and_send_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
import 'dart:io';
66

7-
import 'package:litetest/litetest.dart';
87
import 'package:metrics_center/metrics_center.dart';
98
import 'package:path/path.dart' as p;
9+
import 'package:test/test.dart';
1010

1111
import '../bin/parse_and_send.dart' as pas;
1212

testing/run_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ def build_dart_host_test_list(build_dir):
984984
(os.path.join('flutter', 'testing', 'scenario_app'), []),
985985
(
986986
os.path.join('flutter', 'tools', 'api_check'),
987-
[os.path.join(BUILDROOT_DIR, 'flutter')],
987+
[],
988988
),
989989
(os.path.join('flutter', 'tools', 'build_bucket_golden_scraper'), []),
990990
(os.path.join('flutter', 'tools', 'clang_tidy'), []),

tools/api_check/pubspec.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@ resolution: workspace
1414

1515
dependencies:
1616
analyzer: any
17-
_fe_analyzer_shared: any
18-
pub_semver: any
1917

2018
dev_dependencies:
21-
async_helper: any
22-
expect: any
23-
litetest: any
19+
engine_repo_tools: any
2420
path: any
25-
smith: any
21+
test: any

tools/api_check/test/apicheck_test.dart

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,15 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import 'dart:io';
6-
75
import 'package:analyzer/dart/ast/ast.dart';
86
import 'package:analyzer/dart/ast/visitor.dart';
97
import 'package:apicheck/apicheck.dart';
10-
import 'package:litetest/litetest.dart';
8+
import 'package:engine_repo_tools/engine_repo_tools.dart';
119
import 'package:path/path.dart' as path;
10+
import 'package:test/test.dart';
1211

13-
void main(List<String> arguments) {
14-
if (arguments.isEmpty) {
15-
print('usage: dart bin/apicheck.dart path/to/engine/src/flutter');
16-
exit(1);
17-
}
18-
19-
final String flutterRoot = arguments[0];
12+
void main() {
13+
final String flutterRoot = Engine.findWithin().flutterDir.path;
2014

2115
checkApiConsistency(flutterRoot);
2216
checkNativeApi(flutterRoot);
@@ -45,12 +39,14 @@ void checkApiConsistency(String flutterRoot) {
4539
);
4640
// C values: kFlutterAccessibilityFeatureFooBar = 1 << N,
4741
final List<String> embedderEnumValues = getCppEnumValues(
48-
sourcePath: path.join(flutterRoot, 'shell', 'platform', 'embedder', 'embedder.h'),
42+
sourcePath:
43+
path.join(flutterRoot, 'shell', 'platform', 'embedder', 'embedder.h'),
4944
enumName: 'FlutterAccessibilityFeature',
5045
);
5146
// C++ values: kFooBar = 1 << N,
5247
final List<String> internalEnumValues = getCppEnumClassValues(
53-
sourcePath: path.join(flutterRoot, 'lib','ui', 'window', 'platform_configuration.h'),
48+
sourcePath: path.join(
49+
flutterRoot, 'lib', 'ui', 'window', 'platform_configuration.h'),
5450
enumName: 'AccessibilityFeatureFlag',
5551
);
5652
// Java values: FOO_BAR(1 << N).
@@ -72,17 +68,20 @@ void checkApiConsistency(String flutterRoot) {
7268
className: 'SemanticsAction',
7369
);
7470
final List<String> webuiFields = getDartClassFields(
75-
sourcePath: path.join(flutterRoot, 'lib', 'web_ui', 'lib', 'semantics.dart'),
71+
sourcePath:
72+
path.join(flutterRoot, 'lib', 'web_ui', 'lib', 'semantics.dart'),
7673
className: 'SemanticsAction',
7774
);
7875
// C values: kFlutterSemanticsActionFooBar = 1 << N.
7976
final List<String> embedderEnumValues = getCppEnumValues(
80-
sourcePath: path.join(flutterRoot, 'shell', 'platform', 'embedder', 'embedder.h'),
77+
sourcePath:
78+
path.join(flutterRoot, 'shell', 'platform', 'embedder', 'embedder.h'),
8179
enumName: 'FlutterSemanticsAction',
8280
);
8381
// C++ values: kFooBar = 1 << N.
8482
final List<String> internalEnumValues = getCppEnumClassValues(
85-
sourcePath: path.join(flutterRoot, 'lib', 'ui', 'semantics', 'semantics_node.h'),
83+
sourcePath:
84+
path.join(flutterRoot, 'lib', 'ui', 'semantics', 'semantics_node.h'),
8685
enumName: 'SemanticsAction',
8786
);
8887
// Java values: FOO_BAR(1 << N).
@@ -101,22 +100,34 @@ void checkApiConsistency(String flutterRoot) {
101100
test('AppLifecycleState enums match', () {
102101
// Dart values: _kFooBarIndex = 1 << N.
103102
final List<String> uiFields = getDartClassFields(
104-
sourcePath: path.join(flutterRoot, 'lib', 'ui', 'platform_dispatcher.dart'),
103+
sourcePath:
104+
path.join(flutterRoot, 'lib', 'ui', 'platform_dispatcher.dart'),
105105
className: 'AppLifecycleState',
106106
);
107107
final List<String> webuiFields = getDartClassFields(
108-
sourcePath: path.join(flutterRoot, 'lib', 'web_ui', 'lib', 'platform_dispatcher.dart'),
108+
sourcePath: path.join(
109+
flutterRoot, 'lib', 'web_ui', 'lib', 'platform_dispatcher.dart'),
109110
className: 'AppLifecycleState',
110111
);
111112
// C++ values: kFooBar = 1 << N.
112113
final List<String> internalEnumValues = getCppEnumClassValues(
113-
sourcePath: path.join(flutterRoot, 'shell', 'platform', 'common', 'app_lifecycle_state.h'),
114+
sourcePath: path.join(
115+
flutterRoot, 'shell', 'platform', 'common', 'app_lifecycle_state.h'),
114116
enumName: 'AppLifecycleState',
115117
);
116118
// Java values: FOO_BAR(1 << N).
117119
final List<String> javaEnumValues = getJavaEnumValues(
118-
sourcePath: path.join(flutterRoot, 'shell', 'platform', 'android', 'io',
119-
'flutter', 'embedding', 'engine', 'systemchannels', 'LifecycleChannel.java'),
120+
sourcePath: path.join(
121+
flutterRoot,
122+
'shell',
123+
'platform',
124+
'android',
125+
'io',
126+
'flutter',
127+
'embedding',
128+
'engine',
129+
'systemchannels',
130+
'LifecycleChannel.java'),
120131
enumName: 'AppLifecycleState',
121132
).map(allCapsToCamelCase).toList();
122133

@@ -137,12 +148,14 @@ void checkApiConsistency(String flutterRoot) {
137148
);
138149
// C values: kFlutterSemanticsFlagFooBar = 1 << N.
139150
final List<String> embedderEnumValues = getCppEnumValues(
140-
sourcePath: path.join(flutterRoot, 'shell', 'platform', 'embedder', 'embedder.h'),
151+
sourcePath:
152+
path.join(flutterRoot, 'shell', 'platform', 'embedder', 'embedder.h'),
141153
enumName: 'FlutterSemanticsFlag',
142154
);
143155
// C++ values: kFooBar = 1 << N.
144156
final List<String> internalEnumValues = getCppEnumClassValues(
145-
sourcePath: path.join(flutterRoot, 'lib', 'ui', 'semantics', 'semantics_node.h'),
157+
sourcePath:
158+
path.join(flutterRoot, 'lib', 'ui', 'semantics', 'semantics_node.h'),
146159
enumName: 'SemanticsFlags',
147160
);
148161
// Java values: FOO_BAR(1 << N).
@@ -185,15 +198,17 @@ class NativeFunctionVisitor extends RecursiveAstVisitor<void> {
185198

186199
@override
187200
void visitNativeFunctionBody(NativeFunctionBody node) {
188-
final MethodDeclaration? method = node.thisOrAncestorOfType<MethodDeclaration>();
201+
final MethodDeclaration? method =
202+
node.thisOrAncestorOfType<MethodDeclaration>();
189203
if (method != null) {
190204
if (method.parameters != null) {
191205
check(method.toString(), method.parameters!);
192206
}
193207
return;
194208
}
195209

196-
final FunctionDeclaration? func = node.thisOrAncestorOfType<FunctionDeclaration>();
210+
final FunctionDeclaration? func =
211+
node.thisOrAncestorOfType<FunctionDeclaration>();
197212
if (func != null) {
198213
final FunctionExpression funcExpr = func.functionExpression;
199214
if (funcExpr.parameters != null) {

0 commit comments

Comments
 (0)