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

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

Issue 176973009: Doc server: support interfaces in src/extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 6 years, 9 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 os 6 import os
7 import posixpath 7 import posixpath
8 import sys 8 import sys
9 import unittest 9 import unittest
10 from appengine_url_fetcher import AppEngineUrlFetcher 10 from appengine_url_fetcher import AppEngineUrlFetcher
11 from extensions_paths import ( 11 from extensions_paths import (
12 ARTICLES_TEMPLATES, EXTENSIONS, DOCS, JSON_TEMPLATES, PUBLIC_TEMPLATES) 12 ARTICLES_TEMPLATES, CHROME_EXTENSIONS, DOCS, JSON_TEMPLATES,
13 PUBLIC_TEMPLATES)
13 from fake_fetchers import ConfigureFakeFetchers 14 from fake_fetchers import ConfigureFakeFetchers
14 from file_system import FileNotFoundError 15 from file_system import FileNotFoundError
15 from rietveld_patcher import RietveldPatcher 16 from rietveld_patcher import RietveldPatcher
16 from test_util import Server2Path 17 from test_util import Server2Path
17 import url_constants 18 import url_constants
18 19
19 20
20 def _PrefixWith(prefix, lst): 21 def _PrefixWith(prefix, lst):
21 return [posixpath.join(prefix, item) for item in lst] 22 return [posixpath.join(prefix, item) for item in lst]
22 23
(...skipping 22 matching lines...) Expand all
45 added, deleted, modified = self._patcher.GetPatchedFiles() 46 added, deleted, modified = self._patcher.GetPatchedFiles()
46 self.assertEqual( 47 self.assertEqual(
47 sorted(added), 48 sorted(added),
48 _PrefixWith(DOCS, ['examples/test', 49 _PrefixWith(DOCS, ['examples/test',
49 'templates/articles/test_foo.html', 50 'templates/articles/test_foo.html',
50 'templates/public/extensions/test_foo.html'])) 51 'templates/public/extensions/test_foo.html']))
51 self.assertEqual(deleted, 52 self.assertEqual(deleted,
52 ['%sextensions/runtime.html' % PUBLIC_TEMPLATES]) 53 ['%sextensions/runtime.html' % PUBLIC_TEMPLATES])
53 self.assertEqual( 54 self.assertEqual(
54 sorted(modified), 55 sorted(modified),
55 _PrefixWith(EXTENSIONS, ['api/test.json', 56 _PrefixWith(CHROME_EXTENSIONS,
56 'docs/templates/json/extensions_sidenav.json', 57 ['api/test.json',
57 'manifest.h'])) 58 'docs/templates/json/extensions_sidenav.json',
59 'manifest.h']))
58 60
59 def testApply(self): 61 def testApply(self):
60 article_path = '%stest_foo.html' % ARTICLES_TEMPLATES 62 article_path = '%stest_foo.html' % ARTICLES_TEMPLATES
61 63
62 # Apply to an added file. 64 # Apply to an added file.
63 self.assertEqual( 65 self.assertEqual(
64 self._ReadLocalFile('test_foo.html'), 66 self._ReadLocalFile('test_foo.html'),
65 self._ApplySingle('%sextensions/test_foo.html' % PUBLIC_TEMPLATES)) 67 self._ApplySingle('%sextensions/test_foo.html' % PUBLIC_TEMPLATES))
66 68
67 # Apply to a modified file. 69 # Apply to a modified file.
68 self.assertEqual( 70 self.assertEqual(
69 self._ReadLocalFile('extensions_sidenav.json'), 71 self._ReadLocalFile('extensions_sidenav.json'),
70 self._ApplySingle('%sextensions_sidenav.json' % JSON_TEMPLATES)) 72 self._ApplySingle('%sextensions_sidenav.json' % JSON_TEMPLATES))
71 73
72 # Applying to a deleted file doesn't throw exceptions. It just returns 74 # Applying to a deleted file doesn't throw exceptions. It just returns
73 # empty content. 75 # empty content.
74 # self.assertRaises(FileNotFoundError, self._ApplySingle, 76 # self.assertRaises(FileNotFoundError, self._ApplySingle,
75 # 'docs/templates/public/extensions/runtime.html') 77 # 'docs/templates/public/extensions/runtime.html')
76 78
77 # Apply to an unknown file. 79 # Apply to an unknown file.
78 self.assertRaises(FileNotFoundError, self._ApplySingle, 'not_existing') 80 self.assertRaises(FileNotFoundError, self._ApplySingle, 'not_existing')
79 81
80 if __name__ == '__main__': 82 if __name__ == '__main__':
81 unittest.main() 83 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698