| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library test.physical_file_system; | 5 library test.physical_file_system; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:core' hide Resource; | 8 import 'dart:core' hide Resource; |
| 9 import 'dart:io' as io; | 9 import 'dart:io' as io; |
| 10 | 10 |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 | 290 |
| 291 test_watchFile_delete() { | 291 test_watchFile_delete() { |
| 292 var path = join(tempPath, 'foo'); | 292 var path = join(tempPath, 'foo'); |
| 293 var file = new io.File(path); | 293 var file = new io.File(path); |
| 294 file.writeAsStringSync('contents 1'); | 294 file.writeAsStringSync('contents 1'); |
| 295 return _watchingFile(path, (changesReceived) { | 295 return _watchingFile(path, (changesReceived) { |
| 296 expect(changesReceived, hasLength(0)); | 296 expect(changesReceived, hasLength(0)); |
| 297 file.deleteSync(); | 297 file.deleteSync(); |
| 298 return _delayed(() { | 298 return _delayed(() { |
| 299 expect(changesReceived, hasLength(1)); | 299 expect(changesReceived, hasLength(1)); |
| 300 if (io.Platform.isWindows) { | 300 expect(changesReceived[0].type, equals(ChangeType.REMOVE)); |
| 301 // TODO(danrubel) https://github.com/dart-lang/sdk/issues/23762 | |
| 302 // This test fails on Windows but a similar test in the underlying | |
| 303 // watcher package passes on Windows. | |
| 304 expect(changesReceived[0].type, equals(ChangeType.MODIFY)); | |
| 305 } else { | |
| 306 expect(changesReceived[0].type, equals(ChangeType.REMOVE)); | |
| 307 } | |
| 308 expect(changesReceived[0].path, equals(path)); | 301 expect(changesReceived[0].path, equals(path)); |
| 309 }); | 302 }); |
| 310 }); | 303 }); |
| 311 } | 304 } |
| 312 | 305 |
| 313 test_watchFile_modify() { | 306 test_watchFile_modify() { |
| 314 var path = join(tempPath, 'foo'); | 307 var path = join(tempPath, 'foo'); |
| 315 var file = new io.File(path); | 308 var file = new io.File(path); |
| 316 file.writeAsStringSync('contents 1'); | 309 file.writeAsStringSync('contents 1'); |
| 317 return _watchingFile(path, (changesReceived) { | 310 return _watchingFile(path, (changesReceived) { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 | 434 |
| 442 setUp() { | 435 setUp() { |
| 443 tempDirectory = io.Directory.systemTemp.createTempSync('test_resource'); | 436 tempDirectory = io.Directory.systemTemp.createTempSync('test_resource'); |
| 444 tempPath = tempDirectory.absolute.path; | 437 tempPath = tempDirectory.absolute.path; |
| 445 } | 438 } |
| 446 | 439 |
| 447 tearDown() { | 440 tearDown() { |
| 448 tempDirectory.deleteSync(recursive: true); | 441 tempDirectory.deleteSync(recursive: true); |
| 449 } | 442 } |
| 450 } | 443 } |
| OLD | NEW |