summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/common/extensions/docs/server2/appengine_url_fetcher.py1
-rw-r--r--chrome/common/extensions/docs/server2/appengine_wrappers.py3
-rw-r--r--chrome/common/extensions/docs/server2/chroot_file_system.py3
-rwxr-xr-xchrome/common/extensions/docs/server2/cron_servlet_test.py3
-rw-r--r--chrome/common/extensions/docs/server2/fake_fetchers.py2
-rwxr-xr-xchrome/common/extensions/docs/server2/integration_test.py6
-rw-r--r--chrome/common/extensions/docs/server2/local_file_system.py29
-rw-r--r--chrome/common/extensions/docs/server2/url_constants.py4
8 files changed, 30 insertions, 21 deletions
diff --git a/chrome/common/extensions/docs/server2/appengine_url_fetcher.py b/chrome/common/extensions/docs/server2/appengine_url_fetcher.py
index 398d46e..ccdf156 100644
--- a/chrome/common/extensions/docs/server2/appengine_url_fetcher.py
+++ b/chrome/common/extensions/docs/server2/appengine_url_fetcher.py
@@ -52,6 +52,7 @@ class AppEngineUrlFetcher(object):
return Future(delegate=_AsyncFetchDelegate(rpc))
def _FromBasePath(self, url):
+ assert not url.startswith('/')
if self._base_path is not None:
url = posixpath.join(self._base_path, url) if url else self._base_path
return url
diff --git a/chrome/common/extensions/docs/server2/appengine_wrappers.py b/chrome/common/extensions/docs/server2/appengine_wrappers.py
index b551774..734fdfe 100644
--- a/chrome/common/extensions/docs/server2/appengine_wrappers.py
+++ b/chrome/common/extensions/docs/server2/appengine_wrappers.py
@@ -57,7 +57,7 @@ except ImportError:
for k, v in FAKE_URL_FETCHER_CONFIGURATION.iteritems():
if k.match(key):
return v
- return None
+ raise ValueError('No configuration found for %s' % key)
class _RPC(object):
def __init__(self, result=None):
@@ -83,6 +83,7 @@ except ImportError:
self.status_code = 200
def fetch(self, url, **kwargs):
+ url = url.split('?', 1)[0]
response = self._Response(_GetConfiguration(url).fetch(url))
if response.content is None:
response.status_code = 404
diff --git a/chrome/common/extensions/docs/server2/chroot_file_system.py b/chrome/common/extensions/docs/server2/chroot_file_system.py
index 792b08f..d391fe5 100644
--- a/chrome/common/extensions/docs/server2/chroot_file_system.py
+++ b/chrome/common/extensions/docs/server2/chroot_file_system.py
@@ -50,4 +50,5 @@ class ChrootFileSystem(FileSystem):
'%s/%s' % (self._file_system.GetIdentity(), self._root))
def __repr__(self):
- return 'ChrootFileSystem of <%s>' % repr(self._file_system)
+ return 'ChrootFileSystem(%s, %s)' % (
+ self._root, repr(self._file_system))
diff --git a/chrome/common/extensions/docs/server2/cron_servlet_test.py b/chrome/common/extensions/docs/server2/cron_servlet_test.py
index c6d4bfe..0a140d0 100755
--- a/chrome/common/extensions/docs/server2/cron_servlet_test.py
+++ b/chrome/common/extensions/docs/server2/cron_servlet_test.py
@@ -115,12 +115,11 @@ class CronServletTest(unittest.TestCase):
},
},
'json': {
+ 'chrome_sidenav.json': '{}',
'content_providers.json': ReadFile(CONTENT_PROVIDERS),
'manifest.json': '{}',
'permissions.json': '{}',
'strings.json': '{}',
- 'apps_sidenav.json': '{}',
- 'extensions_sidenav.json': '{}',
},
}
}
diff --git a/chrome/common/extensions/docs/server2/fake_fetchers.py b/chrome/common/extensions/docs/server2/fake_fetchers.py
index b56a7f4..1c5cb20 100644
--- a/chrome/common/extensions/docs/server2/fake_fetchers.py
+++ b/chrome/common/extensions/docs/server2/fake_fetchers.py
@@ -137,8 +137,8 @@ def ConfigureFakeFetchers():
'''Configure the fake fetcher paths relative to the docs directory.
'''
appengine_wrappers.ConfigureFakeUrlFetch({
+ url_constants.OMAHA_HISTORY: _FakeOmahaHistory(),
url_constants.OMAHA_PROXY_URL: _FakeOmahaProxy(),
- re.escape(url_constants.OMAHA_DEV_HISTORY): _FakeOmahaHistory(),
'%s/.*' % url_constants.SVN_URL: _FakeSubversionServer(),
'%s/.*' % url_constants.VIEWVC_URL: _FakeViewvcServer(),
'%s/.*/commits/.*' % url_constants.GITHUB_REPOS: _FakeGithubStat(),
diff --git a/chrome/common/extensions/docs/server2/integration_test.py b/chrome/common/extensions/docs/server2/integration_test.py
index ca9a932..c19f27b 100755
--- a/chrome/common/extensions/docs/server2/integration_test.py
+++ b/chrome/common/extensions/docs/server2/integration_test.py
@@ -143,8 +143,10 @@ class IntegrationTest(unittest.TestCase):
start_time = time.time()
try:
for path, content in public_files.iteritems():
+ assert path.startswith('/')
if path.endswith('redirects.json'):
continue
+
def check_result(response):
self.assertEqual(200, response.status,
'Got %s when rendering %s' % (response.status, path))
@@ -157,7 +159,7 @@ class IntegrationTest(unittest.TestCase):
# Make sure that leaving out the .html will temporarily redirect to the
# path with the .html.
- if path.startswith(('apps/', 'extensions/')):
+ if path.startswith(('/apps/', '/extensions/')):
redirect_result = Handler(
Request.ForTest(posixpath.splitext(path)[0])).Get()
self.assertEqual((path, False), redirect_result.GetRedirect())
@@ -166,7 +168,7 @@ class IntegrationTest(unittest.TestCase):
# path without a channel.
for channel in BranchUtility.GetAllChannelNames():
redirect_result = Handler(
- Request.ForTest('%s/%s' % (channel, path))).Get()
+ Request.ForTest('%s%s' % (channel, path))).Get()
self.assertEqual((path, True), redirect_result.GetRedirect())
# Samples are internationalized, test some locales.
diff --git a/chrome/common/extensions/docs/server2/local_file_system.py b/chrome/common/extensions/docs/server2/local_file_system.py
index fd3572f..9b405ad 100644
--- a/chrome/common/extensions/docs/server2/local_file_system.py
+++ b/chrome/common/extensions/docs/server2/local_file_system.py
@@ -7,7 +7,7 @@ import sys
from docs_server_utils import StringIdentity
from file_system import FileSystem, FileNotFoundError, StatInfo
-from future import Future
+from future import Gettable, Future
def _ConvertToFilepath(path):
return path.replace('/', os.sep)
@@ -64,20 +64,22 @@ class LocalFileSystem(FileSystem):
self._base_path = _ConvertToFilepath(base_path)
@staticmethod
- def Create():
+ def Create(root=''):
return LocalFileSystem(
- os.path.join(sys.path[0], '..', '..', '..', '..', '..'))
+ os.path.join(sys.path[0], '..', '..', '..', '..', '..', root))
def Read(self, paths):
- result = {}
- for path in paths:
- full_path = os.path.join(self._base_path,
- _ConvertToFilepath(path).lstrip(os.sep))
- if path.endswith('/'):
- result[path] = _ListDir(full_path)
- else:
- result[path] = _ReadFile(full_path)
- return Future(value=result)
+ def resolve():
+ result = {}
+ for path in paths:
+ full_path = os.path.join(self._base_path,
+ _ConvertToFilepath(path).lstrip(os.sep))
+ if path == '' or path.endswith('/'):
+ result[path] = _ListDir(full_path)
+ else:
+ result[path] = _ReadFile(full_path)
+ return result
+ return Future(delegate=Gettable(resolve))
def Refresh(self):
return Future(value=())
@@ -89,3 +91,6 @@ class LocalFileSystem(FileSystem):
def GetIdentity(self):
return '@'.join((self.__class__.__name__, StringIdentity(self._base_path)))
+
+ def __repr__(self):
+ return 'LocalFileSystem(%s)' % self._base_path
diff --git a/chrome/common/extensions/docs/server2/url_constants.py b/chrome/common/extensions/docs/server2/url_constants.py
index d9db0c7..4258570 100644
--- a/chrome/common/extensions/docs/server2/url_constants.py
+++ b/chrome/common/extensions/docs/server2/url_constants.py
@@ -7,8 +7,8 @@ GITHUB_BASE = 'https://github.com/GoogleChrome/chrome-app-samples/tree/master'
RAW_GITHUB_BASE = ('https://github.com/GoogleChrome/chrome-app-samples/raw/'
'master')
OMAHA_PROXY_URL = 'http://omahaproxy.appspot.com/json'
-OMAHA_DEV_HISTORY = ('http://omahaproxy.appspot.com/history?channel=dev'
- '&os=win&json=1')
+OMAHA_HISTORY = 'http://omahaproxy.appspot.com/history'
+OMAHA_DEV_HISTORY = '%s?channel=dev&os=win&json=1' % OMAHA_HISTORY
SVN_URL = 'http://src.chromium.org/chrome'
VIEWVC_URL = 'http://src.chromium.org/viewvc/chrome'
EXTENSIONS_SAMPLES = ('http://src.chromium.org/viewvc/chrome/trunk/src/chrome/'