| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import "dart:async"; | 5 import "dart:async"; |
| 6 import "dart:io"; | 6 import "dart:io"; |
| 7 import "dart:convert" show JSON; | 7 import "dart:convert" show JSON; |
| 8 import "package:path/path.dart" as p; | 8 import "package:path/path.dart" as p; |
| 9 import "package:async_helper/async_helper.dart"; | 9 import "package:async_helper/async_helper.dart"; |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 78 } |
| 79 | 79 |
| 80 asyncEnd(); | 80 asyncEnd(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 /// Test running the test of the configuration through [Isolate.spawn]. | 83 /// Test running the test of the configuration through [Isolate.spawn]. |
| 84 /// | 84 /// |
| 85 /// This should not change the expected results compared to running it | 85 /// This should not change the expected results compared to running it |
| 86 /// directly. | 86 /// directly. |
| 87 Configuration spawn(Configuration conf) { | 87 Configuration spawn(Configuration conf) { |
| 88 // TODO(26555): Clean up when fixed. | |
| 89 // TEMPORARY FIX FOR ISSUE #26555 (http://dartbug.com/26555) | |
| 90 if (conf.expect["iroot"] == null && | |
| 91 conf.expect["iconf"] == null && | |
| 92 conf.expect["pconf"] != null) { | |
| 93 // The spawned isolate will do a search for a package file or root, | |
| 94 // which is not what the original did. Skip test for now. | |
| 95 return null; | |
| 96 } | |
| 97 // REMOVE WHEN ISSUE FIXED! | |
| 98 return conf.update( | 88 return conf.update( |
| 99 description: conf.description + "/spawn", | 89 description: conf.description + "/spawn", |
| 100 main: "spawnMain", | 90 main: "spawnMain", |
| 101 newArgs: [conf.mainType], | 91 newArgs: [conf.mainType], |
| 102 // TEMPORARY FIX FOR ISSUE #26555 (http://dartbug.com/26555) | 92 expect: null |
| 103 expect: { | |
| 104 "proot": conf.expect["iroot"], | |
| 105 "pconf": conf.expect["iconf"], | |
| 106 } | |
| 107 // REMOVE WHEN ISSUE FIXED! | |
| 108 ); | 93 ); |
| 109 } | 94 } |
| 110 | 95 |
| 111 /// Tests running a spawnUri on top of the configuration before testing. | 96 /// Tests running a spawnUri on top of the configuration before testing. |
| 112 /// | 97 /// |
| 113 /// The `spawnUri` call has no explicit root or config parameter, and | 98 /// The `spawnUri` call has no explicit root or config parameter, and |
| 114 /// shouldn't search for one, so it implicitly inherits the current isolate's | 99 /// shouldn't search for one, so it implicitly inherits the current isolate's |
| 115 /// actual root or configuration. | 100 /// actual root or configuration. |
| 116 Configuration spawnUriInherit(Configuration conf) { | 101 Configuration spawnUriInherit(Configuration conf) { |
| 117 if (conf.expect["iroot"] == null && | 102 if (conf.expect["iroot"] == null && |
| (...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 void insertFileAt(Map file, Map http, | 977 void insertFileAt(Map file, Map http, |
| 993 String path, String name, String content) { | 978 String path, String name, String content) { |
| 994 var parts = path.split('/').toList(); | 979 var parts = path.split('/').toList(); |
| 995 var dir = (parts[0] == "%file") ? file : http; | 980 var dir = (parts[0] == "%file") ? file : http; |
| 996 for (var i = 1; i < parts.length - 1; i++) { | 981 for (var i = 1; i < parts.length - 1; i++) { |
| 997 var entry = parts[i]; | 982 var entry = parts[i]; |
| 998 dir = dir[entry] ?? (dir[entry] = {}); | 983 dir = dir[entry] ?? (dir[entry] = {}); |
| 999 } | 984 } |
| 1000 dir[name] = content; | 985 dir[name] = content; |
| 1001 } | 986 } |
| OLD | NEW |