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

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

Issue 15087006: Docserver: there is only one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: epic rebase Created 7 years, 5 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 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 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 unittest 6 import unittest
7 from caching_rietveld_patcher import (CachingRietveldPatcher, 7 from caching_rietveld_patcher import (CachingRietveldPatcher,
8 _VERSION_CACHE_MAXAGE) 8 _VERSION_CACHE_MAXAGE)
9 from datetime import datetime 9 from datetime import datetime
10 from file_system import FileNotFoundError 10 from file_system import FileNotFoundError
(...skipping 19 matching lines...) Expand all
30 class CachingRietveldPatcherTest(unittest.TestCase): 30 class CachingRietveldPatcherTest(unittest.TestCase):
31 def setUp(self): 31 def setUp(self):
32 self._datetime = FakeDateTime() 32 self._datetime = FakeDateTime()
33 # CachingRietveldPatcher should always call Apply with binary=True. 33 # CachingRietveldPatcher should always call Apply with binary=True.
34 self._test_patcher = TestPatcher(_TEST_PATCH_VERSION, 34 self._test_patcher = TestPatcher(_TEST_PATCH_VERSION,
35 _TEST_PATCH_FILES, 35 _TEST_PATCH_FILES,
36 _TEST_PATCH_DATA, 36 _TEST_PATCH_DATA,
37 assert_binary=True) 37 assert_binary=True)
38 self._patcher = CachingRietveldPatcher( 38 self._patcher = CachingRietveldPatcher(
39 self._test_patcher, 39 self._test_patcher,
40 ObjectStoreCreator('test', start_empty=False), 40 ObjectStoreCreator(start_empty=False),
41 self._datetime) 41 self._datetime)
42 42
43 def testGetVersion(self): 43 def testGetVersion(self):
44 # Invalidate cache. 44 # Invalidate cache.
45 self._datetime.time += _VERSION_CACHE_MAXAGE 45 self._datetime.time += _VERSION_CACHE_MAXAGE
46 # Fill cache. 46 # Fill cache.
47 self._patcher.GetVersion() 47 self._patcher.GetVersion()
48 count = self._test_patcher.get_version_count 48 count = self._test_patcher.get_version_count
49 # Should read from cache. 49 # Should read from cache.
50 self._patcher.GetVersion() 50 self._patcher.GetVersion()
(...skipping 23 matching lines...) Expand all
74 # Make sure RietveldPatcher handles |binary| correctly. 74 # Make sure RietveldPatcher handles |binary| correctly.
75 self.assertTrue(isinstance(self._patcher.Apply(['add.txt'], None, True). 75 self.assertTrue(isinstance(self._patcher.Apply(['add.txt'], None, True).
76 Get()['add.txt'], str), 76 Get()['add.txt'], str),
77 'Expected result is binary. It was text.') 77 'Expected result is binary. It was text.')
78 self.assertTrue(isinstance(self._patcher.Apply(['add.txt'], None). 78 self.assertTrue(isinstance(self._patcher.Apply(['add.txt'], None).
79 Get()['add.txt'], unicode), 79 Get()['add.txt'], unicode),
80 'Expected result is text. It was binary.') 80 'Expected result is text. It was binary.')
81 81
82 if __name__ == '__main__': 82 if __name__ == '__main__':
83 unittest.main() 83 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698