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

Side by Side Diff: mojo/python/tests/bindings_serialization_deserialization_unittest.py

Issue 570563002: mojo: Starting serialization for python bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Follow review Created 6 years, 3 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 | « mojo/public/tools/bindings/generators/python_templates/module.py.tmpl ('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
(Empty)
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import unittest
6
7 # pylint: disable=F0401
8 import mojo.system
9
10 # Generated files
11 # pylint: disable=F0401
12 import sample_service_mojom
13
14
15 def _NewHandle():
16 return mojo.system.MessagePipe().handle0
17
18 def _NewFoo():
19 foo_instance = sample_service_mojom.Foo()
20 foo_instance.name = "Foo.name"
21 foo_instance.x = 23
22 foo_instance.y = -23
23 foo_instance.a = False
24 foo_instance.b = True
25 foo_instance.c = True
26 foo_instance.bar = sample_service_mojom.Bar()
27 foo_instance.extra_bars = [
28 sample_service_mojom.Bar(),
29 sample_service_mojom.Bar()
30 ]
31 foo_instance.data = 'Hello world'
32 foo_instance.source = _NewHandle()
33 foo_instance.input_streams = [ _NewHandle() ]
34 foo_instance.output_streams = [ _NewHandle(), _NewHandle() ]
35 foo_instance.array_of_array_of_bools = [ [ True, False ], [] ]
36 foo_instance.multi_array_of_strings = [
37 [
38 [ "1", "2" ],
39 [],
40 [ "3", "4" ],
41 ],
42 [],
43 ]
44 foo_instance.array_of_bools = [ True, 0, 1, 2, 0 ]
45 return foo_instance
46
47 class SerializationDeserializationTest(unittest.TestCase):
48
49 def testFooSerialization(self):
50 (data, _) = _NewFoo().Serialize()
51 self.assertTrue(len(data))
52 self.assertEquals(len(data) % 8, 0)
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/generators/python_templates/module.py.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698