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

Unified Diff: runtime/observatory/tests/service/complex_reload_test.dart

Issue 2738133005: Make complex_reload_test use Uris instead of file paths (Closed)
Patch Set: Use path package for dirname Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/tests/service/complex_reload_test.dart
diff --git a/runtime/observatory/tests/service/complex_reload_test.dart b/runtime/observatory/tests/service/complex_reload_test.dart
index f3fd80627646fc9de84f50c461a702e4c679ef35..0f470f55f9e6420ab1fcbadbf97dd240e913ac80 100644
--- a/runtime/observatory/tests/service/complex_reload_test.dart
+++ b/runtime/observatory/tests/service/complex_reload_test.dart
@@ -10,25 +10,30 @@ import 'dart:isolate' as I;
import 'dart:io';
import 'service_test_common.dart';
import 'package:observatory/service.dart';
+import 'package:path/path.dart' as path;
import 'package:unittest/unittest.dart';
+// Chop off the file name.
+String baseDirectory =
+ path.dirname(Platform.script.path) + Platform.pathSeparator;
+
+Uri baseUri = Platform.script.replace(path: baseDirectory);
+Uri spawnUri = baseUri.resolveUri(Uri.parse('complex_reload/v1/main.dart'));
+Uri v2Uri = baseUri.resolveUri(Uri.parse('complex_reload/v2/main.dart'));
+Uri v3Uri = baseUri.resolveUri(Uri.parse('complex_reload/v3/main.dart'));
+
testMain() async {
+ print(baseUri);
debugger(); // Stop here.
// Spawn the child isolate.
I.Isolate isolate =
- await I.Isolate.spawnUri(Uri.parse('complex_reload/v1/main.dart'),
+ await I.Isolate.spawnUri(spawnUri,
[],
null);
print(isolate);
debugger();
}
-// Directory that we are running in.
-String directory = (Platform.isWindows ? '' : Platform.pathSeparator) +
- Platform.script.pathSegments.sublist(
- 0,
- Platform.script.pathSegments.length - 1).join(Platform.pathSeparator);
-
Future<String> invokeTest(Isolate isolate) async {
await isolate.reload();
Library lib = isolate.rootLibrary;
@@ -46,10 +51,6 @@ var tests = [
// Stop at 'debugger' statement.
hasStoppedAtBreakpoint,
(Isolate mainIsolate) async {
- for (var i = 0; i < Platform.script.pathSegments.length; i++) {
- print('segment $i: "${Platform.script.pathSegments[i]}"');
- }
- print('Directory: $directory');
// Grab the VM.
VM vm = mainIsolate.vm;
await vm.reloadIsolates();
@@ -66,10 +67,7 @@ var tests = [
// Reload to v2.
var response = await slaveIsolate.reloadSources(
- rootLibUri: '$directory${Platform.pathSeparator}'
- 'complex_reload${Platform.pathSeparator}'
- 'v2${Platform.pathSeparator}'
- 'main.dart',
+ rootLibUri: v2Uri.toString(),
);
expect(response['success'], isTrue);
@@ -79,10 +77,7 @@ var tests = [
// Reload to v3.
response = await slaveIsolate.reloadSources(
- rootLibUri: '$directory${Platform.pathSeparator}'
- 'complex_reload${Platform.pathSeparator}'
- 'v3${Platform.pathSeparator}'
- 'main.dart',
+ rootLibUri: v3Uri.toString(),
);
expect(response['success'], isTrue);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698