| 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 from copy import deepcopy | 6 from copy import deepcopy |
| 7 import json | 7 import json |
| 8 import os | 8 import os |
| 9 import sys | 9 import sys |
| 10 import unittest | 10 import unittest |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 _FakeTemplateCache(), | 196 _FakeTemplateCache(), |
| 197 None) | 197 None) |
| 198 expected_list = [ | 198 expected_list = [ |
| 199 { 'title': 'Description', | 199 { 'title': 'Description', |
| 200 'content': [ | 200 'content': [ |
| 201 { 'text': 'a test api' } | 201 { 'text': 'a test api' } |
| 202 ] | 202 ] |
| 203 }, | 203 }, |
| 204 { 'title': 'Availability', | 204 { 'title': 'Availability', |
| 205 'content': [ | 205 'content': [ |
| 206 { 'partial': 'handlebar docs/templates/private/' + | 206 { 'partial': 'handlebar chrome/common/extensions/docs/' + |
| 207 'intro_tables/stable_message.html', | 207 'templates/private/intro_tables/stable_message.html', |
| 208 'version': 5 | 208 'version': 5 |
| 209 } | 209 } |
| 210 ] | 210 ] |
| 211 }, | 211 }, |
| 212 { 'title': 'Permissions', | 212 { 'title': 'Permissions', |
| 213 'content': [ | 213 'content': [ |
| 214 { 'class': 'override', | 214 { 'class': 'override', |
| 215 'text': '"tester"' | 215 'text': '"tester"' |
| 216 }, | 216 }, |
| 217 { 'text': 'is an API for testing things.' } | 217 { 'text': 'is an API for testing things.' } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 260 |
| 261 def testAddRules(self): | 261 def testAddRules(self): |
| 262 dict_ = _JSCModel(self._LoadJSON('add_rules_test.json')[0], | 262 dict_ = _JSCModel(self._LoadJSON('add_rules_test.json')[0], |
| 263 self._CreateRefResolver('test_file_data_source.json'), | 263 self._CreateRefResolver('test_file_data_source.json'), |
| 264 False, | 264 False, |
| 265 _FakeAvailabilityFinder(), | 265 _FakeAvailabilityFinder(), |
| 266 TestBranchUtility.CreateWithCannedData(), | 266 TestBranchUtility.CreateWithCannedData(), |
| 267 self._json_cache, | 267 self._json_cache, |
| 268 _FakeTemplateCache(), | 268 _FakeTemplateCache(), |
| 269 self._FakeLoadAddRulesSchema).ToDict() | 269 self._FakeLoadAddRulesSchema).ToDict() |
| 270 |
| 270 # Check that the first event has the addRulesFunction defined. | 271 # Check that the first event has the addRulesFunction defined. |
| 271 self.assertEquals('tester', dict_['name']) | 272 self.assertEquals('tester', dict_['name']) |
| 272 self.assertEquals('rules', dict_['events'][0]['name']) | 273 self.assertEquals('rules', dict_['events'][0]['name']) |
| 273 self.assertEquals('notable_name_to_check_for', | 274 self.assertEquals('notable_name_to_check_for', |
| 274 dict_['events'][0]['byName']['addRules'][ | 275 dict_['events'][0]['byName']['addRules'][ |
| 275 'parameters'][0]['name']) | 276 'parameters'][0]['name']) |
| 276 | 277 |
| 277 # Check that the second event has addListener defined. | 278 # Check that the second event has addListener defined. |
| 278 self.assertEquals('noRules', dict_['events'][1]['name']) | 279 self.assertEquals('noRules', dict_['events'][1]['name']) |
| 279 self.assertEquals('tester', dict_['name']) | 280 self.assertEquals('tester', dict_['name']) |
| 280 self.assertEquals('noRules', dict_['events'][1]['name']) | 281 self.assertEquals('noRules', dict_['events'][1]['name']) |
| 281 self.assertEquals('callback', | 282 self.assertEquals('callback', |
| 282 dict_['events'][0]['byName']['addListener'][ | 283 dict_['events'][0]['byName']['addListener'][ |
| 283 'parameters'][0]['name']) | 284 'parameters'][0]['name']) |
| 284 | 285 |
| 285 if __name__ == '__main__': | 286 if __name__ == '__main__': |
| 286 unittest.main() | 287 unittest.main() |
| OLD | NEW |