Add tests for web library platform defines (#90620)
This commit is contained in:
@@ -104,6 +104,11 @@ void main() {
|
||||
await start(expressionEvaluation: true);
|
||||
await evaluateComplexExpressionsInLibrary(flutter);
|
||||
});
|
||||
|
||||
testWithoutContext('evaluated expression includes web library environment defines', () async {
|
||||
await start(expressionEvaluation: true);
|
||||
await evaluateWebLibraryBooleanFromEnvironmentInLibrary(flutter);
|
||||
});
|
||||
});
|
||||
|
||||
group('Flutter test for web', () {
|
||||
@@ -168,6 +173,10 @@ void main() {
|
||||
await startPaused(expressionEvaluation: true);
|
||||
await evaluateComplexExpressionsInLibrary(flutter);
|
||||
});
|
||||
testWithoutContext('evaluated expression includes web library environment defines', () async {
|
||||
await startPaused(expressionEvaluation: true);
|
||||
await evaluateWebLibraryBooleanFromEnvironmentInLibrary(flutter);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -222,6 +231,12 @@ Future<void> evaluateComplexExpressionsInLibrary(FlutterTestDriver flutter) asyn
|
||||
expectInstance(res, InstanceKind.kDouble, DateTime.now().year.toString());
|
||||
}
|
||||
|
||||
Future<void> evaluateWebLibraryBooleanFromEnvironmentInLibrary(FlutterTestDriver flutter) async {
|
||||
final LibraryRef library = await getRootLibrary(flutter);
|
||||
final ObjRef res = await flutter.evaluate(library.id, 'const bool.fromEnvironment("dart.library.html")');
|
||||
expectInstance(res, InstanceKind.kBool, true.toString());
|
||||
}
|
||||
|
||||
Future<LibraryRef> getRootLibrary(FlutterTestDriver flutter) async {
|
||||
// `isolate.rootLib` returns incorrect library, so find the
|
||||
// entrypoint manually here instead.
|
||||
|
||||
Reference in New Issue
Block a user