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

Side by Side Diff: mojom/mojom_parser/serialization/serialization_test.go

Issue 1844103002: Mojom compiler frontend: Populate the declaration_order field for Methods. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Don't change mojom_translator.py in this cl. Created 4 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 | « mojom/mojom_parser/mojom/user_defined_types.go ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package serialization 5 package serialization
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "compress/gzip" 9 "compress/gzip"
10 "encoding/base64" 10 "encoding/base64"
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 // DeclaredMojomObjects 690 // DeclaredMojomObjects
691 test.expectedFile().DeclaredMojomObjects.Interfaces = &[]string{ "TYPE_KEY:test.EchoService"} 691 test.expectedFile().DeclaredMojomObjects.Interfaces = &[]string{ "TYPE_KEY:test.EchoService"}
692 692
693 // ResolvedTypes 693 // ResolvedTypes
694 694
695 // interface EchoService 695 // interface EchoService
696 test.expectedGraph().ResolvedTypes["TYPE_KEY:test.EchoService"] = &mojom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{ 696 test.expectedGraph().ResolvedTypes["TYPE_KEY:test.EchoService"] = &mojom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{
697 DeclData: test.newDeclData("EchoService", "test.EchoServ ice"), 697 DeclData: test.newDeclData("EchoService", "test.EchoServ ice"),
698 Methods: map[uint32]mojom_types.MojomMethod{ 698 Methods: map[uint32]mojom_types.MojomMethod{
699 0: mojom_types.MojomMethod{ 699 0: mojom_types.MojomMethod{
700 » » » » » DeclData: test.newDeclData("EchoString", ""), 700 » » » » » DeclData: test.newDeclDataO(0, -1, "Echo String", ""),
701 Parameters: mojom_types.MojomStruct{ 701 Parameters: mojom_types.MojomStruct{
702 DeclData: test.newDeclData("Echo String-request", ""), 702 DeclData: test.newDeclData("Echo String-request", ""),
703 Fields: []mojom_types.StructFiel d{ 703 Fields: []mojom_types.StructFiel d{
704 mojom_types.StructField{ 704 mojom_types.StructField{
705 DeclData: test.n ewDeclDataO(0, -1, "value", ""), 705 DeclData: test.n ewDeclDataO(0, -1, "value", ""),
706 Type: &mojom _types.TypeStringType{mojom_types.StringType{true}}, 706 Type: &mojom _types.TypeStringType{mojom_types.StringType{true}},
707 }, 707 },
708 }, 708 },
709 }, 709 },
710 ResponseParams: &mojom_types.MojomStruct { 710 ResponseParams: &mojom_types.MojomStruct {
711 DeclData: test.newDeclData("Echo String-response", ""), 711 DeclData: test.newDeclData("Echo String-response", ""),
712 Fields: []mojom_types.StructFiel d{ 712 Fields: []mojom_types.StructFiel d{
713 mojom_types.StructField{ 713 mojom_types.StructField{
714 DeclData: test.n ewDeclDataO(0, -1, "value", ""), 714 DeclData: test.n ewDeclDataO(0, -1, "value", ""),
715 Type: &mojom _types.TypeStringType{mojom_types.StringType{true}}, 715 Type: &mojom _types.TypeStringType{mojom_types.StringType{true}},
716 }, 716 },
717 }, 717 },
718 }, 718 },
719 }, 719 },
720 1: mojom_types.MojomMethod{ 720 1: mojom_types.MojomMethod{
721 » » » » » DeclData: test.newDeclData("DelayedEchoS tring", ""), 721 » » » » » DeclData: test.newDeclDataO(1, -1, "Dela yedEchoString", ""),
722 Parameters: mojom_types.MojomStruct{ 722 Parameters: mojom_types.MojomStruct{
723 DeclData: test.newDeclData("Dela yedEchoString-request", ""), 723 DeclData: test.newDeclData("Dela yedEchoString-request", ""),
724 Fields: []mojom_types.StructFiel d{ 724 Fields: []mojom_types.StructFiel d{
725 mojom_types.StructField{ 725 mojom_types.StructField{
726 DeclData: test.n ewDeclDataO(0, -1, "value", ""), 726 DeclData: test.n ewDeclDataO(0, -1, "value", ""),
727 Type: &mojom _types.TypeStringType{mojom_types.StringType{true}}, 727 Type: &mojom _types.TypeStringType{mojom_types.StringType{true}},
728 }, 728 },
729 mojom_types.StructField{ 729 mojom_types.StructField{
730 DeclData: test.n ewDeclDataO(1, -1, "millis", ""), 730 DeclData: test.n ewDeclDataO(1, -1, "millis", ""),
731 Type: &mojom _types.TypeSimpleType{mojom_types.SimpleType_Int32}, 731 Type: &mojom _types.TypeSimpleType{mojom_types.SimpleType_Int32},
(...skipping 11 matching lines...) Expand all
743 }, 743 },
744 Ordinal: 1, 744 Ordinal: 1,
745 }, 745 },
746 }, 746 },
747 }} 747 }}
748 748
749 test.endTestCase() 749 test.endTestCase()
750 } 750 }
751 751
752 //////////////////////////////////////////////////////////// 752 ////////////////////////////////////////////////////////////
753 // Test Case: Explicit Method Ordinals. Tests the DeclarationOrder field .
754 ////////////////////////////////////////////////////////////
755 {
756
757 contents := `
758 interface MyInterface {
759 Method1@1();
760 Method0@0();
761 };`
762
763 test.addTestCase("", contents)
764
765 // DeclaredMojomObjects
766 test.expectedFile().DeclaredMojomObjects.Interfaces = &[]string{ "TYPE_KEY:MyInterface"}
767
768 // interface EchoService
769 test.expectedGraph().ResolvedTypes["TYPE_KEY:MyInterface"] = &mo jom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{
770 DeclData: test.newDeclData("MyInterface", "MyInterface") ,
771 Methods: map[uint32]mojom_types.MojomMethod{
772 0: mojom_types.MojomMethod{
773 DeclData: test.newDeclDataO(1, 0, "Metho d0", ""),
774 Parameters: mojom_types.MojomStruct{
775 DeclData: test.newDeclData("Meth od0-request", ""),
776 Fields: []mojom_types.StructFi eld{},
777 },
778 Ordinal: 0,
779 },
780 1: mojom_types.MojomMethod{
781 DeclData: test.newDeclDataO(0, 1, "Metho d1", ""),
782 Parameters: mojom_types.MojomStruct{
783 DeclData: test.newDeclData("Meth od1-request", ""),
784 Fields: []mojom_types.StructFi eld{},
785 },
786 Ordinal: 1,
787 },
788 },
789 }}
790
791 test.endTestCase()
792 }
793
794 ////////////////////////////////////////////////////////////
753 // Test Case: Use of the ServiceName attribute 795 // Test Case: Use of the ServiceName attribute
754 //////////////////////////////////////////////////////////// 796 ////////////////////////////////////////////////////////////
755 { 797 {
756 798
757 contents := ` 799 contents := `
758 module test; 800 module test;
759 801
760 [ServiceName = "my.test.EchoService"] 802 [ServiceName = "my.test.EchoService"]
761 interface EchoService { 803 interface EchoService {
762 EchoString(string? value) => (string? value); 804 EchoString(string? value) => (string? value);
763 };` 805 };`
764 806
765 test.addTestCase("test", contents) 807 test.addTestCase("test", contents)
766 808
767 // DeclaredMojomObjects 809 // DeclaredMojomObjects
768 test.expectedFile().DeclaredMojomObjects.Interfaces = &[]string{ "TYPE_KEY:test.EchoService"} 810 test.expectedFile().DeclaredMojomObjects.Interfaces = &[]string{ "TYPE_KEY:test.EchoService"}
769 811
770 // ResolvedTypes 812 // ResolvedTypes
771 813
772 // interface EchoService 814 // interface EchoService
773 test.expectedGraph().ResolvedTypes["TYPE_KEY:test.EchoService"] = &mojom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{ 815 test.expectedGraph().ResolvedTypes["TYPE_KEY:test.EchoService"] = &mojom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{
774 DeclData: test.newDeclDataA("EchoService", "test.Echo Service", &[]mojom_types.Attribute{{"ServiceName", &mojom_types.LiteralValueStri ngValue{"my.test.EchoService"}}}), 816 DeclData: test.newDeclDataA("EchoService", "test.Echo Service", &[]mojom_types.Attribute{{"ServiceName", &mojom_types.LiteralValueStri ngValue{"my.test.EchoService"}}}),
775 ServiceName: stringPointer("my.test.EchoService"), 817 ServiceName: stringPointer("my.test.EchoService"),
776 Methods: map[uint32]mojom_types.MojomMethod{ 818 Methods: map[uint32]mojom_types.MojomMethod{
777 0: mojom_types.MojomMethod{ 819 0: mojom_types.MojomMethod{
778 » » » » » DeclData: test.newDeclData("EchoString", ""), 820 » » » » » DeclData: test.newDeclDataO(0, -1, "Echo String", ""),
779 Parameters: mojom_types.MojomStruct{ 821 Parameters: mojom_types.MojomStruct{
780 DeclData: test.newDeclData("Echo String-request", ""), 822 DeclData: test.newDeclData("Echo String-request", ""),
781 Fields: []mojom_types.StructFiel d{ 823 Fields: []mojom_types.StructFiel d{
782 mojom_types.StructField{ 824 mojom_types.StructField{
783 DeclData: test.n ewDeclDataO(0, -1, "value", ""), 825 DeclData: test.n ewDeclDataO(0, -1, "value", ""),
784 Type: &mojom _types.TypeStringType{mojom_types.StringType{true}}, 826 Type: &mojom _types.TypeStringType{mojom_types.StringType{true}},
785 }, 827 },
786 }, 828 },
787 }, 829 },
788 ResponseParams: &mojom_types.MojomStruct { 830 ResponseParams: &mojom_types.MojomStruct {
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 test.addTestCase("", contents) 1534 test.addTestCase("", contents)
1493 1535
1494 test.expectedFile().DeclaredMojomObjects.Interfaces = &[]string{ "TYPE_KEY:MyInterface42"} 1536 test.expectedFile().DeclaredMojomObjects.Interfaces = &[]string{ "TYPE_KEY:MyInterface42"}
1495 1537
1496 test.expectedGraph().ResolvedTypes["TYPE_KEY:MyInterface42"] = & mojom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{ 1538 test.expectedGraph().ResolvedTypes["TYPE_KEY:MyInterface42"] = & mojom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{
1497 DeclData: test.newDeclData("MyInterface42", "MyInt erface42"), 1539 DeclData: test.newDeclData("MyInterface42", "MyInt erface42"),
1498 CurrentVersion: 2, 1540 CurrentVersion: 2,
1499 Methods: map[uint32]mojom_types.MojomMethod{ 1541 Methods: map[uint32]mojom_types.MojomMethod{
1500 // DoIt 1542 // DoIt
1501 0: mojom_types.MojomMethod{ 1543 0: mojom_types.MojomMethod{
1502 » » » » » DeclData: test.newDeclData("DoIt", ""), 1544 » » » » » DeclData: test.newDeclDataO(0, -1, "DoIt ", ""),
1503 Parameters: mojom_types.MojomStruct{ 1545 Parameters: mojom_types.MojomStruct{
1504 DeclData: test.newDeclData("DoIt -request", ""), 1546 DeclData: test.newDeclData("DoIt -request", ""),
1505 Fields: []mojom_types.StructFiel d{ 1547 Fields: []mojom_types.StructFiel d{
1506 // The fields are in ord inal order and the first two arguments to newShortDeclDataO() are 1548 // The fields are in ord inal order and the first two arguments to newShortDeclDataO() are
1507 // declarationOrder and declaredOrdinal. 1549 // declarationOrder and declaredOrdinal.
1508 // x0 1550 // x0
1509 mojom_types.StructField{ 1551 mojom_types.StructField{
1510 DeclData: test .newDeclDataO(0, -1, "x0", ""), 1552 DeclData: test .newDeclDataO(0, -1, "x0", ""),
1511 Type: &moj om_types.TypeSimpleType{mojom_types.SimpleType_Int8}, 1553 Type: &moj om_types.TypeSimpleType{mojom_types.SimpleType_Int8},
1512 Offset: 0, 1554 Offset: 0,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1573 VersionNumber: 1 , 1615 VersionNumber: 1 ,
1574 NumFields: 2 , 1616 NumFields: 2 ,
1575 NumBytes: 2 4, 1617 NumBytes: 2 4,
1576 }, 1618 },
1577 }, 1619 },
1578 }, 1620 },
1579 }, 1621 },
1580 1622
1581 // DoItAgain 1623 // DoItAgain
1582 1: mojom_types.MojomMethod{ 1624 1: mojom_types.MojomMethod{
1583 » » » » » DeclData: test.newDeclDataA("DoItAgain", "", &[]mojom_types.Attribute{{"MinVersion", &mojom_types.LiteralValueInt8Value{ 1}}}), 1625 » » » » » DeclData: test.newShortDeclDataAO(1, -1, "DoItAgain", &[]mojom_types.Attribute{{"MinVersion", &mojom_types.LiteralValueI nt8Value{1}}}),
1584 Parameters: mojom_types.MojomStruct{ 1626 Parameters: mojom_types.MojomStruct{
1585 DeclData: test.newDeclData("DoIt Again-request", ""), 1627 DeclData: test.newDeclData("DoIt Again-request", ""),
1586 Fields: []mojom_types.StructFiel d{ 1628 Fields: []mojom_types.StructFiel d{
1587 // The fields are in ord inal order and the first two arguments to newShortDeclDataO() are 1629 // The fields are in ord inal order and the first two arguments to newShortDeclDataO() are
1588 // declarationOrder and declaredOrdinal. 1630 // declarationOrder and declaredOrdinal.
1589 // x0 1631 // x0
1590 mojom_types.StructField{ 1632 mojom_types.StructField{
1591 DeclData: test .newDeclDataO(0, -1, "x0", ""), 1633 DeclData: test .newDeclDataO(0, -1, "x0", ""),
1592 Type: &moj om_types.TypeSimpleType{mojom_types.SimpleType_Int8}, 1634 Type: &moj om_types.TypeSimpleType{mojom_types.SimpleType_Int8},
1593 Offset: 0, 1635 Offset: 0,
1594 MinVersion: 0, 1636 MinVersion: 0,
1595 }, 1637 },
1596 }, 1638 },
1597 VersionInfo: &[]mojom_types.Stru ctVersion{ 1639 VersionInfo: &[]mojom_types.Stru ctVersion{
1598 mojom_types.StructVersio n{ 1640 mojom_types.StructVersio n{
1599 VersionNumber: 0 , 1641 VersionNumber: 0 ,
1600 NumFields: 1 , 1642 NumFields: 1 ,
1601 NumBytes: 1 6, 1643 NumBytes: 1 6,
1602 }, 1644 },
1603 }, 1645 },
1604 }, 1646 },
1605 Ordinal: 1, 1647 Ordinal: 1,
1606 MinVersion: 1, 1648 MinVersion: 1,
1607 }, 1649 },
1608 1650
1609 // AndAgain 1651 // AndAgain
1610 2: mojom_types.MojomMethod{ 1652 2: mojom_types.MojomMethod{
1611 » » » » » DeclData: test.newDeclDataA("AndAgain", "", &[]mojom_types.Attribute{{"MinVersion", &mojom_types.LiteralValueInt8Value{2 }}}), 1653 » » » » » DeclData: test.newShortDeclDataAO(2, -1, "AndAgain", &[]mojom_types.Attribute{{"MinVersion", &mojom_types.LiteralValueIn t8Value{2}}}),
1612 Parameters: mojom_types.MojomStruct{ 1654 Parameters: mojom_types.MojomStruct{
1613 DeclData: test.newDeclData("AndA gain-request", ""), 1655 DeclData: test.newDeclData("AndA gain-request", ""),
1614 Fields: []mojom_types.StructFi eld{}, 1656 Fields: []mojom_types.StructFi eld{},
1615 VersionInfo: &[]mojom_types.Stru ctVersion{ 1657 VersionInfo: &[]mojom_types.Stru ctVersion{
1616 mojom_types.StructVersio n{ 1658 mojom_types.StructVersio n{
1617 VersionNumber: 0 , 1659 VersionNumber: 0 ,
1618 NumFields: 0 , 1660 NumFields: 0 ,
1619 NumBytes: 8 , 1661 NumBytes: 8 ,
1620 }, 1662 },
1621 }, 1663 },
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2778 // FooA 2820 // FooA
2779 test.expectedRuntimeTypeInfoA().TypeMap["TYPE_KEY:a.b.c.FooA"] = &mojom_types.UserDefinedTypeStructType{mojom_types.MojomStruct{ 2821 test.expectedRuntimeTypeInfoA().TypeMap["TYPE_KEY:a.b.c.FooA"] = &mojom_types.UserDefinedTypeStructType{mojom_types.MojomStruct{
2780 DeclData: newDeclData(test.fileNameA(), "FooA", "a.b.c.F ooA"), 2822 DeclData: newDeclData(test.fileNameA(), "FooA", "a.b.c.F ooA"),
2781 Fields: []mojom_types.StructField{}}} 2823 Fields: []mojom_types.StructField{}}}
2782 2824
2783 // InterfaceA 2825 // InterfaceA
2784 test.expectedRuntimeTypeInfoA().TypeMap["TYPE_KEY:a.b.c.Interfac eA"] = &mojom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{ 2826 test.expectedRuntimeTypeInfoA().TypeMap["TYPE_KEY:a.b.c.Interfac eA"] = &mojom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{
2785 DeclData: newDeclData(test.fileNameA(), "InterfaceA", "a .b.c.InterfaceA"), 2827 DeclData: newDeclData(test.fileNameA(), "InterfaceA", "a .b.c.InterfaceA"),
2786 Methods: map[uint32]mojom_types.MojomMethod{ 2828 Methods: map[uint32]mojom_types.MojomMethod{
2787 0: mojom_types.MojomMethod{ 2829 0: mojom_types.MojomMethod{
2788 » » » » » DeclData: newDeclData(test.fileNameA(), "DoIt", ""), 2830 » » » » » DeclData: newDeclDataO(0, -1, test.fileN ameA(), "DoIt", ""),
2789 Parameters: mojom_types.MojomStruct{ 2831 Parameters: mojom_types.MojomStruct{
2790 DeclData: newDeclData(test.fileN ameA(), "DoIt-request", ""), 2832 DeclData: newDeclData(test.fileN ameA(), "DoIt-request", ""),
2791 Fields: []mojom_types.StructFiel d{ 2833 Fields: []mojom_types.StructFiel d{
2792 mojom_types.StructField{ 2834 mojom_types.StructField{
2793 DeclData: newDec lDataO(0, -1, test.fileNameA(), "x", ""), 2835 DeclData: newDec lDataO(0, -1, test.fileNameA(), "x", ""),
2794 Type: &mojom_typ es.TypeTypeReference{mojom_types.TypeReference{ 2836 Type: &mojom_typ es.TypeTypeReference{mojom_types.TypeReference{
2795 false, f alse, stringPointer("FooA"), stringPointer("TYPE_KEY:a.b.c.FooA")}}, 2837 false, f alse, stringPointer("FooA"), stringPointer("TYPE_KEY:a.b.c.FooA")}},
2796 }, 2838 },
2797 }, 2839 },
2798 }, 2840 },
(...skipping 18 matching lines...) Expand all
2817 // FooA 2859 // FooA
2818 test.expectedRuntimeTypeInfoB().TypeMap["TYPE_KEY:b.c.d.FooB"] = &mojom_types.UserDefinedTypeStructType{mojom_types.MojomStruct{ 2860 test.expectedRuntimeTypeInfoB().TypeMap["TYPE_KEY:b.c.d.FooB"] = &mojom_types.UserDefinedTypeStructType{mojom_types.MojomStruct{
2819 DeclData: newDeclData(test.fileNameB(), "FooB", "b.c.d.F ooB"), 2861 DeclData: newDeclData(test.fileNameB(), "FooB", "b.c.d.F ooB"),
2820 Fields: []mojom_types.StructField{}}} 2862 Fields: []mojom_types.StructField{}}}
2821 2863
2822 // InterfaceB 2864 // InterfaceB
2823 test.expectedRuntimeTypeInfoB().TypeMap["TYPE_KEY:b.c.d.Interfac eB"] = &mojom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{ 2865 test.expectedRuntimeTypeInfoB().TypeMap["TYPE_KEY:b.c.d.Interfac eB"] = &mojom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{
2824 DeclData: newDeclData(test.fileNameB(), "InterfaceB", "b .c.d.InterfaceB"), 2866 DeclData: newDeclData(test.fileNameB(), "InterfaceB", "b .c.d.InterfaceB"),
2825 Methods: map[uint32]mojom_types.MojomMethod{ 2867 Methods: map[uint32]mojom_types.MojomMethod{
2826 0: mojom_types.MojomMethod{ 2868 0: mojom_types.MojomMethod{
2827 » » » » » DeclData: newDeclData(test.fileNameB(), "DoIt", ""), 2869 » » » » » DeclData: newDeclDataO(0, -1, test.fileN ameB(), "DoIt", ""),
2828 Parameters: mojom_types.MojomStruct{ 2870 Parameters: mojom_types.MojomStruct{
2829 DeclData: newDeclData(test.fileN ameB(), "DoIt-request", ""), 2871 DeclData: newDeclData(test.fileN ameB(), "DoIt-request", ""),
2830 Fields: []mojom_types.StructFiel d{ 2872 Fields: []mojom_types.StructFiel d{
2831 mojom_types.StructField{ 2873 mojom_types.StructField{
2832 DeclData: newDec lDataO(0, -1, test.fileNameB(), "x", ""), 2874 DeclData: newDec lDataO(0, -1, test.fileNameB(), "x", ""),
2833 Type: &mojom_typ es.TypeTypeReference{mojom_types.TypeReference{ 2875 Type: &mojom_typ es.TypeTypeReference{mojom_types.TypeReference{
2834 false, f alse, stringPointer("a.b.c.FooA"), stringPointer("TYPE_KEY:a.b.c.FooA")}}, 2876 false, f alse, stringPointer("a.b.c.FooA"), stringPointer("TYPE_KEY:a.b.c.FooA")}},
2835 }, 2877 },
2836 }, 2878 },
2837 }, 2879 },
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
2893 DeclData: newDeclData(test.fileNameA(), "FooA", "a.b.c.F ooA"), 2935 DeclData: newDeclData(test.fileNameA(), "FooA", "a.b.c.F ooA"),
2894 Fields: []mojom_types.StructField{}}} 2936 Fields: []mojom_types.StructField{}}}
2895 2937
2896 // InterfaceA 2938 // InterfaceA
2897 test.expectedRuntimeTypeInfoA().TypeMap["TYPE_KEY:a.b.c.Interfac eA"] = &mojom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{ 2939 test.expectedRuntimeTypeInfoA().TypeMap["TYPE_KEY:a.b.c.Interfac eA"] = &mojom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{
2898 DeclData: newDeclDataA(test.fileNameA(), "InterfaceA", " a.b.c.InterfaceA", 2940 DeclData: newDeclDataA(test.fileNameA(), "InterfaceA", " a.b.c.InterfaceA",
2899 &[]mojom_types.Attribute{{"ServiceName", &mojom_ types.LiteralValueStringValue{"AwesomeService"}}}), 2941 &[]mojom_types.Attribute{{"ServiceName", &mojom_ types.LiteralValueStringValue{"AwesomeService"}}}),
2900 ServiceName: stringPointer("AwesomeService"), 2942 ServiceName: stringPointer("AwesomeService"),
2901 Methods: map[uint32]mojom_types.MojomMethod{ 2943 Methods: map[uint32]mojom_types.MojomMethod{
2902 0: mojom_types.MojomMethod{ 2944 0: mojom_types.MojomMethod{
2903 » » » » » DeclData: newDeclData(test.fileNameA(), "DoIt", ""), 2945 » » » » » DeclData: newDeclDataO(0, -1, test.fileN ameA(), "DoIt", ""),
2904 Parameters: mojom_types.MojomStruct{ 2946 Parameters: mojom_types.MojomStruct{
2905 DeclData: newDeclData(test.fileN ameA(), "DoIt-request", ""), 2947 DeclData: newDeclData(test.fileN ameA(), "DoIt-request", ""),
2906 Fields: []mojom_types.StructFiel d{ 2948 Fields: []mojom_types.StructFiel d{
2907 mojom_types.StructField{ 2949 mojom_types.StructField{
2908 DeclData: newDec lDataO(0, -1, test.fileNameA(), "x", ""), 2950 DeclData: newDec lDataO(0, -1, test.fileNameA(), "x", ""),
2909 Type: &mojom_typ es.TypeTypeReference{mojom_types.TypeReference{ 2951 Type: &mojom_typ es.TypeTypeReference{mojom_types.TypeReference{
2910 false, f alse, stringPointer("FooA"), stringPointer("TYPE_KEY:a.b.c.FooA")}}, 2952 false, f alse, stringPointer("FooA"), stringPointer("TYPE_KEY:a.b.c.FooA")}},
2911 }, 2953 },
2912 }, 2954 },
2913 }, 2955 },
(...skipping 18 matching lines...) Expand all
2932 // FooA 2974 // FooA
2933 test.expectedRuntimeTypeInfoB().TypeMap["TYPE_KEY:b.c.d.FooB"] = &mojom_types.UserDefinedTypeStructType{mojom_types.MojomStruct{ 2975 test.expectedRuntimeTypeInfoB().TypeMap["TYPE_KEY:b.c.d.FooB"] = &mojom_types.UserDefinedTypeStructType{mojom_types.MojomStruct{
2934 DeclData: newDeclData(test.fileNameB(), "FooB", "b.c.d.F ooB"), 2976 DeclData: newDeclData(test.fileNameB(), "FooB", "b.c.d.F ooB"),
2935 Fields: []mojom_types.StructField{}}} 2977 Fields: []mojom_types.StructField{}}}
2936 2978
2937 // InterfaceB 2979 // InterfaceB
2938 test.expectedRuntimeTypeInfoB().TypeMap["TYPE_KEY:b.c.d.Interfac eB"] = &mojom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{ 2980 test.expectedRuntimeTypeInfoB().TypeMap["TYPE_KEY:b.c.d.Interfac eB"] = &mojom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{
2939 DeclData: newDeclData(test.fileNameB(), "InterfaceB", "b .c.d.InterfaceB"), 2981 DeclData: newDeclData(test.fileNameB(), "InterfaceB", "b .c.d.InterfaceB"),
2940 Methods: map[uint32]mojom_types.MojomMethod{ 2982 Methods: map[uint32]mojom_types.MojomMethod{
2941 0: mojom_types.MojomMethod{ 2983 0: mojom_types.MojomMethod{
2942 » » » » » DeclData: newDeclData(test.fileNameB(), "DoIt", ""), 2984 » » » » » DeclData: newDeclDataO(0, -1, test.fileN ameB(), "DoIt", ""),
2943 Parameters: mojom_types.MojomStruct{ 2985 Parameters: mojom_types.MojomStruct{
2944 DeclData: newDeclData(test.fileN ameB(), "DoIt-request", ""), 2986 DeclData: newDeclData(test.fileN ameB(), "DoIt-request", ""),
2945 Fields: []mojom_types.StructFiel d{ 2987 Fields: []mojom_types.StructFiel d{
2946 mojom_types.StructField{ 2988 mojom_types.StructField{
2947 DeclData: newDec lDataO(0, -1, test.fileNameB(), "x", ""), 2989 DeclData: newDec lDataO(0, -1, test.fileNameB(), "x", ""),
2948 Type: &mojom_typ es.TypeTypeReference{mojom_types.TypeReference{ 2990 Type: &mojom_typ es.TypeTypeReference{mojom_types.TypeReference{
2949 false, f alse, stringPointer("a.b.c.FooA"), stringPointer("TYPE_KEY:a.b.c.FooA")}}, 2991 false, f alse, stringPointer("a.b.c.FooA"), stringPointer("TYPE_KEY:a.b.c.FooA")}},
2950 }, 2992 },
2951 }, 2993 },
2952 }, 2994 },
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
3013 test.expectedRuntimeTypeInfoA().TypeMap["TYPE_KEY:a.b.c.Interfac eA"] = &mojom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{ 3055 test.expectedRuntimeTypeInfoA().TypeMap["TYPE_KEY:a.b.c.Interfac eA"] = &mojom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{
3014 DeclData: newDeclDataA(test.fileNameA(), "InterfaceA", " a.b.c.InterfaceA", 3056 DeclData: newDeclDataA(test.fileNameA(), "InterfaceA", " a.b.c.InterfaceA",
3015 &[]mojom_types.Attribute{ 3057 &[]mojom_types.Attribute{
3016 {"Color", &mojom_types.LiteralValueStrin gValue{"RED"}}, 3058 {"Color", &mojom_types.LiteralValueStrin gValue{"RED"}},
3017 {"ServiceName", &mojom_types.LiteralValu eInt8Value{7}}, 3059 {"ServiceName", &mojom_types.LiteralValu eInt8Value{7}},
3018 {"ServiceName", &mojom_types.LiteralValu eStringValue{"AwesomeService"}}, 3060 {"ServiceName", &mojom_types.LiteralValu eStringValue{"AwesomeService"}},
3019 {"Height", &mojom_types.LiteralValueDoub leValue{10.1}}}), 3061 {"Height", &mojom_types.LiteralValueDoub leValue{10.1}}}),
3020 ServiceName: stringPointer("AwesomeService"), 3062 ServiceName: stringPointer("AwesomeService"),
3021 Methods: map[uint32]mojom_types.MojomMethod{ 3063 Methods: map[uint32]mojom_types.MojomMethod{
3022 0: mojom_types.MojomMethod{ 3064 0: mojom_types.MojomMethod{
3023 » » » » » DeclData: newDeclData(test.fileNameA(), "DoIt", ""), 3065 » » » » » DeclData: newDeclDataO(0, -1, test.fileN ameA(), "DoIt", ""),
3024 Parameters: mojom_types.MojomStruct{ 3066 Parameters: mojom_types.MojomStruct{
3025 DeclData: newDeclData(test.fileN ameA(), "DoIt-request", ""), 3067 DeclData: newDeclData(test.fileN ameA(), "DoIt-request", ""),
3026 Fields: []mojom_types.StructFiel d{ 3068 Fields: []mojom_types.StructFiel d{
3027 mojom_types.StructField{ 3069 mojom_types.StructField{
3028 DeclData: newDec lDataO(0, -1, test.fileNameA(), "x", ""), 3070 DeclData: newDec lDataO(0, -1, test.fileNameA(), "x", ""),
3029 Type: &mojom_typ es.TypeTypeReference{mojom_types.TypeReference{ 3071 Type: &mojom_typ es.TypeTypeReference{mojom_types.TypeReference{
3030 false, f alse, stringPointer("FooA"), stringPointer("TYPE_KEY:a.b.c.FooA")}}, 3072 false, f alse, stringPointer("FooA"), stringPointer("TYPE_KEY:a.b.c.FooA")}},
3031 }, 3073 },
3032 }, 3074 },
3033 }, 3075 },
(...skipping 19 matching lines...) Expand all
3053 test.expectedRuntimeTypeInfoB().TypeMap["TYPE_KEY:b.c.d.FooB"] = &mojom_types.UserDefinedTypeStructType{mojom_types.MojomStruct{ 3095 test.expectedRuntimeTypeInfoB().TypeMap["TYPE_KEY:b.c.d.FooB"] = &mojom_types.UserDefinedTypeStructType{mojom_types.MojomStruct{
3054 DeclData: newDeclData(test.fileNameB(), "FooB", "b.c.d.F ooB"), 3096 DeclData: newDeclData(test.fileNameB(), "FooB", "b.c.d.F ooB"),
3055 Fields: []mojom_types.StructField{}}} 3097 Fields: []mojom_types.StructField{}}}
3056 3098
3057 // InterfaceB 3099 // InterfaceB
3058 test.expectedRuntimeTypeInfoB().TypeMap["TYPE_KEY:b.c.d.Interfac eB"] = &mojom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{ 3100 test.expectedRuntimeTypeInfoB().TypeMap["TYPE_KEY:b.c.d.Interfac eB"] = &mojom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{
3059 DeclData: newDeclDataA(test.fileNameB(), "InterfaceB", " b.c.d.InterfaceB", 3101 DeclData: newDeclDataA(test.fileNameB(), "InterfaceB", " b.c.d.InterfaceB",
3060 &[]mojom_types.Attribute{{"ServiceName", &mojom_ types.LiteralValueInt8Value{42}}}), 3102 &[]mojom_types.Attribute{{"ServiceName", &mojom_ types.LiteralValueInt8Value{42}}}),
3061 Methods: map[uint32]mojom_types.MojomMethod{ 3103 Methods: map[uint32]mojom_types.MojomMethod{
3062 0: mojom_types.MojomMethod{ 3104 0: mojom_types.MojomMethod{
3063 » » » » » DeclData: newDeclData(test.fileNameB(), "DoIt", ""), 3105 » » » » » DeclData: newDeclDataO(0, -1, test.fileN ameB(), "DoIt", ""),
3064 Parameters: mojom_types.MojomStruct{ 3106 Parameters: mojom_types.MojomStruct{
3065 DeclData: newDeclData(test.fileN ameB(), "DoIt-request", ""), 3107 DeclData: newDeclData(test.fileN ameB(), "DoIt-request", ""),
3066 Fields: []mojom_types.StructFiel d{ 3108 Fields: []mojom_types.StructFiel d{
3067 mojom_types.StructField{ 3109 mojom_types.StructField{
3068 DeclData: newDec lDataO(0, -1, test.fileNameB(), "x", ""), 3110 DeclData: newDec lDataO(0, -1, test.fileNameB(), "x", ""),
3069 Type: &mojom_typ es.TypeTypeReference{mojom_types.TypeReference{ 3111 Type: &mojom_typ es.TypeTypeReference{mojom_types.TypeReference{
3070 false, f alse, stringPointer("a.b.c.FooA"), stringPointer("TYPE_KEY:a.b.c.FooA")}}, 3112 false, f alse, stringPointer("a.b.c.FooA"), stringPointer("TYPE_KEY:a.b.c.FooA")}},
3071 }, 3113 },
3072 }, 3114 },
3073 }, 3115 },
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
3134 DeclData: newDeclData(test.fileNameA(), "FooA", "a.b.c.F ooA"), 3176 DeclData: newDeclData(test.fileNameA(), "FooA", "a.b.c.F ooA"),
3135 Fields: []mojom_types.StructField{}}} 3177 Fields: []mojom_types.StructField{}}}
3136 3178
3137 // InterfaceA 3179 // InterfaceA
3138 test.expectedRuntimeTypeInfoA().TypeMap["TYPE_KEY:a.b.c.Interfac eA"] = &mojom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{ 3180 test.expectedRuntimeTypeInfoA().TypeMap["TYPE_KEY:a.b.c.Interfac eA"] = &mojom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{
3139 DeclData: newDeclDataA(test.fileNameA(), "InterfaceA", " a.b.c.InterfaceA", 3181 DeclData: newDeclDataA(test.fileNameA(), "InterfaceA", " a.b.c.InterfaceA",
3140 &[]mojom_types.Attribute{{"ServiceName", &mojom_ types.LiteralValueStringValue{"AwesomeService"}}}), 3182 &[]mojom_types.Attribute{{"ServiceName", &mojom_ types.LiteralValueStringValue{"AwesomeService"}}}),
3141 ServiceName: stringPointer("AwesomeService"), 3183 ServiceName: stringPointer("AwesomeService"),
3142 Methods: map[uint32]mojom_types.MojomMethod{ 3184 Methods: map[uint32]mojom_types.MojomMethod{
3143 0: mojom_types.MojomMethod{ 3185 0: mojom_types.MojomMethod{
3144 » » » » » DeclData: newDeclData(test.fileNameA(), "DoIt", ""), 3186 » » » » » DeclData: newDeclDataO(0, -1, test.fileN ameA(), "DoIt", ""),
3145 Parameters: mojom_types.MojomStruct{ 3187 Parameters: mojom_types.MojomStruct{
3146 DeclData: newDeclData(test.fileN ameA(), "DoIt-request", ""), 3188 DeclData: newDeclData(test.fileN ameA(), "DoIt-request", ""),
3147 Fields: []mojom_types.StructFiel d{ 3189 Fields: []mojom_types.StructFiel d{
3148 mojom_types.StructField{ 3190 mojom_types.StructField{
3149 DeclData: newDec lDataO(0, -1, test.fileNameA(), "x", ""), 3191 DeclData: newDec lDataO(0, -1, test.fileNameA(), "x", ""),
3150 Type: &mojom_typ es.TypeTypeReference{mojom_types.TypeReference{ 3192 Type: &mojom_typ es.TypeTypeReference{mojom_types.TypeReference{
3151 false, f alse, stringPointer("FooA"), stringPointer("TYPE_KEY:a.b.c.FooA")}}, 3193 false, f alse, stringPointer("FooA"), stringPointer("TYPE_KEY:a.b.c.FooA")}},
3152 }, 3194 },
3153 }, 3195 },
3154 }, 3196 },
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3192 false, false, stringPointer("Enu m1"), stringPointer("TYPE_KEY:b.c.d.Enum1")}}, 3234 false, false, stringPointer("Enu m1"), stringPointer("TYPE_KEY:b.c.d.Enum1")}},
3193 }, 3235 },
3194 }, 3236 },
3195 }} 3237 }}
3196 3238
3197 // InterfaceB 3239 // InterfaceB
3198 test.expectedRuntimeTypeInfoB().TypeMap["TYPE_KEY:b.c.d.Interfac eB"] = &mojom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{ 3240 test.expectedRuntimeTypeInfoB().TypeMap["TYPE_KEY:b.c.d.Interfac eB"] = &mojom_types.UserDefinedTypeInterfaceType{mojom_types.MojomInterface{
3199 DeclData: newDeclData(test.fileNameB(), "InterfaceB", "b .c.d.InterfaceB"), 3241 DeclData: newDeclData(test.fileNameB(), "InterfaceB", "b .c.d.InterfaceB"),
3200 Methods: map[uint32]mojom_types.MojomMethod{ 3242 Methods: map[uint32]mojom_types.MojomMethod{
3201 0: mojom_types.MojomMethod{ 3243 0: mojom_types.MojomMethod{
3202 » » » » » DeclData: newDeclData(test.fileNameB(), "DoIt", ""), 3244 » » » » » DeclData: newDeclDataO(0, -1, test.fileN ameB(), "DoIt", ""),
3203 Parameters: mojom_types.MojomStruct{ 3245 Parameters: mojom_types.MojomStruct{
3204 DeclData: newDeclData(test.fileN ameB(), "DoIt-request", ""), 3246 DeclData: newDeclData(test.fileN ameB(), "DoIt-request", ""),
3205 Fields: []mojom_types.StructFiel d{ 3247 Fields: []mojom_types.StructFiel d{
3206 mojom_types.StructField{ 3248 mojom_types.StructField{
3207 DeclData: newDec lDataO(0, -1, test.fileNameB(), "x", ""), 3249 DeclData: newDec lDataO(0, -1, test.fileNameB(), "x", ""),
3208 Type: &mojom_typ es.TypeTypeReference{mojom_types.TypeReference{ 3250 Type: &mojom_typ es.TypeTypeReference{mojom_types.TypeReference{
3209 false, f alse, stringPointer("a.b.c.FooA"), stringPointer("TYPE_KEY:a.b.c.FooA")}}, 3251 false, f alse, stringPointer("a.b.c.FooA"), stringPointer("TYPE_KEY:a.b.c.FooA")}},
3210 }, 3252 },
3211 }, 3253 },
3212 }, 3254 },
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
3368 } 3410 }
3369 return fmt.Errorf("*****\nexpected=\n*****\n%q\n*****\na ctual=\n*****\n%q\n*****\n"+ 3411 return fmt.Errorf("*****\nexpected=\n*****\n%q\n*****\na ctual=\n*****\n%q\n*****\n"+
3370 "match failed at position %d: expected=\n*****\n %q\n******\nactual=\n*****\n%q\n******\n", 3412 "match failed at position %d: expected=\n*****\n %q\n******\nactual=\n*****\n%q\n******\n",
3371 expectedString, actualString, diffPos, mismatchE xpected, mismatchActual) 3413 expectedString, actualString, diffPos, mismatchE xpected, mismatchActual)
3372 } else { 3414 } else {
3373 return fmt.Errorf("expected != actual but the two printe d equal.") 3415 return fmt.Errorf("expected != actual but the two printe d equal.")
3374 } 3416 }
3375 } 3417 }
3376 return nil 3418 return nil
3377 } 3419 }
OLDNEW
« no previous file with comments | « mojom/mojom_parser/mojom/user_defined_types.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698