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

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

Issue 2680303002: Kernel debugging; service tests (Closed)
Patch Set: New failing test Created 3 years, 10 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library get_object_rpc_test; 6 library get_object_rpc_test;
7 7
8 import 'dart:typed_data'; 8 import 'dart:typed_data';
9 import 'dart:convert' show BASE64; 9 import 'dart:convert' show BASE64;
10 import 'package:observatory/service_io.dart'; 10 import 'package:observatory/service_io.dart';
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 var params = { 651 var params = {
652 'objectId': isolate.rootLibrary.id, 652 'objectId': isolate.rootLibrary.id,
653 }; 653 };
654 var result = await isolate.invokeRpcNoUpgrade('getObject', params); 654 var result = await isolate.invokeRpcNoUpgrade('getObject', params);
655 expect(result['type'], equals('Library')); 655 expect(result['type'], equals('Library'));
656 expect(result['id'], startsWith('libraries/')); 656 expect(result['id'], startsWith('libraries/'));
657 expect(result['name'], equals('get_object_rpc_test')); 657 expect(result['name'], equals('get_object_rpc_test'));
658 expect(result['uri'], startsWith('file:')); 658 expect(result['uri'], startsWith('file:'));
659 expect(result['uri'], endsWith('get_object_rpc_test.dart')); 659 expect(result['uri'], endsWith('get_object_rpc_test.dart'));
660 expect(result['debuggable'], equals(true)); 660 expect(result['debuggable'], equals(true));
661 expect(result['dependencies'].length, isPositive); 661 if (!isKernel(isolate)) {
662 expect(result['dependencies'][0]['target']['type'], equals('@Library')); 662 // There are no imports and exports in kernel.
663 expect(result['dependencies'].length, isPositive);
Kevin Millikin (Google) 2017/02/08 15:37:51 Do we plan to construct them, or do we think they
Cutch 2017/02/08 16:48:20 Please do not add public fields to the service pro
Cutch 2017/02/08 22:02:37 Ignore. I misread this code, this isn't a new fiel
jensj 2017/02/13 14:04:15 I haven't talked to anyone about it. It shown in t
664 expect(result['dependencies'][0]['target']['type'], equals('@Library'));
665 }
663 expect(result['scripts'].length, isPositive); 666 expect(result['scripts'].length, isPositive);
664 expect(result['scripts'][0]['type'], equals('@Script')); 667 expect(result['scripts'][0]['type'], equals('@Script'));
665 expect(result['variables'].length, isPositive); 668 expect(result['variables'].length, isPositive);
666 expect(result['variables'][0]['type'], equals('@Field')); 669 expect(result['variables'][0]['type'], equals('@Field'));
667 expect(result['functions'].length, isPositive); 670 expect(result['functions'].length, isPositive);
668 expect(result['functions'][0]['type'], equals('@Function')); 671 expect(result['functions'][0]['type'], equals('@Function'));
669 expect(result['classes'].length, isPositive); 672 expect(result['classes'].length, isPositive);
670 expect(result['classes'][0]['type'], equals('@Class')); 673 expect(result['classes'][0]['type'], equals('@Class'));
671 }, 674 },
672 675
(...skipping 24 matching lines...) Expand all
697 var libResult = await isolate.invokeRpcNoUpgrade('getObject', params); 700 var libResult = await isolate.invokeRpcNoUpgrade('getObject', params);
698 // Get the first script. 701 // Get the first script.
699 params = { 702 params = {
700 'objectId': libResult['scripts'][0]['id'], 703 'objectId': libResult['scripts'][0]['id'],
701 }; 704 };
702 var result = await isolate.invokeRpcNoUpgrade('getObject', params); 705 var result = await isolate.invokeRpcNoUpgrade('getObject', params);
703 expect(result['type'], equals('Script')); 706 expect(result['type'], equals('Script'));
704 expect(result['id'], startsWith('libraries/')); 707 expect(result['id'], startsWith('libraries/'));
705 expect(result['uri'], startsWith('file:')); 708 expect(result['uri'], startsWith('file:'));
706 expect(result['uri'], endsWith('get_object_rpc_test.dart')); 709 expect(result['uri'], endsWith('get_object_rpc_test.dart'));
707 expect(result['_kind'], equals('script')); 710 if (isKernel(isolate)) {
Cutch 2017/02/08 16:48:20 please find a way to express this without adding a
Kevin Millikin (Google) 2017/02/08 19:38:21 Do you have a suggestion?
jensj 2017/02/13 14:04:15 The only other way I see is to do what I've done w
Cutch 2017/03/07 01:58:37 Why not create a helper functions which include th
711 expect(result['_kind'], equals('kernel'));
712 } else {
713 expect(result['_kind'], equals('script'));
714 }
708 expect(result['library']['type'], equals('@Library')); 715 expect(result['library']['type'], equals('@Library'));
709 expect(result['source'], startsWith('// Copyright (c)')); 716 expect(result['source'], startsWith('// Copyright (c)'));
710 expect(result['tokenPosTable'].length, isPositive); 717 expect(result['tokenPosTable'].length, isPositive);
711 expect(result['tokenPosTable'][0], new isInstanceOf<List>()); 718 expect(result['tokenPosTable'][0], new isInstanceOf<List>());
712 expect(result['tokenPosTable'][0].length, isPositive); 719 expect(result['tokenPosTable'][0].length, isPositive);
713 expect(result['tokenPosTable'][0][0], new isInstanceOf<int>()); 720 expect(result['tokenPosTable'][0][0], new isInstanceOf<int>());
714 }, 721 },
715 722
716 // invalid script. 723 // invalid script.
717 (Isolate isolate) async { 724 (Isolate isolate) async {
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 caughtException = true; 954 caughtException = true;
948 expect(e.code, equals(ServerRpcException.kInvalidParams)); 955 expect(e.code, equals(ServerRpcException.kInvalidParams));
949 expect(e.message, 956 expect(e.message,
950 "getObject: invalid 'objectId' parameter: code/0"); 957 "getObject: invalid 'objectId' parameter: code/0");
951 } 958 }
952 expect(caughtException, isTrue); 959 expect(caughtException, isTrue);
953 }, 960 },
954 ]; 961 ];
955 962
956 main(args) async => runIsolateTests(args, tests, testeeBefore:warmup); 963 main(args) async => runIsolateTests(args, tests, testeeBefore:warmup);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698