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

Side by Side Diff: chrome/common/extensions/docs/server2/api_data_source_test.py

Issue 26538009: Docserver: make file_system a property of Create (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: niggles Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 def get(self, key): 71 def get(self, key):
72 return 'handlebar %s' % key 72 return 'handlebar %s' % key
73 73
74 74
75 class APIDataSourceTest(unittest.TestCase): 75 class APIDataSourceTest(unittest.TestCase):
76 76
77 def setUp(self): 77 def setUp(self):
78 self._base_path = os.path.join(sys.path[0], 'test_data', 'test_json') 78 self._base_path = os.path.join(sys.path[0], 'test_data', 'test_json')
79 self._compiled_fs_factory = CompiledFileSystem.Factory( 79 self._compiled_fs_factory = CompiledFileSystem.Factory(
80 TestFileSystem(CANNED_TEST_FILE_SYSTEM_DATA),
81 ObjectStoreCreator.ForTest()) 80 ObjectStoreCreator.ForTest())
82 self._json_cache = self._compiled_fs_factory.Create( 81 self._json_cache = self._compiled_fs_factory.Create(
82 TestFileSystem(CANNED_TEST_FILE_SYSTEM_DATA),
83 lambda _, json: json_parse.Parse(json), 83 lambda _, json: json_parse.Parse(json),
84 APIDataSourceTest, 84 APIDataSourceTest,
85 'test') 85 'test')
86 86
87 def _ReadLocalFile(self, filename): 87 def _ReadLocalFile(self, filename):
88 with open(os.path.join(self._base_path, filename), 'r') as f: 88 with open(os.path.join(self._base_path, filename), 'r') as f:
89 return f.read() 89 return f.read()
90 90
91 def _CreateRefResolver(self, filename): 91 def _CreateRefResolver(self, filename):
92 data_source = FakeAPIAndListDataSource( 92 data_source = FakeAPIAndListDataSource(
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 self.assertFalse('addRulesFunction' in dict_['events'][1]) 388 self.assertFalse('addRulesFunction' in dict_['events'][1])
389 # But addListener should be defined. 389 # But addListener should be defined.
390 self.assertEquals('tester', dict_['name']) 390 self.assertEquals('tester', dict_['name'])
391 self.assertEquals('noRules', dict_['events'][1]['name']) 391 self.assertEquals('noRules', dict_['events'][1]['name'])
392 self.assertEquals('callback', 392 self.assertEquals('callback',
393 dict_['events'][0]['addListenerFunction'][ 393 dict_['events'][0]['addListenerFunction'][
394 'parameters'][0]['name']) 394 'parameters'][0]['name'])
395 395
396 if __name__ == '__main__': 396 if __name__ == '__main__':
397 unittest.main() 397 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698