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

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

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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
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 15 matching lines...) Expand all
26 // Returns a list containing the source file name in the first element and the 26 // Returns a list containing the source file name in the first element and the
27 // target file name in the second element. 27 // target file name in the second element.
28 List<String> getExtensionNames(String arch) { 28 List<String> getExtensionNames(String arch) {
29 switch (Platform.operatingSystem) { 29 switch (Platform.operatingSystem) {
30 case 'android': 30 case 'android':
31 case 'linux': 31 case 'linux':
32 return ['libtest_extension.so', 'libtest_extension$arch.so']; 32 return ['libtest_extension.so', 'libtest_extension$arch.so'];
33 case 'macos': 33 case 'macos':
34 return ['libtest_extension.dylib', 'libtest_extension$arch.dylib']; 34 return ['libtest_extension.dylib', 'libtest_extension$arch.dylib'];
35 case 'windows': 35 case 'windows':
36 return ['test_extension.dll','test_extension$arch.dll']; 36 return ['test_extension.dll', 'test_extension$arch.dll'];
37 default: 37 default:
38 Expect.fail('Unknown operating system ${Platform.operatingSystem}'); 38 Expect.fail('Unknown operating system ${Platform.operatingSystem}');
39 } 39 }
40 } 40 }
41 41
42 String getExtensionPath(String buildDirectory, String filename) { 42 String getExtensionPath(String buildDirectory, String filename) {
43 switch (Platform.operatingSystem) { 43 switch (Platform.operatingSystem) {
44 case 'android': 44 case 'android':
45 case 'linux': 45 case 'linux':
46 return join(buildDirectory, 'lib.target', filename); 46 return join(buildDirectory, 'lib.target', filename);
(...skipping 30 matching lines...) Expand all
77 if (withArchSuffix) { 77 if (withArchSuffix) {
78 String arch = getArchFromBuildDir(buildDirectory); 78 String arch = getArchFromBuildDir(buildDirectory);
79 fileNames = getExtensionNames(arch); 79 fileNames = getExtensionNames(arch);
80 } else { 80 } else {
81 fileNames = getExtensionNames(''); 81 fileNames = getExtensionNames('');
82 } 82 }
83 83
84 // Copy test_extension shared library, test_extension.dart and 84 // Copy test_extension shared library, test_extension.dart and
85 // test_extension_tester.dart to the temporary test directory. 85 // test_extension_tester.dart to the temporary test directory.
86 return copyFileToDirectory(getExtensionPath(buildDirectory, fileNames[0]), 86 return copyFileToDirectory(getExtensionPath(buildDirectory, fileNames[0]),
87 join(testDirectory, fileNames[1])).then((_) { 87 join(testDirectory, fileNames[1])).then((_) {
88 var extensionDartFile = join(scriptDirectory, 'test_extension.dart'); 88 var extensionDartFile = join(scriptDirectory, 'test_extension.dart');
89 return copyFileToDirectory(extensionDartFile, testDirectory); 89 return copyFileToDirectory(extensionDartFile, testDirectory);
90 }).then((_) { 90 }).then((_) {
91 var testExtensionTesterFile = 91 var testExtensionTesterFile =
92 join(scriptDirectory, 'test_extension_tester.dart'); 92 join(scriptDirectory, 'test_extension_tester.dart');
93 return copyFileToDirectory(testExtensionTesterFile, testDirectory); 93 return copyFileToDirectory(testExtensionTesterFile, testDirectory);
94 }).then((_) { 94 }).then((_) {
95 var script = join(testDirectory, 'test_extension_tester.dart'); 95 var script = join(testDirectory, 'test_extension_tester.dart');
96 return Process.run(Platform.executable, [script]); 96 return Process.run(Platform.executable, [script]);
97 })..then((ProcessResult result) { 97 })
98 if (result.exitCode != 0) { 98 ..then((ProcessResult result) {
99 print('Subprocess failed with exit code ${result.exitCode}'); 99 if (result.exitCode != 0) {
100 print('stdout:'); 100 print('Subprocess failed with exit code ${result.exitCode}');
101 print('${result.stdout}'); 101 print('stdout:');
102 print('stderr:'); 102 print('${result.stdout}');
103 print('${result.stderr}'); 103 print('stderr:');
104 } 104 print('${result.stderr}');
105 Expect.equals(0, result.exitCode); 105 }
106 tempDirectory.deleteSync(recursive: true); 106 Expect.equals(0, result.exitCode);
107 })..catchError((_) { 107 tempDirectory.deleteSync(recursive: true);
108 tempDirectory.deleteSync(recursive: true); 108 })
109 }); 109 ..catchError((_) {
110 tempDirectory.deleteSync(recursive: true);
111 });
110 } 112 }
111 113
112 Future testWithArchSuffix() { 114 Future testWithArchSuffix() {
113 return testExtension(true); 115 return testExtension(true);
114 } 116 }
115 117
116 Future testWithoutArchSuffix() { 118 Future testWithoutArchSuffix() {
117 return testExtension(false); 119 return testExtension(false);
118 } 120 }
119 121
120 main() async { 122 main() async {
121 await testWithArchSuffix(); 123 await testWithArchSuffix();
122 await testWithoutArchSuffix(); 124 await testWithoutArchSuffix();
123 } 125 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698