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

Unified Diff: mojo/public/tools/bindings/pylib/mojom_tests/generate/data_unittest.py

Issue 795593004: Update mojo sdk to rev cc531b32182099a5a034a99daff35ed5d38a61c8 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More workarounds for MSVC Created 6 years 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
Index: mojo/public/tools/bindings/pylib/mojom_tests/generate/data_unittest.py
diff --git a/mojo/public/tools/bindings/pylib/mojom_tests/generate/data_unittest.py b/mojo/public/tools/bindings/pylib/mojom_tests/generate/data_unittest.py
index 3ca4f2a2fa304a2f8cbc4703c3020ea1be025571..9ad63c1332150fad56029b61d26ab1f7f89f3f27 100644
--- a/mojo/public/tools/bindings/pylib/mojom_tests/generate/data_unittest.py
+++ b/mojo/public/tools/bindings/pylib/mojom_tests/generate/data_unittest.py
@@ -119,7 +119,10 @@ class DataTest(unittest.TestCase):
map_kind = mojom.Map(mojom.INT16, mojom.INT16)
imported_module.kinds[map_kind.spec] = map_kind
- interface_req = mojom.InterfaceRequest(mojom.INT16)
+ interface = mojom.Interface('TestInterface', module=module)
+ imported_module.kinds[interface.spec] = interface
+
+ interface_req = mojom.InterfaceRequest(interface)
imported_module.kinds[interface_req.spec] = interface_req
data.ImportFromData(module, imported_data)
@@ -127,3 +130,16 @@ class DataTest(unittest.TestCase):
self.assertNotIn(array.spec, module.kinds)
self.assertNotIn(map_kind.spec, module.kinds)
self.assertNotIn(interface_req.spec, module.kinds)
+
+ def testNonInterfaceAsInterfaceRequest(self):
+ """Tests that a non-interface cannot be used for interface requests."""
+ module = mojom.Module('test_module', 'test_namespace')
+ interface = mojom.Interface('TestInterface', module=module)
+ method_dict = {
+ 'name': 'Foo',
+ 'parameters': [{'name': 'foo', 'kind': 'r:i32'}],
+ }
+ with self.assertRaises(Exception) as e:
+ data.MethodFromData(module, method_dict, interface)
+ self.assertEquals(e.exception.__str__(),
+ 'Interface request requires \'i32\' to be an interface.')

Powered by Google App Engine
This is Rietveld 408576698