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

Unified Diff: mojo/public/tools/bindings/pylib/mojom/generate/mojom_translator_unittest.py

Issue 1847683004: Mojom compiler backend: Stop re-computing interface version numbers and consume method declaration o (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebasing. 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 | « mojo/public/tools/bindings/pylib/mojom/generate/mojom_translator.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/tools/bindings/pylib/mojom/generate/mojom_translator_unittest.py
diff --git a/mojo/public/tools/bindings/pylib/mojom/generate/mojom_translator_unittest.py b/mojo/public/tools/bindings/pylib/mojom/generate/mojom_translator_unittest.py
index 6dece45c5e19027437643ce792b1f832ebc43c62..03e20c7db449adf9e95ac2ab6198dd22d41138b1 100644
--- a/mojo/public/tools/bindings/pylib/mojom/generate/mojom_translator_unittest.py
+++ b/mojo/public/tools/bindings/pylib/mojom/generate/mojom_translator_unittest.py
@@ -582,6 +582,7 @@ class TestUserDefinedTypeFromMojom(unittest.TestCase):
def do_interface_test(self, specify_service_name):
file_name = 'a.mojom'
mojom_interface = mojom_types_mojom.MojomInterface(
+ current_version=47,
decl_data=mojom_types_mojom.DeclarationData(
short_name='AnInterface',
source_file_info=mojom_types_mojom.SourceFileInfo(
@@ -597,6 +598,7 @@ class TestUserDefinedTypeFromMojom(unittest.TestCase):
ordinal=10,
decl_data=mojom_types_mojom.DeclarationData(
short_name='AMethod10',
+ declaration_order=1,
source_file_info=mojom_types_mojom.SourceFileInfo(
file_name=file_name)),
parameters=mojom_types_mojom.MojomStruct(fields=[],
@@ -606,6 +608,7 @@ class TestUserDefinedTypeFromMojom(unittest.TestCase):
ordinal=0,
decl_data=mojom_types_mojom.DeclarationData(
short_name='AMethod0',
+ declaration_order=1,
source_file_info=mojom_types_mojom.SourceFileInfo(
file_name=file_name)),
parameters=mojom_types_mojom.MojomStruct(fields=[],
@@ -615,6 +618,7 @@ class TestUserDefinedTypeFromMojom(unittest.TestCase):
ordinal=7,
decl_data=mojom_types_mojom.DeclarationData(
short_name='AMethod7',
+ declaration_order=0,
source_file_info=mojom_types_mojom.SourceFileInfo(
file_name=file_name)),
parameters=mojom_types_mojom.MojomStruct(fields=[],
@@ -629,10 +633,13 @@ class TestUserDefinedTypeFromMojom(unittest.TestCase):
translator.InterfaceFromMojom(interface, mojom_types_mojom.UserDefinedType(
interface_type=mojom_interface))
+
self.assertEquals(translator._module, interface.module)
self.assertEquals('AnInterface', interface.name)
- self.assertEquals(0, interface.methods[0].ordinal)
- self.assertEquals(7, interface.methods[1].ordinal)
+ self.assertEquals(mojom_interface.current_version, interface.version)
+ # The methods should be ordered by declaration_order.
+ self.assertEquals(7, interface.methods[0].ordinal)
+ self.assertEquals(0, interface.methods[1].ordinal)
self.assertEquals(10, interface.methods[2].ordinal)
if specify_service_name:
self.assertEquals('test::TheInterface', interface.service_name)
@@ -645,6 +652,7 @@ class TestUserDefinedTypeFromMojom(unittest.TestCase):
file_name = 'a.mojom'
mojom_method = mojom_types_mojom.MojomMethod(
ordinal=10,
+ min_version=6,
decl_data=mojom_types_mojom.DeclarationData(
short_name='AMethod',
source_file_info=mojom_types_mojom.SourceFileInfo(
@@ -677,6 +685,7 @@ class TestUserDefinedTypeFromMojom(unittest.TestCase):
self.assertEquals(mojom_method.decl_data.short_name, method.name)
self.assertEquals(interface, method.interface)
self.assertEquals(mojom_method.ordinal, method.ordinal)
+ self.assertEquals(mojom_method.min_version, method.min_version)
self.assertIsNone(method.response_parameters)
self.assertEquals(
len(mojom_method.parameters.fields), len(method.parameters))
« no previous file with comments | « mojo/public/tools/bindings/pylib/mojom/generate/mojom_translator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698