Unverified Commit 3074c9e0 authored by Nicholas Shahan's avatar Nicholas Shahan Committed by GitHub

Add tests for web library platform defines (#90620)

parent 0167d99f
......@@ -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.
......
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