Change asset_bundle_package_font_test to memory file system (#21114)
* Change assert_bundle_package_font_test to memory file system
This is to work towards being able to run the tests without `-j1` (#21113). These tests were using the real filesystem and setting/relying on fs.currentDirectory. There was a comment about this being because the memory provider didnt' support POSIX and Windows, however that seems to have changed since (and many other asset tests already do something similar to this).
* Trim trailing whitespace
* Add a workaround for Windows path slash directions
Strictly this is correct, but the real FS can tolerate either path. The in-memory file system is more strict (see https://github.com/google/file.dart/issues/112).
* Extract a helper for writing schema files in tests
* Missed file when saving!
* Remove redundant comment
* Rename writeBasicSchema -> writeEmptySchema
* Use the file we already have to write contents
* Make comments more descriptive
* Remove another dupe of writeSchema to use the shared one
* Rename schema -> pubspec_schema
* Trim whitespace
diff --git a/packages/flutter_tools/test/android/gradle_test.dart b/packages/flutter_tools/test/android/gradle_test.dart
index e8a2419..634ddc7 100644
--- a/packages/flutter_tools/test/android/gradle_test.dart
+++ b/packages/flutter_tools/test/android/gradle_test.dart
@@ -10,7 +10,6 @@
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/cache.dart';
-import 'package:flutter_tools/src/flutter_manifest.dart';
import 'package:flutter_tools/src/ios/xcodeproj.dart';
import 'package:flutter_tools/src/project.dart';
import 'package:mockito/mockito.dart';
@@ -19,6 +18,7 @@
import '../src/common.dart';
import '../src/context.dart';
+import '../src/pubspec_schema.dart';
void main() {
Cache.flutterRoot = getFlutterRoot();
@@ -186,8 +186,7 @@
manifestFile.writeAsStringSync(manifest);
// write schemaData otherwise pubspec.yaml file can't be loaded
- const String schemaData = '{}';
- writeSchemaFile(fs, schemaData);
+ writeEmptySchemaFile(fs);
try {
updateLocalProperties(
@@ -331,16 +330,6 @@
});
}
-void writeSchemaFile(FileSystem filesystem, String schemaData) {
- final String schemaPath = buildSchemaPath(filesystem);
- final File schemaFile = filesystem.file(schemaPath);
-
- final String schemaDir = buildSchemaDir(filesystem);
-
- filesystem.directory(schemaDir).createSync(recursive: true);
- filesystem.file(schemaFile).writeAsStringSync(schemaData);
-}
-
Platform fakePlatform(String name) {
return new FakePlatform.fromPlatform(const LocalPlatform())..operatingSystem = name;
}