| 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:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 | 10 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 | 171 |
| 172 /// Expects that the next set of event will be a change of [type] on [path]. | 172 /// Expects that the next set of event will be a change of [type] on [path]. |
| 173 /// | 173 /// |
| 174 /// Multiple calls to [expectEvent] require that the events are received in that | 174 /// Multiple calls to [expectEvent] require that the events are received in that |
| 175 /// order unless they're called in an [inAnyOrder] block. | 175 /// order unless they're called in an [inAnyOrder] block. |
| 176 void expectEvent(ChangeType type, String path) { | 176 void expectEvent(ChangeType type, String path) { |
| 177 var matcher = predicate((e) { | 177 var matcher = predicate((e) { |
| 178 return e is WatchEvent && e.type == type && | 178 return e is WatchEvent && e.type == type && |
| 179 e.path == p.join(_sandboxDir, path); | 179 e.path == p.join(_sandboxDir, p.normalize(path)); |
| 180 }, "is $type $path"); | 180 }, "is $type $path"); |
| 181 | 181 |
| 182 if (_unorderedEventFuture != null) { | 182 if (_unorderedEventFuture != null) { |
| 183 // Assign this to a local variable since it will be un-assigned by the time | 183 // Assign this to a local variable since it will be un-assigned by the time |
| 184 // the scheduled callback runs. | 184 // the scheduled callback runs. |
| 185 var future = _unorderedEventFuture; | 185 var future = _unorderedEventFuture; |
| 186 | 186 |
| 187 expect( | 187 expect( |
| 188 schedule(() => future, "should fire $type event on $path"), | 188 schedule(() => future, "should fire $type event on $path"), |
| 189 completion(contains(matcher))); | 189 completion(contains(matcher))); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 void withPermutations(callback(int i, int j, int k), {int limit}) { | 285 void withPermutations(callback(int i, int j, int k), {int limit}) { |
| 286 if (limit == null) limit = 3; | 286 if (limit == null) limit = 3; |
| 287 for (var i = 0; i < limit; i++) { | 287 for (var i = 0; i < limit; i++) { |
| 288 for (var j = 0; j < limit; j++) { | 288 for (var j = 0; j < limit; j++) { |
| 289 for (var k = 0; k < limit; k++) { | 289 for (var k = 0; k < limit; k++) { |
| 290 callback(i, j, k); | 290 callback(i, j, k); |
| 291 } | 291 } |
| 292 } | 292 } |
| 293 } | 293 } |
| 294 } | 294 } |
| OLD | NEW |