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

Side by Side Diff: runtime/observatory/tests/service/complex_reload_test.dart

Issue 2797923008: Fix updating packages map on reload and add a regression test (Closed)
Patch Set: Fix loader logic 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
« no previous file with comments | « runtime/observatory/tests/service/complex_reload/v2/packages ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // VMOptions=--error_on_bad_type --error_on_bad_override 4 // VMOptions=--error_on_bad_type --error_on_bad_override
5 5
6 import 'test_helper.dart'; 6 import 'test_helper.dart';
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:developer'; 8 import 'dart:developer';
9 import 'dart:isolate' as I; 9 import 'dart:isolate' as I;
10 import 'dart:io'; 10 import 'dart:io';
11 import 'service_test_common.dart'; 11 import 'service_test_common.dart';
12 import 'package:observatory/service.dart'; 12 import 'package:observatory/service.dart';
13 import 'package:path/path.dart' as path; 13 import 'package:path/path.dart' as path;
14 import 'package:unittest/unittest.dart'; 14 import 'package:unittest/unittest.dart';
15 15
16 // Chop off the file name. 16 // Chop off the file name.
17 String baseDirectory = path.dirname(Platform.script.path) + '/'; 17 String baseDirectory = path.dirname(Platform.script.path) + '/';
18 18
19 Uri baseUri = Platform.script.replace(path: baseDirectory); 19 Uri baseUri = Platform.script.replace(path: baseDirectory);
20 Uri spawnUri = baseUri.resolveUri(Uri.parse('complex_reload/v1/main.dart')); 20 Uri spawnUri = baseUri.resolveUri(Uri.parse('complex_reload/v1/main.dart'));
21 Uri v2Uri = baseUri.resolveUri(Uri.parse('complex_reload/v2/main.dart')); 21 Uri v2Uri = baseUri.resolveUri(Uri.parse('complex_reload/v2/main.dart'));
22 Uri v3Uri = baseUri.resolveUri(Uri.parse('complex_reload/v3/main.dart')); 22 Uri v3Uri = baseUri.resolveUri(Uri.parse('complex_reload/v3/main.dart'));
23 Uri v2PackagesUri = baseUri.resolveUri(Uri.parse('complex_reload/v2/packages'));
23 24
24 testMain() async { 25 testMain() async {
25 print(baseUri); 26 print(baseUri);
26 debugger(); // Stop here. 27 debugger(); // Stop here.
27 // Spawn the child isolate. 28 // Spawn the child isolate.
28 I.Isolate isolate = await I.Isolate.spawnUri(spawnUri, [], null); 29 I.Isolate isolate = await I.Isolate.spawnUri(spawnUri, [], null);
29 print(isolate); 30 print(isolate);
30 debugger(); 31 debugger();
31 } 32 }
32 33
(...skipping 24 matching lines...) Expand all
57 vm.isolates.firstWhere((Isolate i) => i != mainIsolate); 58 vm.isolates.firstWhere((Isolate i) => i != mainIsolate);
58 expect(slaveIsolate, isNotNull); 59 expect(slaveIsolate, isNotNull);
59 60
60 // Invoke test in v1. 61 // Invoke test in v1.
61 String v1 = await invokeTest(slaveIsolate); 62 String v1 = await invokeTest(slaveIsolate);
62 expect(v1, 'apple'); 63 expect(v1, 'apple');
63 64
64 // Reload to v2. 65 // Reload to v2.
65 var response = await slaveIsolate.reloadSources( 66 var response = await slaveIsolate.reloadSources(
66 rootLibUri: v2Uri.toString(), 67 rootLibUri: v2Uri.toString(),
68 packagesUri: v2PackagesUri.toString(),
67 ); 69 );
68 print(response); 70 print(response);
69 expect(response['success'], isTrue); 71 expect(response['success'], isTrue);
70 72
71 // Invoke test in v2. 73 // Invoke test in v2.
72 String v2 = await invokeTest(slaveIsolate); 74 String v2 = await invokeTest(slaveIsolate);
73 expect(v2, 'banana'); 75 expect(v2, 'fooLib');
74 76
75 // Reload to v3. 77 // Reload to v3.
76 response = await slaveIsolate.reloadSources( 78 response = await slaveIsolate.reloadSources(
77 rootLibUri: v3Uri.toString(), 79 rootLibUri: v3Uri.toString(),
78 ); 80 );
79 expect(response['success'], isTrue); 81 expect(response['success'], isTrue);
80 82
81 // Invoke test in v3. 83 // Invoke test in v3.
82 String v3 = await invokeTest(slaveIsolate); 84 String v3 = await invokeTest(slaveIsolate);
83 expect(v3, 'cabbage'); 85 expect(v3, 'cabbage');
84 } 86 }
85 ]; 87 ];
86 88
87 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); 89 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain);
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/complex_reload/v2/packages ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698