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

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

Issue 2751423005: Run dartfmt on all files under runtime. (Closed)
Patch Set: Run dartfmt on all files under runtime. 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 unified diff | Download patch
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 = 17 String baseDirectory = path.dirname(Platform.script.path) + '/';
18 path.dirname(Platform.script.path) + '/';
19 18
20 Uri baseUri = Platform.script.replace(path: baseDirectory); 19 Uri baseUri = Platform.script.replace(path: baseDirectory);
21 Uri spawnUri = baseUri.resolveUri(Uri.parse('complex_reload/v1/main.dart')); 20 Uri spawnUri = baseUri.resolveUri(Uri.parse('complex_reload/v1/main.dart'));
22 Uri v2Uri = baseUri.resolveUri(Uri.parse('complex_reload/v2/main.dart')); 21 Uri v2Uri = baseUri.resolveUri(Uri.parse('complex_reload/v2/main.dart'));
23 Uri v3Uri = baseUri.resolveUri(Uri.parse('complex_reload/v3/main.dart')); 22 Uri v3Uri = baseUri.resolveUri(Uri.parse('complex_reload/v3/main.dart'));
24 23
25 testMain() async { 24 testMain() async {
26 print(baseUri); 25 print(baseUri);
27 debugger(); // Stop here. 26 debugger(); // Stop here.
28 // Spawn the child isolate. 27 // Spawn the child isolate.
29 I.Isolate isolate = 28 I.Isolate isolate = await I.Isolate.spawnUri(spawnUri, [], null);
30 await I.Isolate.spawnUri(spawnUri,
31 [],
32 null);
33 print(isolate); 29 print(isolate);
34 debugger(); 30 debugger();
35 } 31 }
36 32
37 Future<String> invokeTest(Isolate isolate) async { 33 Future<String> invokeTest(Isolate isolate) async {
38 await isolate.reload(); 34 await isolate.reload();
39 Library lib = isolate.rootLibrary; 35 Library lib = isolate.rootLibrary;
40 await lib.load(); 36 await lib.load();
41 Instance result = await lib.evaluate('test()'); 37 Instance result = await lib.evaluate('test()');
42 expect(result.isString, isTrue); 38 expect(result.isString, isTrue);
(...skipping 17 matching lines...) Expand all
60 Isolate slaveIsolate = 56 Isolate slaveIsolate =
61 vm.isolates.firstWhere((Isolate i) => i != mainIsolate); 57 vm.isolates.firstWhere((Isolate i) => i != mainIsolate);
62 expect(slaveIsolate, isNotNull); 58 expect(slaveIsolate, isNotNull);
63 59
64 // Invoke test in v1. 60 // Invoke test in v1.
65 String v1 = await invokeTest(slaveIsolate); 61 String v1 = await invokeTest(slaveIsolate);
66 expect(v1, 'apple'); 62 expect(v1, 'apple');
67 63
68 // Reload to v2. 64 // Reload to v2.
69 var response = await slaveIsolate.reloadSources( 65 var response = await slaveIsolate.reloadSources(
70 rootLibUri: v2Uri.toString(), 66 rootLibUri: v2Uri.toString(),
71 ); 67 );
72 expect(response['success'], isTrue); 68 expect(response['success'], isTrue);
73 69
74 // Invoke test in v2. 70 // Invoke test in v2.
75 String v2 = await invokeTest(slaveIsolate); 71 String v2 = await invokeTest(slaveIsolate);
76 expect(v2, 'banana'); 72 expect(v2, 'banana');
77 73
78 // Reload to v3. 74 // Reload to v3.
79 response = await slaveIsolate.reloadSources( 75 response = await slaveIsolate.reloadSources(
80 rootLibUri: v3Uri.toString(), 76 rootLibUri: v3Uri.toString(),
81 ); 77 );
82 expect(response['success'], isTrue); 78 expect(response['success'], isTrue);
83 79
84 // Invoke test in v3. 80 // Invoke test in v3.
85 String v3 = await invokeTest(slaveIsolate); 81 String v3 = await invokeTest(slaveIsolate);
86 expect(v3, 'cabbage'); 82 expect(v3, 'cabbage');
87 } 83 }
88 ]; 84 ];
89 85
90 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); 86 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain);
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/complex_reload/v1/main.dart ('k') | runtime/observatory/tests/service/contexts_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698