OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import math | 5 import math |
6 | 6 |
7 import mojo_unittest | 7 import mojo_unittest |
8 | 8 |
9 # pylint: disable=E0611,F0401 | 9 # pylint: disable=E0611,F0401 |
10 import mojo.bindings.serialization as serialization | 10 import mojo_bindings.serialization as serialization |
11 import mojo.system | 11 import mojo_system |
12 | 12 |
13 # Generated files | 13 # Generated files |
14 # pylint: disable=F0401 | 14 # pylint: disable=F0401 |
15 import sample_import_mojom | 15 import sample_import_mojom |
16 import sample_import2_mojom | 16 import sample_import2_mojom |
17 import sample_service_mojom | 17 import sample_service_mojom |
18 | 18 |
19 | 19 |
20 def _NewHandle(): | 20 def _NewHandle(): |
21 return mojo.system.MessagePipe().handle0 | 21 return mojo_system.MessagePipe().handle0 |
22 | 22 |
23 | 23 |
24 def _NewBar(): | 24 def _NewBar(): |
25 bar_instance = sample_service_mojom.Bar() | 25 bar_instance = sample_service_mojom.Bar() |
26 bar_instance.alpha = 22 | 26 bar_instance.alpha = 22 |
27 bar_instance.beta = 87 | 27 bar_instance.beta = 87 |
28 bar_instance.gamma = 122 | 28 bar_instance.gamma = 122 |
29 bar_instance.type = sample_service_mojom.Bar.Type.BOTH | 29 bar_instance.type = sample_service_mojom.Bar.Type.BOTH |
30 return bar_instance | 30 return bar_instance |
31 | 31 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 # NaN needs to be a special case. | 93 # NaN needs to be a special case. |
94 self.assertNotEquals(v1, v2) | 94 self.assertNotEquals(v1, v2) |
95 self.assertTrue(math.isnan(v2.a28)) | 95 self.assertTrue(math.isnan(v2.a28)) |
96 self.assertTrue(math.isnan(v2.a31)) | 96 self.assertTrue(math.isnan(v2.a31)) |
97 v1.a28 = v2.a28 = v1.a31 = v2.a31 = 0 | 97 v1.a28 = v2.a28 = v1.a31 = v2.a31 = 0 |
98 self.assertEquals(v1, v2) | 98 self.assertEquals(v1, v2) |
99 | 99 |
100 def testFooDeserializationError(self): | 100 def testFooDeserializationError(self): |
101 with self.assertRaises(Exception): | 101 with self.assertRaises(Exception): |
102 sample_service_mojom.Foo.Deserialize("", []) | 102 sample_service_mojom.Foo.Deserialize("", []) |
OLD | NEW |