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

Side by Side Diff: pkg/scheduled_test/test/scheduled_process_test.dart

Issue 25731003: Use Directory.systemTemp getter in pkg subdirectory of repository. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix formatting Created 7 years, 2 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 | « pkg/scheduled_test/test/descriptor/utils.dart ('k') | pkg/watcher/test/utils.dart » ('j') | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 scheduled_process_test; 5 library scheduled_process_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 10
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 onDone: () => print("stdin closed")); 350 onDone: () => print("stdin closed"));
351 '''); 351 ''');
352 process.closeStdin(); 352 process.closeStdin();
353 process.shouldExit(0); 353 process.shouldExit(0);
354 expect(process.nextLine(), completion(equals('stdin closed'))); 354 expect(process.nextLine(), completion(equals('stdin closed')));
355 }); 355 });
356 }); 356 });
357 } 357 }
358 358
359 ScheduledProcess startDartProcess(String script) { 359 ScheduledProcess startDartProcess(String script) {
360 var tempDir = schedule(() { 360 var tempDir = schedule(() => Directory.systemTemp
361 return new Directory('').createTemp().then((dir) => dir.path); 361 .createTemp('scheduled_process_test_')
362 }, 'create temp dir'); 362 .then((dir) => dir.path),
363 363 'create temp dir');
364 var dartPath = schedule(() { 364 var dartPath = schedule(() {
365 return tempDir.then((dir) { 365 return tempDir.then((dir) {
366 var utilsPath = path.absolute(path.join(Platform.script, 'utils.dart')); 366 var utilsPath = path.absolute(path.join(Platform.script, 'utils.dart'));
367 return new File(path.join(dir, 'test.dart')).writeAsString(''' 367 return new File(path.join(dir, 'test.dart')).writeAsString('''
368 import 'dart:async'; 368 import 'dart:async';
369 import 'dart:convert'; 369 import 'dart:convert';
370 import 'dart:io'; 370 import 'dart:io';
371 371
372 var stdinLines = stdin 372 var stdinLines = stdin
373 .transform(UTF8.decoder) 373 .transform(UTF8.decoder)
374 .transform(new LineSplitter()); 374 .transform(new LineSplitter());
375 375
376 void main() { 376 void main() {
377 $script 377 $script
378 } 378 }
379 ''').then((file) => file.path); 379 ''').then((file) => file.path);
380 }); 380 });
381 }, 'write script file'); 381 }, 'write script file');
382 382
383 currentSchedule.onComplete.schedule(() { 383 currentSchedule.onComplete.schedule(() {
384 return tempDir.catchError((_) => null).then((dir) { 384 return tempDir.catchError((_) => null).then((dir) {
385 if (dir == null) return; 385 if (dir == null) return;
386 return new Directory(dir).delete(recursive: true); 386 return new Directory(dir).delete(recursive: true);
387 }); 387 });
388 }, 'clean up temp dir'); 388 }, 'clean up temp dir');
389 389
390 return new ScheduledProcess.start(dartExecutable, ['--checked', dartPath]); 390 return new ScheduledProcess.start(dartExecutable, ['--checked', dartPath]);
391 } 391 }
OLDNEW
« no previous file with comments | « pkg/scheduled_test/test/descriptor/utils.dart ('k') | pkg/watcher/test/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698