From a0c567f751a1f66d7b355d18f2cd990beeb6718e Mon Sep 17 00:00:00 2001 From: Luke Church Date: Mon, 21 Nov 2016 20:17:41 -0800 Subject: [PATCH] Add delay between writing file and modifying it (#6968) * Add delay between writing file and modifying it * Add type argument --- packages/flutter_tools/test/devfs_test.dart | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/flutter_tools/test/devfs_test.dart b/packages/flutter_tools/test/devfs_test.dart index 2eee2428b2..63f554a2c4 100644 --- a/packages/flutter_tools/test/devfs_test.dart +++ b/packages/flutter_tools/test/devfs_test.dart @@ -3,6 +3,7 @@ // found in the LICENSE file. import 'dart:io'; +import 'dart:async'; import 'package:flutter_tools/src/asset.dart'; import 'package:flutter_tools/src/build_info.dart'; @@ -39,18 +40,21 @@ void main() { await devFS.update(); expect(devFSOperations.contains('writeFile test bar/foo.txt'), isTrue); }); - testUsingContext('modify existing file on local file system', () async { - File file = new File(path.join(basePath, filePath)); - file.writeAsBytesSync([1, 2, 3, 4, 5, 6]); - await devFS.update(); - expect(devFSOperations.contains('writeFile test bar/foo.txt'), isTrue); - }); testUsingContext('add new file to local file system', () async { File file = new File(path.join(basePath, filePath2)); await file.parent.create(recursive: true); file.writeAsBytesSync([1, 2, 3, 4, 5, 6, 7]); await devFS.update(); expect(devFSOperations.contains('writeFile test foo/bar.txt'), isTrue); + // Need to delay between when we first write to a file and when + // we modify it. + await new Future.delayed(new Duration(seconds: 1)); + }); + testUsingContext('modify existing file on local file system', () async { + File file = new File(path.join(basePath, filePath)); + await file.writeAsBytes([1, 2, 3, 4, 5, 6]); + await devFS.update(); + expect(devFSOperations.contains('writeFile test bar/foo.txt'), isTrue); }); testUsingContext('delete a file from the local file system', () async { File file = new File(path.join(basePath, filePath));