Move Cache.flutterRoot initialization up sooner (#16057)

It's required to be set before we detect local engine.

Was broken by #15984
This commit is contained in:
Todd Volkert
2018-03-29 09:16:34 -07:00
committed by GitHub
parent 8e97807671
commit f69d125954
3 changed files with 88 additions and 43 deletions

View File

@@ -40,6 +40,7 @@ typedef void ContextInitializer(AppContext testContext);
void testUsingContext(String description, dynamic testMethod(), {
Timeout timeout,
Map<Type, Generator> overrides: const <Type, Generator>{},
bool initializeFlutterRoot: true,
String testOn,
bool skip, // should default to `false`, but https://github.com/dart-lang/test/issues/545 doesn't allow this
}) {
@@ -90,9 +91,11 @@ void testUsingContext(String description, dynamic testMethod(), {
overrides: overrides,
name: 'test-specific overrides',
body: () async {
// Provide a sane default for the flutterRoot directory. Individual
// tests can override this either in the test or during setup.
Cache.flutterRoot ??= flutterRoot;
if (initializeFlutterRoot) {
// Provide a sane default for the flutterRoot directory. Individual
// tests can override this either in the test or during setup.
Cache.flutterRoot ??= flutterRoot;
}
return await testMethod();
},