Chromium Code Reviews| Index: samples/sample_extension/test/sample_extension_test_helper.dart |
| diff --git a/samples/sample_extension/test/sample_extension_test_helper.dart b/samples/sample_extension/test/sample_extension_test_helper.dart |
| index e1c1faa0aa5f81308490e2a54d42f13e1205ae7c..42cdfe49dd4f4476d9f6c108347c2dfd9e09dd3d 100644 |
| --- a/samples/sample_extension/test/sample_extension_test_helper.dart |
| +++ b/samples/sample_extension/test/sample_extension_test_helper.dart |
| @@ -5,37 +5,32 @@ |
| // Dart test program for testing native extensions. |
| import 'dart:async'; |
| -import 'dart:io'; |
| -import 'dart:isolate'; |
| +import 'dart:io'; import 'dart:isolate'; |
|
kustermann
2017/02/21 12:06:15
newline?
|
| import "package:expect/expect.dart"; |
| import "package:path/path.dart"; |
| -Future copyFileToDirectory(String file, String directory) { |
| +Future copyFileToDirectory(String file, String directory) async { |
| String src = file; |
| String dst = directory; |
| + ProcessResult result; |
| switch (Platform.operatingSystem) { |
| case 'linux': |
| case 'macos': |
| - return Process.run('cp', [src, dst]); |
| + result = await Process.run('cp', [src, dst]); |
| + break; |
| case 'windows': |
| - return Process.run('cmd.exe', ['/C', 'copy $src $dst']); |
| + result = await Process.run('cmd.exe', ['/C', 'copy $src $dst']); |
| + break; |
| default: |
| Expect.fail('Unknown operating system ${Platform.operatingSystem}'); |
| } |
| -} |
| - |
| -String getNativeLibraryPath(String buildDirectory) { |
| - switch (Platform.operatingSystem) { |
| - case 'linux': |
| - return join(buildDirectory, 'lib.target', 'libsample_extension.so'); |
| - case 'macos': |
| - return join(buildDirectory, 'libsample_extension.dylib'); |
| - case 'windows': |
| - return join(buildDirectory, 'sample_extension.dll'); |
| - default: |
| - Expect.fail('Unknown operating system ${Platform.operatingSystem}'); |
| + if (result.exitCode != 0) { |
| + print(result.stdout); |
| + print(result.stderr); |
| + throw "Failed to copy test file ($file) to temporary directory ($directory)"; |
| } |
| + return result; |
|
kustermann
2017/02/21 12:06:15
I'd just remove it.
|
| } |
| Future run(String program, List arguments) async { |
| @@ -59,8 +54,6 @@ Future testNativeExtensions(String snapshotKind) async { |
| // Copy sample_extension shared library, sample_extension dart files and |
| // sample_extension tests to the temporary test directory. |
|
kustermann
2017/02/21 12:06:15
Remove "sample_extension shared library"
|
| - await copyFileToDirectory(getNativeLibraryPath(buildDirectory), |
| - testDirectory); |
| for (var file in ['sample_synchronous_extension.dart', |
| 'sample_asynchronous_extension.dart', |
| 'test_sample_synchronous_extension.dart', |