Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / common / extensions / docs / server2 / file_system_test.py
blobdc2d8364df15842ec24d16679ae335756f822469
1 #!/usr/bin/env python
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
4 # found in the LICENSE file.
6 import unittest
8 from test_file_system import TestFileSystem
10 file_system = TestFileSystem({
11 'templates': {
12 'public': {
13 'apps': {
14 '404.html': '',
15 'a11y.html': ''
17 'extensions': {
18 '404.html': '',
19 'cookies.html': ''
21 'redirects.json': 'redirect'
23 'json': {
24 'manifest.json': 'manifest'
29 class FileSystemTest(unittest.TestCase):
30 def testWalk(self):
31 expected_files = set([
32 'templates/public/apps/404.html',
33 'templates/public/apps/a11y.html',
34 'templates/public/extensions/404.html',
35 'templates/public/extensions/cookies.html',
36 'templates/public/redirects.json',
37 'templates/json/manifest.json'
40 expected_dirs = set([
41 '/templates/',
42 'templates/public/',
43 'templates/public/apps/',
44 'templates/public/extensions/',
45 'templates/json/'
48 all_files = set()
49 all_dirs = set()
50 for root, dirs, files in file_system.Walk(''):
51 all_files.update(root + '/' + name for name in files)
52 all_dirs.update(root + '/' + name for name in dirs)
54 self.assertEqual(expected_files, all_files)
55 self.assertEqual(expected_dirs, all_dirs)
57 def testSubWalk(self):
58 expected_files = set([
59 '/redirects.json',
60 'apps/404.html',
61 'apps/a11y.html',
62 'extensions/404.html',
63 'extensions/cookies.html'
66 all_files = set()
67 for root, dirs, files in file_system.Walk('templates/public'):
68 all_files.update(root + '/' + name for name in files)
70 self.assertEqual(expected_files, all_files)
72 if __name__ == '__main__':
73 unittest.main()