Remove the old canvaskit artifacts to not confuse the web runner. (#124641)

Remove the old canvaskit artifacts to not confuse the web runner.
This commit is contained in:
Jackson Gardner
2023-04-12 09:57:41 -07:00
committed by GitHub
parent e68086e910
commit ac9b501dc2
2 changed files with 58 additions and 0 deletions

View File

@@ -880,6 +880,31 @@ void main() {
));
});
testWithoutContext('LegacyCanvasKitRemover removes old canvaskit artifacts if they exist', () async {
final FileExceptionHandler handler = FileExceptionHandler();
final MemoryFileSystem fileSystem = MemoryFileSystem.test(opHandle: handler.opHandle);
final Cache cache = Cache.test(processManager: FakeProcessManager.any(), fileSystem: fileSystem);
final File canvasKitWasm = fileSystem.file(fileSystem.path.join(
cache.getRoot().path,
'canvaskit',
'canvaskit.wasm',
));
canvasKitWasm.createSync(recursive: true);
canvasKitWasm.writeAsStringSync('hello world');
final LegacyCanvasKitRemover remover = LegacyCanvasKitRemover(cache);
expect(await remover.isUpToDate(fileSystem), false);
await remover.update(
FakeArtifactUpdater(),
BufferLogger.test(),
fileSystem,
FakeOperatingSystemUtils(),
);
expect(await remover.isUpToDate(fileSystem), true);
expect(canvasKitWasm.existsSync(), isFalse);
});
testWithoutContext('Cache handles exception thrown if stamp file cannot be parsed', () {
final FileExceptionHandler exceptionHandler = FileExceptionHandler();
final FileSystem fileSystem = MemoryFileSystem.test(opHandle: exceptionHandler.opHandle);