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

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

Issue 2767533002: Revert "Fix observatory tests broken by running dartfmt." (Closed)
Patch Set: 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) 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';
11 import 'package:unittest/unittest.dart'; 11 import 'package:unittest/unittest.dart';
12 import 'test_helper.dart'; 12 import 'test_helper.dart';
13 13
14 class _DummyClass { 14 class _DummyClass {
15 static var dummyVar = 11; 15 static var dummyVar = 11;
16 void dummyFunction() {} 16 void dummyFunction() {
17 }
17 } 18 }
18 19
19 class _DummySubClass extends _DummyClass {} 20 class _DummySubClass extends _DummyClass {
21 }
20 22
21 void warmup() { 23 void warmup() {
22 // Silence analyzer. 24 // Silence analyzer.
23 new _DummySubClass(); 25 new _DummySubClass();
24 new _DummyClass().dummyFunction(); 26 new _DummyClass().dummyFunction();
25 } 27 }
26 28
27 eval(Isolate isolate, String expression) async { 29 eval(Isolate isolate, String expression) async {
28 Map params = { 30 Map params = {
29 'targetId': isolate.rootLibrary.id, 31 'targetId': isolate.rootLibrary.id,
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 Uint8List bytes = BASE64.decode(result['bytes']); 451 Uint8List bytes = BASE64.decode(result['bytes']);
450 expect(bytes.buffer.asUint8List().toString(), equals('[3, 2, 1]')); 452 expect(bytes.buffer.asUint8List().toString(), equals('[3, 2, 1]'));
451 }, 453 },
452 454
453 // Uint8List prefix. 455 // Uint8List prefix.
454 (Isolate isolate) async { 456 (Isolate isolate) async {
455 // Call eval to get a Dart list. 457 // Call eval to get a Dart list.
456 var evalResult = await eval(isolate, 'uint8List'); 458 var evalResult = await eval(isolate, 'uint8List');
457 var params = { 459 var params = {
458 'objectId': evalResult['id'], 460 'objectId': evalResult['id'],
459 'count': 2, 461 'count' : 2,
460 }; 462 };
461 var result = await isolate.invokeRpcNoUpgrade('getObject', params); 463 var result = await isolate.invokeRpcNoUpgrade('getObject', params);
462 expect(result['type'], equals('Instance')); 464 expect(result['type'], equals('Instance'));
463 expect(result['kind'], equals('Uint8List')); 465 expect(result['kind'], equals('Uint8List'));
464 expect(result['_vmType'], equals('TypedData')); 466 expect(result['_vmType'], equals('TypedData'));
465 expect(result['id'], startsWith('objects/')); 467 expect(result['id'], startsWith('objects/'));
466 expect(result['valueAsString'], isNull); 468 expect(result['valueAsString'], isNull);
467 expect(result['class']['type'], equals('@Class')); 469 expect(result['class']['type'], equals('@Class'));
468 expect(result['class']['name'], equals('_Uint8List')); 470 expect(result['class']['name'], equals('_Uint8List'));
469 expect(result['size'], isPositive); 471 expect(result['size'], isPositive);
470 expect(result['fields'], isEmpty); 472 expect(result['fields'], isEmpty);
471 expect(result['length'], equals(3)); 473 expect(result['length'], equals(3));
472 expect(result['offset'], isNull); 474 expect(result['offset'], isNull);
473 expect(result['count'], equals(2)); 475 expect(result['count'], equals(2));
474 expect(result['bytes'], equals('AwI=')); 476 expect(result['bytes'], equals('AwI='));
475 Uint8List bytes = BASE64.decode(result['bytes']); 477 Uint8List bytes = BASE64.decode(result['bytes']);
476 expect(bytes.buffer.asUint8List().toString(), equals('[3, 2]')); 478 expect(bytes.buffer.asUint8List().toString(), equals('[3, 2]'));
477 }, 479 },
478 480
479 // Uint8List suffix. 481 // Uint8List suffix.
480 (Isolate isolate) async { 482 (Isolate isolate) async {
481 // Call eval to get a Dart list. 483 // Call eval to get a Dart list.
482 var evalResult = await eval(isolate, 'uint8List'); 484 var evalResult = await eval(isolate, 'uint8List');
483 var params = { 485 var params = {
484 'objectId': evalResult['id'], 486 'objectId': evalResult['id'],
485 'offset': 2, 487 'offset' : 2,
486 'count': 2, 488 'count' : 2,
487 }; 489 };
488 var result = await isolate.invokeRpcNoUpgrade('getObject', params); 490 var result = await isolate.invokeRpcNoUpgrade('getObject', params);
489 expect(result['type'], equals('Instance')); 491 expect(result['type'], equals('Instance'));
490 expect(result['kind'], equals('Uint8List')); 492 expect(result['kind'], equals('Uint8List'));
491 expect(result['_vmType'], equals('TypedData')); 493 expect(result['_vmType'], equals('TypedData'));
492 expect(result['id'], startsWith('objects/')); 494 expect(result['id'], startsWith('objects/'));
493 expect(result['valueAsString'], isNull); 495 expect(result['valueAsString'], isNull);
494 expect(result['class']['type'], equals('@Class')); 496 expect(result['class']['type'], equals('@Class'));
495 expect(result['class']['name'], equals('_Uint8List')); 497 expect(result['class']['name'], equals('_Uint8List'));
496 expect(result['size'], isPositive); 498 expect(result['size'], isPositive);
497 expect(result['fields'], isEmpty); 499 expect(result['fields'], isEmpty);
498 expect(result['length'], equals(3)); 500 expect(result['length'], equals(3));
499 expect(result['offset'], equals(2)); 501 expect(result['offset'], equals(2));
500 expect(result['count'], equals(1)); 502 expect(result['count'], equals(1));
501 expect(result['bytes'], equals('AQ==')); 503 expect(result['bytes'], equals('AQ=='));
502 Uint8List bytes = BASE64.decode(result['bytes']); 504 Uint8List bytes = BASE64.decode(result['bytes']);
503 expect(bytes.buffer.asUint8List().toString(), equals('[1]')); 505 expect(bytes.buffer.asUint8List().toString(), equals('[1]'));
504 }, 506 },
505 507
506 // Uint8List with wacky offset. 508 // Uint8List with wacky offset.
507 (Isolate isolate) async { 509 (Isolate isolate) async {
508 // Call eval to get a Dart list. 510 // Call eval to get a Dart list.
509 var evalResult = await eval(isolate, 'uint8List'); 511 var evalResult = await eval(isolate, 'uint8List');
510 var params = { 512 var params = {
511 'objectId': evalResult['id'], 513 'objectId': evalResult['id'],
512 'offset': 100, 514 'offset' : 100,
513 'count': 2, 515 'count' : 2,
514 }; 516 };
515 var result = await isolate.invokeRpcNoUpgrade('getObject', params); 517 var result = await isolate.invokeRpcNoUpgrade('getObject', params);
516 expect(result['type'], equals('Instance')); 518 expect(result['type'], equals('Instance'));
517 expect(result['kind'], equals('Uint8List')); 519 expect(result['kind'], equals('Uint8List'));
518 expect(result['_vmType'], equals('TypedData')); 520 expect(result['_vmType'], equals('TypedData'));
519 expect(result['id'], startsWith('objects/')); 521 expect(result['id'], startsWith('objects/'));
520 expect(result['valueAsString'], isNull); 522 expect(result['valueAsString'], isNull);
521 expect(result['class']['type'], equals('@Class')); 523 expect(result['class']['type'], equals('@Class'));
522 expect(result['class']['name'], equals('_Uint8List')); 524 expect(result['class']['name'], equals('_Uint8List'));
523 expect(result['size'], isPositive); 525 expect(result['size'], isPositive);
(...skipping 28 matching lines...) Expand all
552 Uint8List bytes = BASE64.decode(result['bytes']); 554 Uint8List bytes = BASE64.decode(result['bytes']);
553 expect(bytes.buffer.asUint64List().toString(), equals('[3, 2, 1]')); 555 expect(bytes.buffer.asUint64List().toString(), equals('[3, 2, 1]'));
554 }, 556 },
555 557
556 // Uint64List prefix. 558 // Uint64List prefix.
557 (Isolate isolate) async { 559 (Isolate isolate) async {
558 // Call eval to get a Dart list. 560 // Call eval to get a Dart list.
559 var evalResult = await eval(isolate, 'uint64List'); 561 var evalResult = await eval(isolate, 'uint64List');
560 var params = { 562 var params = {
561 'objectId': evalResult['id'], 563 'objectId': evalResult['id'],
562 'count': 2, 564 'count' : 2,
563 }; 565 };
564 var result = await isolate.invokeRpcNoUpgrade('getObject', params); 566 var result = await isolate.invokeRpcNoUpgrade('getObject', params);
565 expect(result['type'], equals('Instance')); 567 expect(result['type'], equals('Instance'));
566 expect(result['kind'], equals('Uint64List')); 568 expect(result['kind'], equals('Uint64List'));
567 expect(result['_vmType'], equals('TypedData')); 569 expect(result['_vmType'], equals('TypedData'));
568 expect(result['id'], startsWith('objects/')); 570 expect(result['id'], startsWith('objects/'));
569 expect(result['valueAsString'], isNull); 571 expect(result['valueAsString'], isNull);
570 expect(result['class']['type'], equals('@Class')); 572 expect(result['class']['type'], equals('@Class'));
571 expect(result['class']['name'], equals('_Uint64List')); 573 expect(result['class']['name'], equals('_Uint64List'));
572 expect(result['size'], isPositive); 574 expect(result['size'], isPositive);
573 expect(result['fields'], isEmpty); 575 expect(result['fields'], isEmpty);
574 expect(result['length'], equals(3)); 576 expect(result['length'], equals(3));
575 expect(result['offset'], isNull); 577 expect(result['offset'], isNull);
576 expect(result['count'], equals(2)); 578 expect(result['count'], equals(2));
577 expect(result['bytes'], equals('AwAAAAAAAAACAAAAAAAAAA==')); 579 expect(result['bytes'], equals('AwAAAAAAAAACAAAAAAAAAA=='));
578 Uint8List bytes = BASE64.decode(result['bytes']); 580 Uint8List bytes = BASE64.decode(result['bytes']);
579 expect(bytes.buffer.asUint64List().toString(), equals('[3, 2]')); 581 expect(bytes.buffer.asUint64List().toString(), equals('[3, 2]'));
580 }, 582 },
581 583
582 // Uint64List suffix. 584 // Uint64List suffix.
583 (Isolate isolate) async { 585 (Isolate isolate) async {
584 // Call eval to get a Dart list. 586 // Call eval to get a Dart list.
585 var evalResult = await eval(isolate, 'uint64List'); 587 var evalResult = await eval(isolate, 'uint64List');
586 var params = { 588 var params = {
587 'objectId': evalResult['id'], 589 'objectId': evalResult['id'],
588 'offset': 2, 590 'offset' : 2,
589 'count': 2, 591 'count' : 2,
590 }; 592 };
591 var result = await isolate.invokeRpcNoUpgrade('getObject', params); 593 var result = await isolate.invokeRpcNoUpgrade('getObject', params);
592 expect(result['type'], equals('Instance')); 594 expect(result['type'], equals('Instance'));
593 expect(result['kind'], equals('Uint64List')); 595 expect(result['kind'], equals('Uint64List'));
594 expect(result['_vmType'], equals('TypedData')); 596 expect(result['_vmType'], equals('TypedData'));
595 expect(result['id'], startsWith('objects/')); 597 expect(result['id'], startsWith('objects/'));
596 expect(result['valueAsString'], isNull); 598 expect(result['valueAsString'], isNull);
597 expect(result['class']['type'], equals('@Class')); 599 expect(result['class']['type'], equals('@Class'));
598 expect(result['class']['name'], equals('_Uint64List')); 600 expect(result['class']['name'], equals('_Uint64List'));
599 expect(result['size'], isPositive); 601 expect(result['size'], isPositive);
600 expect(result['fields'], isEmpty); 602 expect(result['fields'], isEmpty);
601 expect(result['length'], equals(3)); 603 expect(result['length'], equals(3));
602 expect(result['offset'], equals(2)); 604 expect(result['offset'], equals(2));
603 expect(result['count'], equals(1)); 605 expect(result['count'], equals(1));
604 expect(result['bytes'], equals('AQAAAAAAAAA=')); 606 expect(result['bytes'], equals('AQAAAAAAAAA='));
605 Uint8List bytes = BASE64.decode(result['bytes']); 607 Uint8List bytes = BASE64.decode(result['bytes']);
606 expect(bytes.buffer.asUint64List().toString(), equals('[1]')); 608 expect(bytes.buffer.asUint64List().toString(), equals('[1]'));
607 }, 609 },
608 610
609 // Uint64List with wacky offset. 611 // Uint64List with wacky offset.
610 (Isolate isolate) async { 612 (Isolate isolate) async {
611 // Call eval to get a Dart list. 613 // Call eval to get a Dart list.
612 var evalResult = await eval(isolate, 'uint64List'); 614 var evalResult = await eval(isolate, 'uint64List');
613 var params = { 615 var params = {
614 'objectId': evalResult['id'], 616 'objectId': evalResult['id'],
615 'offset': 100, 617 'offset' : 100,
616 'count': 2, 618 'count' : 2,
617 }; 619 };
618 var result = await isolate.invokeRpcNoUpgrade('getObject', params); 620 var result = await isolate.invokeRpcNoUpgrade('getObject', params);
619 expect(result['type'], equals('Instance')); 621 expect(result['type'], equals('Instance'));
620 expect(result['kind'], equals('Uint64List')); 622 expect(result['kind'], equals('Uint64List'));
621 expect(result['_vmType'], equals('TypedData')); 623 expect(result['_vmType'], equals('TypedData'));
622 expect(result['id'], startsWith('objects/')); 624 expect(result['id'], startsWith('objects/'));
623 expect(result['valueAsString'], isNull); 625 expect(result['valueAsString'], isNull);
624 expect(result['class']['type'], equals('@Class')); 626 expect(result['class']['type'], equals('@Class'));
625 expect(result['class']['name'], equals('_Uint64List')); 627 expect(result['class']['name'], equals('_Uint64List'));
626 expect(result['size'], isPositive); 628 expect(result['size'], isPositive);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 }, 671 },
670 672
671 // invalid library. 673 // invalid library.
672 (Isolate isolate) async { 674 (Isolate isolate) async {
673 var params = { 675 var params = {
674 'objectId': 'libraries/9999999', 676 'objectId': 'libraries/9999999',
675 }; 677 };
676 bool caughtException; 678 bool caughtException;
677 try { 679 try {
678 await isolate.invokeRpcNoUpgrade('getObject', params); 680 await isolate.invokeRpcNoUpgrade('getObject', params);
679 expect(false, isTrue, reason: 'Unreachable'); 681 expect(false, isTrue, reason:'Unreachable');
680 } on ServerRpcException catch (e) { 682 } on ServerRpcException catch(e) {
681 caughtException = true; 683 caughtException = true;
682 expect(e.code, equals(ServerRpcException.kInvalidParams)); 684 expect(e.code, equals(ServerRpcException.kInvalidParams));
683 expect(e.message, 685 expect(e.message,
684 "getObject: invalid 'objectId' parameter: libraries/9999999"); 686 "getObject: invalid 'objectId' parameter: libraries/9999999");
685 } 687 }
686 expect(caughtException, isTrue); 688 expect(caughtException, isTrue);
687 }, 689 },
688 690
689 // script. 691 // script.
690 (Isolate isolate) async { 692 (Isolate isolate) async {
691 // Get the library first. 693 // Get the library first.
692 var params = { 694 var params = {
693 'objectId': isolate.rootLibrary.id, 695 'objectId': isolate.rootLibrary.id,
694 }; 696 };
(...skipping 17 matching lines...) Expand all
712 }, 714 },
713 715
714 // invalid script. 716 // invalid script.
715 (Isolate isolate) async { 717 (Isolate isolate) async {
716 var params = { 718 var params = {
717 'objectId': 'scripts/9999999', 719 'objectId': 'scripts/9999999',
718 }; 720 };
719 bool caughtException; 721 bool caughtException;
720 try { 722 try {
721 await isolate.invokeRpcNoUpgrade('getObject', params); 723 await isolate.invokeRpcNoUpgrade('getObject', params);
722 expect(false, isTrue, reason: 'Unreachable'); 724 expect(false, isTrue, reason:'Unreachable');
723 } on ServerRpcException catch (e) { 725 } on ServerRpcException catch(e) {
724 caughtException = true; 726 caughtException = true;
725 expect(e.code, equals(ServerRpcException.kInvalidParams)); 727 expect(e.code, equals(ServerRpcException.kInvalidParams));
726 expect(e.message, 728 expect(e.message,
727 "getObject: invalid 'objectId' parameter: scripts/9999999"); 729 "getObject: invalid 'objectId' parameter: scripts/9999999");
728 } 730 }
729 expect(caughtException, isTrue); 731 expect(caughtException, isTrue);
730 }, 732 },
731 733
732 // class 734 // class
733 (Isolate isolate) async { 735 (Isolate isolate) async {
734 // Call eval to get a class id. 736 // Call eval to get a class id.
735 var evalResult = await eval(isolate, 'new _DummyClass()'); 737 var evalResult = await eval(isolate, 'new _DummyClass()');
736 var params = { 738 var params = {
737 'objectId': evalResult['class']['id'], 739 'objectId': evalResult['class']['id'],
(...skipping 21 matching lines...) Expand all
759 }, 761 },
760 762
761 // invalid class. 763 // invalid class.
762 (Isolate isolate) async { 764 (Isolate isolate) async {
763 var params = { 765 var params = {
764 'objectId': 'classes/9999999', 766 'objectId': 'classes/9999999',
765 }; 767 };
766 bool caughtException; 768 bool caughtException;
767 try { 769 try {
768 await isolate.invokeRpcNoUpgrade('getObject', params); 770 await isolate.invokeRpcNoUpgrade('getObject', params);
769 expect(false, isTrue, reason: 'Unreachable'); 771 expect(false, isTrue, reason:'Unreachable');
770 } on ServerRpcException catch (e) { 772 } on ServerRpcException catch(e) {
771 caughtException = true; 773 caughtException = true;
772 expect(e.code, equals(ServerRpcException.kInvalidParams)); 774 expect(e.code, equals(ServerRpcException.kInvalidParams));
773 expect(e.message, 775 expect(e.message,
774 "getObject: invalid 'objectId' parameter: classes/9999999"); 776 "getObject: invalid 'objectId' parameter: classes/9999999");
775 } 777 }
776 expect(caughtException, isTrue); 778 expect(caughtException, isTrue);
777 }, 779 },
778 780
779 // type. 781 // type.
780 (Isolate isolate) async { 782 (Isolate isolate) async {
781 // Call eval to get a class id. 783 // Call eval to get a class id.
782 var evalResult = await eval(isolate, 'new _DummyClass()'); 784 var evalResult = await eval(isolate, 'new _DummyClass()');
783 var id = "${evalResult['class']['id']}/types/0"; 785 var id = "${evalResult['class']['id']}/types/0";
784 var params = { 786 var params = {
(...skipping 14 matching lines...) Expand all
799 // invalid type. 801 // invalid type.
800 (Isolate isolate) async { 802 (Isolate isolate) async {
801 var evalResult = await eval(isolate, 'new _DummyClass()'); 803 var evalResult = await eval(isolate, 'new _DummyClass()');
802 var id = "${evalResult['class']['id']}/types/9999999"; 804 var id = "${evalResult['class']['id']}/types/9999999";
803 var params = { 805 var params = {
804 'objectId': id, 806 'objectId': id,
805 }; 807 };
806 bool caughtException; 808 bool caughtException;
807 try { 809 try {
808 await isolate.invokeRpcNoUpgrade('getObject', params); 810 await isolate.invokeRpcNoUpgrade('getObject', params);
809 expect(false, isTrue, reason: 'Unreachable'); 811 expect(false, isTrue, reason:'Unreachable');
810 } on ServerRpcException catch (e) { 812 } on ServerRpcException catch(e) {
811 caughtException = true; 813 caughtException = true;
812 expect(e.code, equals(ServerRpcException.kInvalidParams)); 814 expect(e.code, equals(ServerRpcException.kInvalidParams));
813 expect( 815 expect(e.message,
814 e.message, startsWith("getObject: invalid 'objectId' parameter: ")); 816 startsWith("getObject: invalid 'objectId' parameter: "));
815 } 817 }
816 expect(caughtException, isTrue); 818 expect(caughtException, isTrue);
817 }, 819 },
818 820
819 // function. 821 // function.
820 (Isolate isolate) async { 822 (Isolate isolate) async {
821 // Call eval to get a class id. 823 // Call eval to get a class id.
822 var evalResult = await eval(isolate, 'new _DummyClass()'); 824 var evalResult = await eval(isolate, 'new _DummyClass()');
823 var id = "${evalResult['class']['id']}/functions/dummyFunction"; 825 var id = "${evalResult['class']['id']}/functions/dummyFunction";
824 var params = { 826 var params = {
(...skipping 19 matching lines...) Expand all
844 (Isolate isolate) async { 846 (Isolate isolate) async {
845 // Call eval to get a class id. 847 // Call eval to get a class id.
846 var evalResult = await eval(isolate, 'new _DummyClass()'); 848 var evalResult = await eval(isolate, 'new _DummyClass()');
847 var id = "${evalResult['class']['id']}/functions/invalid"; 849 var id = "${evalResult['class']['id']}/functions/invalid";
848 var params = { 850 var params = {
849 'objectId': id, 851 'objectId': id,
850 }; 852 };
851 bool caughtException; 853 bool caughtException;
852 try { 854 try {
853 await isolate.invokeRpcNoUpgrade('getObject', params); 855 await isolate.invokeRpcNoUpgrade('getObject', params);
854 expect(false, isTrue, reason: 'Unreachable'); 856 expect(false, isTrue, reason:'Unreachable');
855 } on ServerRpcException catch (e) { 857 } on ServerRpcException catch(e) {
856 caughtException = true; 858 caughtException = true;
857 expect(e.code, equals(ServerRpcException.kInvalidParams)); 859 expect(e.code, equals(ServerRpcException.kInvalidParams));
858 expect( 860 expect(e.message,
859 e.message, startsWith("getObject: invalid 'objectId' parameter: ")); 861 startsWith("getObject: invalid 'objectId' parameter: "));
860 } 862 }
861 expect(caughtException, isTrue); 863 expect(caughtException, isTrue);
862 }, 864 },
863 865
864 // field 866 // field
865 (Isolate isolate) async { 867 (Isolate isolate) async {
866 // Call eval to get a class id. 868 // Call eval to get a class id.
867 var evalResult = await eval(isolate, 'new _DummyClass()'); 869 var evalResult = await eval(isolate, 'new _DummyClass()');
868 var id = "${evalResult['class']['id']}/fields/dummyVar"; 870 var id = "${evalResult['class']['id']}/fields/dummyVar";
869 var params = { 871 var params = {
(...skipping 17 matching lines...) Expand all
887 (Isolate isolate) async { 889 (Isolate isolate) async {
888 // Call eval to get a class id. 890 // Call eval to get a class id.
889 var evalResult = await eval(isolate, 'new _DummyClass()'); 891 var evalResult = await eval(isolate, 'new _DummyClass()');
890 var id = "${evalResult['class']['id']}/fields/mythicalField"; 892 var id = "${evalResult['class']['id']}/fields/mythicalField";
891 var params = { 893 var params = {
892 'objectId': id, 894 'objectId': id,
893 }; 895 };
894 bool caughtException; 896 bool caughtException;
895 try { 897 try {
896 await isolate.invokeRpcNoUpgrade('getObject', params); 898 await isolate.invokeRpcNoUpgrade('getObject', params);
897 expect(false, isTrue, reason: 'Unreachable'); 899 expect(false, isTrue, reason:'Unreachable');
898 } on ServerRpcException catch (e) { 900 } on ServerRpcException catch(e) {
899 caughtException = true; 901 caughtException = true;
900 expect(e.code, equals(ServerRpcException.kInvalidParams)); 902 expect(e.code, equals(ServerRpcException.kInvalidParams));
901 expect( 903 expect(e.message,
902 e.message, startsWith("getObject: invalid 'objectId' parameter: ")); 904 startsWith("getObject: invalid 'objectId' parameter: "));
903 } 905 }
904 expect(caughtException, isTrue); 906 expect(caughtException, isTrue);
905 }, 907 },
906 908
907 // code. 909 // code.
908 (Isolate isolate) async { 910 (Isolate isolate) async {
909 // Call eval to get a class id. 911 // Call eval to get a class id.
910 var evalResult = await eval(isolate, 'new _DummyClass()'); 912 var evalResult = await eval(isolate, 'new _DummyClass()');
911 var funcId = "${evalResult['class']['id']}/functions/dummyFunction"; 913 var funcId = "${evalResult['class']['id']}/functions/dummyFunction";
912 var params = { 914 var params = {
913 'objectId': funcId, 915 'objectId': funcId,
914 }; 916 };
915 var funcResult = await isolate.invokeRpcNoUpgrade('getObject', params); 917 var funcResult = await isolate.invokeRpcNoUpgrade('getObject', params);
916 params = { 918 params = {
917 'objectId': funcResult['code']['id'], 919 'objectId': funcResult['code']['id'],
918 }; 920 };
919 var result = await isolate.invokeRpcNoUpgrade('getObject', params); 921 var result = await isolate.invokeRpcNoUpgrade('getObject', params);
920 expect(result['type'], equals('Code')); 922 expect(result['type'], equals('Code'));
921 expect(result['name'], equals('_DummyClass.dummyFunction')); 923 expect(result['name'], equals('_DummyClass.dummyFunction'));
922 expect(result['_vmName'], equals('dummyFunction')); 924 expect(result['_vmName'], equals('dummyFunction'));
923 expect(result['kind'], equals('Dart')); 925 expect(result['kind'], equals('Dart'));
924 expect(result['_optimized'], new isInstanceOf<bool>()); 926 expect(result['_optimized'], new isInstanceOf<bool>());
925 expect(result['function']['type'], equals('@Function')); 927 expect(result['function']['type'], equals('@Function'));
926 expect(result['_startAddress'], new isInstanceOf<String>()); 928 expect(result['_startAddress'], new isInstanceOf<String>());
927 expect(result['_endAddress'], new isInstanceOf<String>()); 929 expect(result['_endAddress'], new isInstanceOf<String>());
928 expect(result['_objectPool'], isNotNull); 930 expect(result['_objectPool'], isNotNull);
929 expect(result['_disassembly'], isNotNull); 931 expect(result['_disassembly'], isNotNull);
930 expect(result['_descriptors'], isNotNull); 932 expect(result['_descriptors'], isNotNull);
931 expect( 933 expect(result['_inlinedFunctions'], anyOf([isNull, new isInstanceOf<List>()] ));
932 result['_inlinedFunctions'], anyOf([isNull, new isInstanceOf<List>()])); 934 expect(result['_inlinedIntervals'], anyOf([isNull, new isInstanceOf<List>()] ));
933 expect(
934 result['_inlinedIntervals'], anyOf([isNull, new isInstanceOf<List>()]));
935 }, 935 },
936 936
937 // invalid code. 937 // invalid code.
938 (Isolate isolate) async { 938 (Isolate isolate) async {
939 var params = { 939 var params = {
940 'objectId': 'code/0', 940 'objectId': 'code/0',
941 }; 941 };
942 bool caughtException; 942 bool caughtException;
943 try { 943 try {
944 await isolate.invokeRpcNoUpgrade('getObject', params); 944 await isolate.invokeRpcNoUpgrade('getObject', params);
945 expect(false, isTrue, reason: 'Unreachable'); 945 expect(false, isTrue, reason:'Unreachable');
946 } on ServerRpcException catch (e) { 946 } on ServerRpcException catch(e) {
947 caughtException = true; 947 caughtException = true;
948 expect(e.code, equals(ServerRpcException.kInvalidParams)); 948 expect(e.code, equals(ServerRpcException.kInvalidParams));
949 expect(e.message, "getObject: invalid 'objectId' parameter: code/0"); 949 expect(e.message,
950 "getObject: invalid 'objectId' parameter: code/0");
950 } 951 }
951 expect(caughtException, isTrue); 952 expect(caughtException, isTrue);
952 }, 953 },
953 ]; 954 ];
954 955
955 main(args) async => runIsolateTests(args, tests, testeeBefore: warmup); 956 main(args) async => runIsolateTests(args, tests, testeeBefore:warmup);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698