| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 watcher.test.utils; | 5 library watcher.test.utils; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:path/path.dart' as p; | 10 import 'package:path/path.dart' as p; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 /// times. This means using the real file system requires us to put delays in | 31 /// times. This means using the real file system requires us to put delays in |
| 32 /// the tests to ensure we wait long enough between operations for the mod time | 32 /// the tests to ensure we wait long enough between operations for the mod time |
| 33 /// to be different. | 33 /// to be different. |
| 34 /// | 34 /// |
| 35 /// Instead, we'll just mock that out. Each time a file is written, we manually | 35 /// Instead, we'll just mock that out. Each time a file is written, we manually |
| 36 /// increment the mod time for that file instantly. | 36 /// increment the mod time for that file instantly. |
| 37 Map<String, int> _mockFileModificationTimes; | 37 Map<String, int> _mockFileModificationTimes; |
| 38 | 38 |
| 39 void initConfig() { | 39 void initConfig() { |
| 40 useCompactVMConfiguration(); | 40 useCompactVMConfiguration(); |
| 41 filterStacks = true; |
| 41 } | 42 } |
| 42 | 43 |
| 43 /// Creates the sandbox directory the other functions in this library use and | 44 /// Creates the sandbox directory the other functions in this library use and |
| 44 /// ensures it's deleted when the test ends. | 45 /// ensures it's deleted when the test ends. |
| 45 /// | 46 /// |
| 46 /// This should usually be called by [setUp]. | 47 /// This should usually be called by [setUp]. |
| 47 void createSandbox() { | 48 void createSandbox() { |
| 48 var dir = new Directory("").createTempSync(); | 49 var dir = new Directory("").createTempSync(); |
| 49 _sandboxDir = dir.path; | 50 _sandboxDir = dir.path; |
| 50 | 51 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 | 220 |
| 220 Description describe(Description description) { | 221 Description describe(Description description) { |
| 221 description.add("$type $path"); | 222 description.add("$type $path"); |
| 222 } | 223 } |
| 223 | 224 |
| 224 bool matches(item, Map matchState) => | 225 bool matches(item, Map matchState) => |
| 225 item is WatchEvent && | 226 item is WatchEvent && |
| 226 item.type == type && | 227 item.type == type && |
| 227 p.normalize(item.path) == p.normalize(path); | 228 p.normalize(item.path) == p.normalize(path); |
| 228 } | 229 } |
| OLD | NEW |