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

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

Issue 139303023: add GCS support to docs server (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated third party library, rebased and fixed a path issue caused by rebasing Created 6 years, 10 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
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 json 6 import json
7 import unittest 7 import unittest
8 8
9 from compiled_file_system import CompiledFileSystem 9 from compiled_file_system import CompiledFileSystem
10 from content_providers import ContentProviders 10 from content_providers import ContentProviders
11 from extensions_paths import EXTENSIONS 11 from extensions_paths import EXTENSIONS
12 from gcs_file_system_provider import CloudStorageFileSystemProvider
12 from object_store_creator import ObjectStoreCreator 13 from object_store_creator import ObjectStoreCreator
13 from test_file_system import TestFileSystem 14 from test_file_system import TestFileSystem
14 from test_util import DisableLogging 15 from test_util import DisableLogging
15 16
16 17
17 _CONTENT_PROVIDERS = { 18 _CONTENT_PROVIDERS = {
18 'apples': { 19 'apples': {
19 'chromium': { 20 'chromium': {
20 'dir': 'chrome/common/extensions/apples' 21 'dir': 'chrome/common/extensions/apples'
21 }, 22 },
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 def GetAndReset(self): 96 def GetAndReset(self):
96 calls = self._calls 97 calls = self._calls
97 self._calls = [] 98 self._calls = []
98 return calls 99 return calls
99 100
100 101
101 class ContentProvidersTest(unittest.TestCase): 102 class ContentProvidersTest(unittest.TestCase):
102 def setUp(self): 103 def setUp(self):
103 test_file_system = TestFileSystem(_FILE_SYSTEM_DATA, relative_to=EXTENSIONS) 104 test_file_system = TestFileSystem(_FILE_SYSTEM_DATA, relative_to=EXTENSIONS)
104 self._github_fs_provider = _MockGithubFileSystemProvider(test_file_system) 105 self._github_fs_provider = _MockGithubFileSystemProvider(test_file_system)
106 object_store_creator = ObjectStoreCreator.ForTest()
107 # TODO(mangini): create tests for GCS
108 self._gcs_fs_provider = CloudStorageFileSystemProvider(object_store_creator)
105 self._content_providers = ContentProviders( 109 self._content_providers = ContentProviders(
106 CompiledFileSystem.Factory(ObjectStoreCreator.ForTest()), 110 CompiledFileSystem.Factory(object_store_creator),
107 test_file_system, 111 test_file_system,
108 self._github_fs_provider) 112 self._github_fs_provider,
113 self._gcs_fs_provider)
109 114
110 def testSimpleRootPath(self): 115 def testSimpleRootPath(self):
111 provider = self._content_providers.GetByName('apples') 116 provider = self._content_providers.GetByName('apples')
112 self.assertEqual( 117 self.assertEqual(
113 'gala apples', 118 'gala apples',
114 provider.GetContentAndType('gala.txt').Get().content) 119 provider.GetContentAndType('gala.txt').Get().content)
115 self.assertEqual( 120 self.assertEqual(
116 'granny smith apples', 121 'granny smith apples',
117 provider.GetContentAndType('green/granny smith.txt').Get().content) 122 provider.GetContentAndType('green/granny smith.txt').Get().content)
118 123
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 self.assertEqual('github-provider-with-dir', provider.name) 184 self.assertEqual('github-provider-with-dir', provider.name)
180 self.assertEqual('fruit/cherry.txt', path) 185 self.assertEqual('fruit/cherry.txt', path)
181 self.assertEqual([('SomeOwner', 'some-repo')], 186 self.assertEqual([('SomeOwner', 'some-repo')],
182 self._github_fs_provider.GetAndReset()) 187 self._github_fs_provider.GetAndReset())
183 self.assertEqual( 188 self.assertEqual(
184 'cherry tomatoes', 189 'cherry tomatoes',
185 provider.GetContentAndType(path).Get().content) 190 provider.GetContentAndType(path).Get().content)
186 191
187 if __name__ == '__main__': 192 if __name__ == '__main__':
188 unittest.main() 193 unittest.main()
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/content_providers.py ('k') | chrome/common/extensions/docs/server2/cron.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698