Unverified Commit e9519d8a authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Restore Cache.flutterRoot after overriding it in a test (#93555)

Fixes https://github.com/flutter/flutter/issues/93553
parent b810aa71
......@@ -929,18 +929,23 @@ void main() {
});
testUsingContext('AndroidMavenArtifacts can invoke Gradle resolve dependencies if Android SDK is present', () async {
final String oldRoot = Cache.flutterRoot;
Cache.flutterRoot = '';
final AndroidMavenArtifacts mavenArtifacts = AndroidMavenArtifacts(cache, platform: FakePlatform());
expect(await mavenArtifacts.isUpToDate(memoryFileSystem), isFalse);
try {
final AndroidMavenArtifacts mavenArtifacts = AndroidMavenArtifacts(cache, platform: FakePlatform());
expect(await mavenArtifacts.isUpToDate(memoryFileSystem), isFalse);
final Directory gradleWrapperDir = cache.getArtifactDirectory('gradle_wrapper')..createSync(recursive: true);
gradleWrapperDir.childFile('gradlew').writeAsStringSync('irrelevant');
gradleWrapperDir.childFile('gradlew.bat').writeAsStringSync('irrelevant');
final Directory gradleWrapperDir = cache.getArtifactDirectory('gradle_wrapper')..createSync(recursive: true);
gradleWrapperDir.childFile('gradlew').writeAsStringSync('irrelevant');
gradleWrapperDir.childFile('gradlew.bat').writeAsStringSync('irrelevant');
await mavenArtifacts.update(FakeArtifactUpdater(), BufferLogger.test(), memoryFileSystem, FakeOperatingSystemUtils());
await mavenArtifacts.update(FakeArtifactUpdater(), BufferLogger.test(), memoryFileSystem, FakeOperatingSystemUtils());
expect(await mavenArtifacts.isUpToDate(memoryFileSystem), isFalse);
expect(fakeAndroidSdk.reinitialized, true);
expect(await mavenArtifacts.isUpToDate(memoryFileSystem), isFalse);
expect(fakeAndroidSdk.reinitialized, true);
} finally {
Cache.flutterRoot = oldRoot;
}
}, overrides: <Type, Generator>{
Cache: () => cache,
FileSystem: () => memoryFileSystem,
......
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