| 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 import unittest | 6 import unittest |
| 7 | 7 |
| 8 # pylint: disable=E0611,F0401 | 8 # pylint: disable=E0611,F0401 |
| 9 import mojo.system | 9 import mojo_system |
| 10 | 10 |
| 11 # Generated files | 11 # Generated files |
| 12 # pylint: disable=F0401 | 12 # pylint: disable=F0401 |
| 13 import regression_tests_mojom | 13 import regression_tests_mojom |
| 14 import sample_import_mojom | 14 import sample_import_mojom |
| 15 import sample_import2_mojom | 15 import sample_import2_mojom |
| 16 import sample_service_mojom | 16 import sample_service_mojom |
| 17 | 17 |
| 18 | 18 |
| 19 class StructBindingsTest(unittest.TestCase): | 19 class StructBindingsTest(unittest.TestCase): |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 defaults_test.a21 = None | 154 defaults_test.a21 = None |
| 155 defaults_test.a21 = sample_import_mojom.Point() | 155 defaults_test.a21 = sample_import_mojom.Point() |
| 156 with self.assertRaises(TypeError): | 156 with self.assertRaises(TypeError): |
| 157 defaults_test.a21 = 1 | 157 defaults_test.a21 = 1 |
| 158 with self.assertRaises(TypeError): | 158 with self.assertRaises(TypeError): |
| 159 defaults_test.a21 = sample_import2_mojom.Thing() | 159 defaults_test.a21 = sample_import2_mojom.Thing() |
| 160 | 160 |
| 161 # Handles | 161 # Handles |
| 162 foo_instance = sample_service_mojom.Foo() | 162 foo_instance = sample_service_mojom.Foo() |
| 163 foo_instance.source = None | 163 foo_instance.source = None |
| 164 foo_instance.source = mojo.system.Handle() | 164 foo_instance.source = mojo_system.Handle() |
| 165 with self.assertRaises(TypeError): | 165 with self.assertRaises(TypeError): |
| 166 foo_instance.source = 1 | 166 foo_instance.source = 1 |
| 167 with self.assertRaises(TypeError): | 167 with self.assertRaises(TypeError): |
| 168 foo_instance.source = object() | 168 foo_instance.source = object() |
| 169 | 169 |
| 170 def testConstructor(self): | 170 def testConstructor(self): |
| 171 bar_instance = sample_service_mojom.Bar() | 171 bar_instance = sample_service_mojom.Bar() |
| 172 foo_instance = sample_service_mojom.Foo(name="Foo", | 172 foo_instance = sample_service_mojom.Foo(name="Foo", |
| 173 x=-1, | 173 x=-1, |
| 174 y=5, | 174 y=5, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 with self.assertRaises(TypeError): | 208 with self.assertRaises(TypeError): |
| 209 p = sample_import_mojom.Point(c=0) | 209 p = sample_import_mojom.Point(c=0) |
| 210 | 210 |
| 211 def testCyclicDefinition(self): | 211 def testCyclicDefinition(self): |
| 212 a = regression_tests_mojom.A() | 212 a = regression_tests_mojom.A() |
| 213 b = regression_tests_mojom.B() | 213 b = regression_tests_mojom.B() |
| 214 self.assertIsNone(a.b) | 214 self.assertIsNone(a.b) |
| 215 self.assertIsNone(b.a) | 215 self.assertIsNone(b.a) |
| 216 a.b = b | 216 a.b = b |
| 217 self.assertIs(a.b, b) | 217 self.assertIs(a.b, b) |
| OLD | NEW |