| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import idl_schema | 6 import idl_schema |
| 7 import unittest | 7 import unittest |
| 8 | 8 |
| 9 from json_parse import OrderedDict | 9 from json_parse import OrderedDict |
| 10 | 10 |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 'type': 'function', 'name': 'callback', 'parameters': [{ | 384 'type': 'function', 'name': 'callback', 'parameters': [{ |
| 385 'name': 'x', 'optional': True, 'choices': [ | 385 'name': 'x', 'optional': True, 'choices': [ |
| 386 {'type': 'integer'}, | 386 {'type': 'integer'}, |
| 387 {'type': 'string'} | 387 {'type': 'string'} |
| 388 ] | 388 ] |
| 389 }] | 389 }] |
| 390 }] | 390 }] |
| 391 | 391 |
| 392 self.assertEquals(expected, badabish_params) | 392 self.assertEquals(expected, badabish_params) |
| 393 | 393 |
| 394 def testProperties(self): |
| 395 schema = idl_schema.Load('test/idl_properties.idl')[0] |
| 396 self.assertEquals(OrderedDict([ |
| 397 ('first', OrderedDict([ |
| 398 ('description', 'Integer property.'), |
| 399 ('type', 'integer'), |
| 400 ('value', 42), |
| 401 ])), |
| 402 ('second', OrderedDict([ |
| 403 ('description', 'Double property.'), |
| 404 ('type', 'number'), |
| 405 ('value', 42.0), |
| 406 ])), |
| 407 ('third', OrderedDict([ |
| 408 ('description', 'String property.'), |
| 409 ('type', 'string'), |
| 410 ('value', 'hello world'), |
| 411 ])), |
| 412 ('fourth', OrderedDict([ |
| 413 ('description', 'Unvalued property.'), |
| 414 ('type', 'integer'), |
| 415 ])), |
| 416 ]), schema.get('properties')) |
| 417 |
| 394 | 418 |
| 395 if __name__ == '__main__': | 419 if __name__ == '__main__': |
| 396 unittest.main() | 420 unittest.main() |
| OLD | NEW |