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

Unified Diff: mojom/mojom_parser/serialization/serialization_test.go

Issue 1786543002: Mojom parser: Stop populating the complete_typeset field. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojom/mojom_parser/serialization/serialization.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojom/mojom_parser/serialization/serialization_test.go
diff --git a/mojom/mojom_parser/serialization/serialization_test.go b/mojom/mojom_parser/serialization/serialization_test.go
index d97459b99421ea0bc93df3ca816414bb26f07b76..277a157dca424fa07ed2faa1fff8880d44ff3b6a 100644
--- a/mojom/mojom_parser/serialization/serialization_test.go
+++ b/mojom/mojom_parser/serialization/serialization_test.go
@@ -1007,14 +1007,14 @@ func TestSingleFileSerialization(t *testing.T) {
}
// Serialize
- bytes, _, err := serialize(descriptor, false, c.lineAndcolumnNumbers, false)
+ bytes, _, err := serialize(descriptor, false, c.lineAndcolumnNumbers, false, false)
if err != nil {
t.Errorf("Serialization error for %s: %s", c.fileName, err.Error())
continue
}
// Serialize again and check for consistency.
- bytes2, _, err := serialize(descriptor, false, c.lineAndcolumnNumbers, false)
+ bytes2, _, err := serialize(descriptor, false, c.lineAndcolumnNumbers, false, false)
if err != nil {
t.Errorf("Serialization error for %s: %s", c.fileName, err.Error())
continue
@@ -1111,7 +1111,7 @@ func TestMetaDataOnlyMode(t *testing.T) {
}
// Serialize
- bytes, _, err := serialize(descriptor, false, c.lineAndcolumnNumbers, false)
+ bytes, _, err := serialize(descriptor, false, c.lineAndcolumnNumbers, false, false)
if err != nil {
t.Errorf("Serialization error for %s: %s", c.fileName, err.Error())
continue
@@ -1390,7 +1390,7 @@ func TestTwoFileSerialization(t *testing.T) {
}
// Serialize
- bytes, _, err := serialize(descriptor, false, c.lineAndcolumnNumbers, false)
+ bytes, _, err := serialize(descriptor, false, c.lineAndcolumnNumbers, false, false)
if err != nil {
t.Errorf("Serialization error for case %d: %s", i, err.Error())
continue
@@ -2014,7 +2014,7 @@ func TestRuntimeTypeInfo(t *testing.T) {
}
// Serialize
- bytes, _, err := serialize(descriptor, false, false, true)
+ bytes, _, err := serialize(descriptor, false, false, true, true)
if err != nil {
t.Errorf("Serialization error for case %d: %s", i, err.Error())
continue
@@ -2040,6 +2040,28 @@ func TestRuntimeTypeInfo(t *testing.T) {
if err := compareTwoGoObjects(c.expectedRuntimeTypeInfoB, &runtimeTypeInfoB); err != nil {
t.Errorf("case %d B:\n%s", i, err.Error())
}
+
+ // Test the parameter populateCompleteTypeSet. We set the final
+ // parameter to false.
+ bytes, _, err = serialize(descriptor, false, false, true, false)
+ if err != nil {
+ t.Errorf("Serialization error for case %d: %s", i, err.Error())
+ continue
+ }
+
+ // Deserialize
+ decoder = bindings.NewDecoder(bytes, nil)
+ fileGraph = mojom_files.MojomFileGraph{}
+ fileGraph.Decode(decoder)
+ runtimeTypeInfoA = deserializeRuntimeTypeInfo(*fileGraph.Files[fileNameA].SerializedRuntimeTypeInfo)
+
+ // Check that CompleteTypeSet has not been populated for any service.
+ for name, service := range runtimeTypeInfoA.ServicesByName {
+ length := len(service.CompleteTypeSet)
+ if length != 0 {
+ t.Errorf("len(CompleteTypeSet)=%d for service=%q", length, name)
+ }
+ }
}
}
« no previous file with comments | « mojom/mojom_parser/serialization/serialization.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698