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

Side by Side Diff: samples/sample_extension/test/sample_extension_test_helper.dart

Issue 2828603002: Format samples and samples-dev directories. (Closed)
Patch Set: 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) 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 // 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 Future testNativeExtensions(String snapshotKind) async { 47 Future testNativeExtensions(String snapshotKind) async {
48 String buildDirectory = dirname(Platform.executable); 48 String buildDirectory = dirname(Platform.executable);
49 Directory tempDirectory = 49 Directory tempDirectory =
50 Directory.systemTemp.createTempSync('sample_extension_'); 50 Directory.systemTemp.createTempSync('sample_extension_');
51 try { 51 try {
52 String testDirectory = tempDirectory.path; 52 String testDirectory = tempDirectory.path;
53 String sourceDirectory = Platform.script.resolve('..').toFilePath(); 53 String sourceDirectory = Platform.script.resolve('..').toFilePath();
54 54
55 // Copy sample_extension dart files and sample_extension tests to the 55 // Copy sample_extension dart files and sample_extension tests to the
56 // temporary test directory. 56 // temporary test directory.
57 for (var file in ['sample_synchronous_extension.dart', 57 for (var file in [
58 'sample_asynchronous_extension.dart', 58 'sample_synchronous_extension.dart',
59 'test_sample_synchronous_extension.dart', 59 'sample_asynchronous_extension.dart',
60 'test_sample_asynchronous_extension.dart']) { 60 'test_sample_synchronous_extension.dart',
61 'test_sample_asynchronous_extension.dart'
62 ]) {
61 await copyFileToDirectory(join(sourceDirectory, file), testDirectory); 63 await copyFileToDirectory(join(sourceDirectory, file), testDirectory);
62 } 64 }
63 65
64 for (var test in ['test_sample_synchronous_extension.dart', 66 for (var test in [
65 'test_sample_asynchronous_extension.dart']) { 67 'test_sample_synchronous_extension.dart',
68 'test_sample_asynchronous_extension.dart'
69 ]) {
66 String script = join(testDirectory, test); 70 String script = join(testDirectory, test);
67 String snapshot; 71 String snapshot;
68 if (snapshotKind == null) { 72 if (snapshotKind == null) {
69 snapshot = script; 73 snapshot = script;
70 } else { 74 } else {
71 snapshot = join(testDirectory, "$test.snapshot"); 75 snapshot = join(testDirectory, "$test.snapshot");
72 await run(Platform.executable, 76 await run(Platform.executable,
73 ['--snapshot=$snapshot', 77 ['--snapshot=$snapshot', '--snapshot-kind=$snapshotKind', script]);
74 '--snapshot-kind=$snapshotKind',
75 script]);
76 } 78 }
77 79
78 await run(Platform.executable, [snapshot]); 80 await run(Platform.executable, [snapshot]);
79 } 81 }
80 } finally { 82 } finally {
81 await tempDirectory.deleteSync(recursive: true); 83 await tempDirectory.deleteSync(recursive: true);
82 } 84 }
83 } 85 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698