Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(624)

Side by Side Diff: pkg/analyzer/test/file_system/physical_resource_provider_test.dart

Issue 840363002: Fix flakiness in physical_resource_provider_test (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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:io' as io; 8 import 'dart:io' as io;
9 9
10 import 'package:analyzer/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 subscription.cancel(); 61 subscription.cancel();
62 }); 62 });
63 }); 63 });
64 } 64 }
65 65
66 test('create file', () => watchingFolder(tempPath, (changesReceived) { 66 test('create file', () => watchingFolder(tempPath, (changesReceived) {
67 expect(changesReceived, hasLength(0)); 67 expect(changesReceived, hasLength(0));
68 var path = join(tempPath, 'foo'); 68 var path = join(tempPath, 'foo');
69 new io.File(path).writeAsStringSync('contents'); 69 new io.File(path).writeAsStringSync('contents');
70 return delayed(() { 70 return delayed(() {
71 expect(changesReceived, hasLength(1)); 71 // There should be an "add" event indicating that the file was added.
72 // Depending on how long it took to write the contents, it may be
73 // followed by "modify" events.
74 expect(changesReceived, isNotEmpty);
72 expect(changesReceived[0].type, equals(ChangeType.ADD)); 75 expect(changesReceived[0].type, equals(ChangeType.ADD));
73 expect(changesReceived[0].path, equals(path)); 76 expect(changesReceived[0].path, equals(path));
77 for (int i = 1; i < changesReceived.length; i++) {
78 expect(changesReceived[i].type, equals(ChangeType.MODIFY));
79 expect(changesReceived[i].path, equals(path));
80 }
74 }); 81 });
75 })); 82 }));
76 83
77 test('modify file', () { 84 test('modify file', () {
78 var path = join(tempPath, 'foo'); 85 var path = join(tempPath, 'foo');
79 var file = new io.File(path); 86 var file = new io.File(path);
80 file.writeAsStringSync('contents 1'); 87 file.writeAsStringSync('contents 1');
81 return watchingFolder(tempPath, (changesReceived) { 88 return watchingFolder(tempPath, (changesReceived) {
82 expect(changesReceived, hasLength(0)); 89 expect(changesReceived, hasLength(0));
83 file.writeAsStringSync('contents 2'); 90 file.writeAsStringSync('contents 2');
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 expect( 332 expect(
326 folder.canonicalizePath(join('.', 'baz')), 333 folder.canonicalizePath(join('.', 'baz')),
327 equals(join(path, 'baz'))); 334 equals(join(path, 'baz')));
328 expect( 335 expect(
329 folder.canonicalizePath(join(path2, '.', 'baz')), 336 folder.canonicalizePath(join(path2, '.', 'baz')),
330 equals(join(path2, 'baz'))); 337 equals(join(path2, 'baz')));
331 }); 338 });
332 }); 339 });
333 }); 340 });
334 } 341 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698