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

Side by Side Diff: tests/standalone/io/test_extension_test.dart

Issue 25471003: Modify tests to use Directory.systemTemp (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase 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
OLDNEW
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 // Dart test program for testing native extensions. 5 // Dart test program for testing native extensions.
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 import "package:path/path.dart"; 8 import "package:path/path.dart";
9 import 'dart:async'; 9 import 'dart:async';
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 20 matching lines...) Expand all
31 case 'windows': 31 case 'windows':
32 return join(buildDirectory, 'test_extension.dll'); 32 return join(buildDirectory, 'test_extension.dll');
33 default: 33 default:
34 Expect.fail('Unknown operating system ${Platform.operatingSystem}'); 34 Expect.fail('Unknown operating system ${Platform.operatingSystem}');
35 } 35 }
36 } 36 }
37 37
38 void main() { 38 void main() {
39 String scriptDirectory = dirname(Platform.script); 39 String scriptDirectory = dirname(Platform.script);
40 String buildDirectory = dirname(Platform.executable); 40 String buildDirectory = dirname(Platform.executable);
41 Directory tempDirectory = new Directory('').createTempSync(); 41 Directory tempDirectory =
42 Directory.systemTemp.createTempSync('dart_test_extension');
42 String testDirectory = tempDirectory.path; 43 String testDirectory = tempDirectory.path;
43 44
44 // Copy test_extension shared library, test_extension.dart and 45 // Copy test_extension shared library, test_extension.dart and
45 // test_extension_tester.dart to the temporary test directory. 46 // test_extension_tester.dart to the temporary test directory.
46 copyFileToDirectory(getExtensionPath(buildDirectory), 47 copyFileToDirectory(getExtensionPath(buildDirectory),
47 testDirectory).then((_) { 48 testDirectory).then((_) {
48 var extensionDartFile = join(scriptDirectory, 'test_extension.dart'); 49 var extensionDartFile = join(scriptDirectory, 'test_extension.dart');
49 return copyFileToDirectory(extensionDartFile, testDirectory); 50 return copyFileToDirectory(extensionDartFile, testDirectory);
50 }).then((_) { 51 }).then((_) {
51 var testExtensionTesterFile = 52 var testExtensionTesterFile =
52 join(scriptDirectory, 'test_extension_tester.dart'); 53 join(scriptDirectory, 'test_extension_tester.dart');
53 return copyFileToDirectory(testExtensionTesterFile, testDirectory); 54 return copyFileToDirectory(testExtensionTesterFile, testDirectory);
54 }).then((_) { 55 }).then((_) {
55 var script = join(testDirectory, 'test_extension_tester.dart'); 56 var script = join(testDirectory, 'test_extension_tester.dart');
56 return Process.run(Platform.executable, [script]); 57 return Process.run(Platform.executable, [script]);
57 })..then((ProcessResult result) { 58 })..then((ProcessResult result) {
58 Expect.equals(0, result.exitCode); 59 Expect.equals(0, result.exitCode);
59 tempDirectory.deleteSync(recursive: true); 60 tempDirectory.deleteSync(recursive: true);
60 })..catchError((_) { 61 })..catchError((_) {
61 tempDirectory.deleteSync(recursive: true); 62 tempDirectory.deleteSync(recursive: true);
62 }); 63 });
63 } 64 }
OLDNEW
« no previous file with comments | « tests/standalone/io/test_extension_fail_test.dart ('k') | tests/standalone/io/windows_environment_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698