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

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

Issue 1819223002: Mojom frontend: Allow non-reference types in non-zero versions of a struct. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 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
« no previous file with comments | « mojom/mojom_parser/parser/computed_data_test.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 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after
1955 1955
1956 struct MyStruct1 { 1956 struct MyStruct1 {
1957 int8 x; 1957 int8 x;
1958 MyUnion1 my_union; 1958 MyUnion1 my_union;
1959 MyStruct1 my_struct; 1959 MyStruct1 my_struct;
1960 1960
1961 [MinVersion=1] 1961 [MinVersion=1]
1962 MyInterface1&? my_interface_request; 1962 MyInterface1&? my_interface_request;
1963 1963
1964 [MinVersion=2] 1964 [MinVersion=2]
1965 » handle? y; 1965 » int32 y;
1966 1966
1967 [MinVersion=2] 1967 [MinVersion=2]
1968 MyInterface1? my_interface; 1968 MyInterface1? my_interface;
1969 };` 1969 };`
1970 1970
1971 test.addTestCase("", contents) 1971 test.addTestCase("", contents)
1972 1972
1973 test.expectedFile().DeclaredMojomObjects.Unions = &[]string{"TYP E_KEY:MyUnion1"} 1973 test.expectedFile().DeclaredMojomObjects.Unions = &[]string{"TYP E_KEY:MyUnion1"}
1974 test.expectedFile().DeclaredMojomObjects.Interfaces = &[]string{ "TYPE_KEY:MyInterface1"} 1974 test.expectedFile().DeclaredMojomObjects.Interfaces = &[]string{ "TYPE_KEY:MyInterface1"}
1975 test.expectedFile().DeclaredMojomObjects.Structs = &[]string{"TY PE_KEY:MyStruct1"} 1975 test.expectedFile().DeclaredMojomObjects.Structs = &[]string{"TY PE_KEY:MyStruct1"}
(...skipping 28 matching lines...) Expand all
2004 { 2004 {
2005 DeclData: test.newShortDeclDataAO(3, -1, "my_interface_request", &[]mojom_types.Attribute{{"MinVersion", &mojom_types.Li teralValueInt8Value{1}}}), 2005 DeclData: test.newShortDeclDataAO(3, -1, "my_interface_request", &[]mojom_types.Attribute{{"MinVersion", &mojom_types.Li teralValueInt8Value{1}}}),
2006 Type: &mojom_types.TypeTypeReference{moj om_types.TypeReference{ 2006 Type: &mojom_types.TypeTypeReference{moj om_types.TypeReference{
2007 true, true, stringPointer("MyInt erface1"), stringPointer("TYPE_KEY:MyInterface1")}}, 2007 true, true, stringPointer("MyInt erface1"), stringPointer("TYPE_KEY:MyInterface1")}},
2008 Offset: 4, 2008 Offset: 4,
2009 MinVersion: 1, 2009 MinVersion: 1,
2010 }, 2010 },
2011 // field y 2011 // field y
2012 { 2012 {
2013 DeclData: test.newShortDeclDataAO(4, - 1, "y", &[]mojom_types.Attribute{{"MinVersion", &mojom_types.LiteralValueInt8Val ue{2}}}), 2013 DeclData: test.newShortDeclDataAO(4, - 1, "y", &[]mojom_types.Attribute{{"MinVersion", &mojom_types.LiteralValueInt8Val ue{2}}}),
2014 » » » » » Type: &mojom_types.TypeHandleType{ mojom_types.HandleType{Nullable: true}}, 2014 » » » » » Type: &mojom_types.TypeSimpleType{ mojom_types.SimpleType_Int32},
2015 Offset: 32, 2015 Offset: 32,
2016 MinVersion: 2, 2016 MinVersion: 2,
2017 }, 2017 },
2018 // field my_interface 2018 // field my_interface
2019 { 2019 {
2020 DeclData: test.newShortDeclDataAO(5, -1, "my_interface", &[]mojom_types.Attribute{{"MinVersion", &mojom_types.LiteralVal ueInt8Value{2}}}), 2020 DeclData: test.newShortDeclDataAO(5, -1, "my_interface", &[]mojom_types.Attribute{{"MinVersion", &mojom_types.LiteralVal ueInt8Value{2}}}),
2021 Type: &mojom_types.TypeTypeReference{moj om_types.TypeReference{ 2021 Type: &mojom_types.TypeTypeReference{moj om_types.TypeReference{
2022 true, false, stringPointer("MyIn terface1"), stringPointer("TYPE_KEY:MyInterface1")}}, 2022 true, false, stringPointer("MyIn terface1"), stringPointer("TYPE_KEY:MyInterface1")}},
2023 Offset: 36, 2023 Offset: 36,
2024 MinVersion: 2, 2024 MinVersion: 2,
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after
3185 } 3185 }
3186 return fmt.Errorf("*****\nexpected=\n*****\n%q\n*****\na ctual=\n*****\n%q\n*****\n"+ 3186 return fmt.Errorf("*****\nexpected=\n*****\n%q\n*****\na ctual=\n*****\n%q\n*****\n"+
3187 "match failed at position %d: expected=\n*****\n %q\n******\nactual=\n*****\n%q\n******\n", 3187 "match failed at position %d: expected=\n*****\n %q\n******\nactual=\n*****\n%q\n******\n",
3188 expectedString, actualString, diffPos, mismatchE xpected, mismatchActual) 3188 expectedString, actualString, diffPos, mismatchE xpected, mismatchActual)
3189 } else { 3189 } else {
3190 return fmt.Errorf("expected != actual but the two printe d equal.") 3190 return fmt.Errorf("expected != actual but the two printe d equal.")
3191 } 3191 }
3192 } 3192 }
3193 return nil 3193 return nil
3194 } 3194 }
OLDNEW
« no previous file with comments | « mojom/mojom_parser/parser/computed_data_test.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698