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

Unified Diff: mojo/devtools/common/devtoolslib/http_server_unittest.py

Issue 1278153002: Devtools: fix MIME type inferrence. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address Ben's comments. Created 5 years, 4 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
« no previous file with comments | « mojo/devtools/common/devtoolslib/http_server.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/devtools/common/devtoolslib/http_server_unittest.py
diff --git a/mojo/devtools/common/devtoolslib/http_server_unittest.py b/mojo/devtools/common/devtoolslib/http_server_unittest.py
index f279712ce63b181a51ec75b5c8cccf3085832338..b089e70fcf5c434ec9c32600ec0010fc0b6f8f6e 100644
--- a/mojo/devtools/common/devtoolslib/http_server_unittest.py
+++ b/mojo/devtools/common/devtoolslib/http_server_unittest.py
@@ -33,6 +33,8 @@ class HttpServerTest(unittest.TestCase):
hello_file
other_dir
other_file
+ apps
+ app.dart
"""
self.parent_dir = tempfile.mkdtemp()
self.parent_file = tempfile.NamedTemporaryFile(delete=False,
@@ -47,6 +49,11 @@ class HttpServerTest(unittest.TestCase):
self.other_dir = tempfile.mkdtemp(dir=self.parent_dir)
self.other_file = tempfile.NamedTemporaryFile(delete=False,
dir=self.other_dir)
+ self.other_file.close()
+
+ self.apps_dir = tempfile.mkdtemp(dir=self.parent_dir)
+ self.dart_app_path = os.path.join(self.apps_dir, 'app.dart')
+ open(self.dart_app_path, 'w').close()
def tearDown(self):
shutil.rmtree(self.parent_dir)
@@ -135,6 +142,23 @@ class HttpServerTest(unittest.TestCase):
fileobj=StringIO.StringIO(hello_response.read())).read()
self.assertEquals('hello', content)
+ def test_dart_mime_type(self):
+ """Verifies that files of '.dart' extension are served with MIME type
+ 'application/dart'.
+ """
+ mappings = [
+ ('', [self.apps_dir]),
+ ]
+ server_address = ('http://%s:%u/' %
+ http_server.start_http_server(mappings))
+
+ app_relpath = os.path.relpath(self.dart_app_path, self.apps_dir)
+ hello_response = urllib2.urlopen(server_address + app_relpath)
+ self.assertEquals(200, hello_response.getcode())
+ self.assertTrue('Content-Type' in hello_response.info())
+ self.assertEquals('application/dart',
+ hello_response.info().get('Content-Type'))
+
if __name__ == "__main__":
unittest.main()
« no previous file with comments | « mojo/devtools/common/devtoolslib/http_server.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698