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

Unified Diff: third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/generator_unittest.py

Issue 1101303002: Update mojo sdk to rev e7270700d671fa8e458b4d8c9e47f7bcfb65da0b (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Actualy provide a default TaskTracker impl Created 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/generator_unittest.py
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/generator_unittest.py b/third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/generator_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..9966b0b7f8f53bdb2660d2cf001e817146e2eefa
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/generator_unittest.py
@@ -0,0 +1,24 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import unittest
+
+import module as mojom
+import generator
+
+class TestGenerator(unittest.TestCase):
+
+ def testGetUnionsAddsOrdinals(self):
+ module = mojom.Module()
+ union = module.AddUnion('a')
+ union.AddField('a', mojom.BOOL)
+ union.AddField('b', mojom.BOOL)
+ union.AddField('c', mojom.BOOL, ordinal=10)
+ union.AddField('d', mojom.BOOL)
+
+ gen = generator.Generator(module)
+ union = gen.GetUnions()[0]
+ ordinals = [field.ordinal for field in union.fields]
+
+ self.assertEquals([0, 1, 10, 11], ordinals)

Powered by Google App Engine
This is Rietveld 408576698