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

Unified Diff: chrome/common/extensions/docs/server2/content_providers_test.py

Issue 148293018: Docserver: Make the .html extension unnecessary for content pages, for example, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/content_providers_test.py
diff --git a/chrome/common/extensions/docs/server2/content_providers_test.py b/chrome/common/extensions/docs/server2/content_providers_test.py
index 7ced6da6885f3a98b3185253348c7c46a59c9c25..c3420e9c2d77fe95bf9d6d2c9bf5c0bd9271b19b 100755
--- a/chrome/common/extensions/docs/server2/content_providers_test.py
+++ b/chrome/common/extensions/docs/server2/content_providers_test.py
@@ -100,10 +100,12 @@ class _MockGithubFileSystemProvider(object):
class ContentProvidersTest(unittest.TestCase):
def setUp(self):
+ object_store_creator = ObjectStoreCreator.ForTest()
test_file_system = TestFileSystem(_FILE_SYSTEM_DATA, relative_to=EXTENSIONS)
self._github_fs_provider = _MockGithubFileSystemProvider(test_file_system)
self._content_providers = ContentProviders(
- CompiledFileSystem.Factory(ObjectStoreCreator.ForTest()),
+ object_store_creator,
+ CompiledFileSystem.Factory(object_store_creator),
test_file_system,
self._github_fs_provider)
@@ -132,30 +134,38 @@ class ContentProvidersTest(unittest.TestCase):
provider.GetContentAndType('apples/gala.txt').Get().content)
def testSimpleServlet(self):
- provider, path = self._content_providers.GetByServeFrom('apples-dir')
+ provider, serve_from, path = self._content_providers.GetByServeFrom(
+ 'apples-dir')
self.assertEqual('apples', provider.name)
+ self.assertEqual('apples-dir', serve_from)
self.assertEqual('', path)
- provider, path = self._content_providers.GetByServeFrom(
+ provider, serve_from, path = self._content_providers.GetByServeFrom(
'apples-dir/are/forever')
self.assertEqual('apples', provider.name)
+ self.assertEqual('apples-dir', serve_from)
self.assertEqual('are/forever', path)
def testComplexServlet(self):
- provider, path = self._content_providers.GetByServeFrom(
+ provider, serve_from, path = self._content_providers.GetByServeFrom(
'tomatoes-dir/are/a')
self.assertEqual('tomatoes', provider.name)
+ self.assertEqual('tomatoes-dir/are/a', serve_from)
self.assertEqual('', path)
- provider, path = self._content_providers.GetByServeFrom(
+ provider, serve_from, path = self._content_providers.GetByServeFrom(
'tomatoes-dir/are/a/fruit/they/are')
self.assertEqual('tomatoes', provider.name)
+ self.assertEqual('tomatoes-dir/are/a', serve_from)
self.assertEqual('fruit/they/are', path)
def testEmptyStringServlet(self):
- provider, path = self._content_providers.GetByServeFrom('tomatoes-dir/are')
+ provider, serve_from, path = self._content_providers.GetByServeFrom(
+ 'tomatoes-dir/are')
self.assertEqual('bananas', provider.name)
+ self.assertEqual('', serve_from)
self.assertEqual('tomatoes-dir/are', path)
- provider, path = self._content_providers.GetByServeFrom('')
+ provider, serve_from, path = self._content_providers.GetByServeFrom('')
self.assertEqual('bananas', provider.name)
+ self.assertEqual('', serve_from)
self.assertEqual('', path)
@DisableLogging('error')
@@ -163,9 +173,10 @@ class ContentProvidersTest(unittest.TestCase):
self.assertEqual(None, self._content_providers.GetByName('cabbages'))
def testGithubContentProvider(self):
- provider, path = self._content_providers.GetByServeFrom(
+ provider, serve_from, path = self._content_providers.GetByServeFrom(
'gh/apples/green/granny smith.txt')
self.assertEqual('github-provider', provider.name)
+ self.assertEqual('gh', serve_from)
self.assertEqual('apples/green/granny smith.txt', path)
self.assertEqual([('GoogleChrome', 'hello-world')],
self._github_fs_provider.GetAndReset())
@@ -174,9 +185,10 @@ class ContentProvidersTest(unittest.TestCase):
provider.GetContentAndType(path).Get().content)
def testGithubContentProviderWithDir(self):
- provider, path = self._content_providers.GetByServeFrom(
+ provider, serve_from, path = self._content_providers.GetByServeFrom(
'gh2/fruit/cherry.txt')
self.assertEqual('github-provider-with-dir', provider.name)
+ self.assertEqual('gh2', serve_from)
self.assertEqual('fruit/cherry.txt', path)
self.assertEqual([('SomeOwner', 'some-repo')],
self._github_fs_provider.GetAndReset())

Powered by Google App Engine
This is Rietveld 408576698