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 // Dart test program for testing native extensions. | 5 // Dart test program for testing native extensions. |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 import 'dart:isolate'; | 9 import 'dart:isolate'; |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 case 'windows': | 31 case 'windows': |
32 return buildDirectory.append('test_extension.dll'); | 32 return buildDirectory.append('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 Options options = new Options(); | 39 Options options = new Options(); |
40 | 40 |
41 Path scriptDirectory = new Path.fromNative(options.script).directoryPath; | 41 Path scriptDirectory = new Path(options.script).directoryPath; |
42 Path buildDirectory = new Path.fromNative(options.executable).directoryPath; | 42 Path buildDirectory = new Path(options.executable).directoryPath; |
43 Directory tempDirectory = new Directory('').createTempSync(); | 43 Directory tempDirectory = new Directory('').createTempSync(); |
44 Path testDirectory = new Path.fromNative(tempDirectory.path); | 44 Path testDirectory = new Path(tempDirectory.path); |
45 | 45 |
46 // Copy test_extension shared library, test_extension.dart and | 46 // Copy test_extension shared library, test_extension.dart and |
47 // test_extension_tester.dart to the temporary test directory. | 47 // test_extension_tester.dart to the temporary test directory. |
48 copyFileToDirectory(getExtensionPath(buildDirectory), | 48 copyFileToDirectory(getExtensionPath(buildDirectory), |
49 testDirectory).then((_) { | 49 testDirectory).then((_) { |
50 Path extensionDartFile = scriptDirectory.append('test_extension.dart'); | 50 Path extensionDartFile = scriptDirectory.append('test_extension.dart'); |
51 return copyFileToDirectory(extensionDartFile, testDirectory); | 51 return copyFileToDirectory(extensionDartFile, testDirectory); |
52 }).then((_) { | 52 }).then((_) { |
53 Path testExtensionTesterFile = | 53 Path testExtensionTesterFile = |
54 scriptDirectory.append('test_extension_tester.dart'); | 54 scriptDirectory.append('test_extension_tester.dart'); |
55 return copyFileToDirectory(testExtensionTesterFile, testDirectory); | 55 return copyFileToDirectory(testExtensionTesterFile, testDirectory); |
56 }).then((_) { | 56 }).then((_) { |
57 Path script = testDirectory.append('test_extension_tester.dart'); | 57 Path script = testDirectory.append('test_extension_tester.dart'); |
58 return Process.run(options.executable, [script.toNativePath()]); | 58 return Process.run(options.executable, [script.toNativePath()]); |
59 })..then((ProcessResult result) { | 59 })..then((ProcessResult result) { |
60 Expect.equals(0, result.exitCode); | 60 Expect.equals(0, result.exitCode); |
61 tempDirectory.deleteSync(recursive: true); | 61 tempDirectory.deleteSync(recursive: true); |
62 })..catchError((_) { | 62 })..catchError((_) { |
63 tempDirectory.deleteSync(recursive: true); | 63 tempDirectory.deleteSync(recursive: true); |
64 }); | 64 }); |
65 } | 65 } |
OLD | NEW |