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

Unified Diff: tools/android/loading/request_track_unittest.py

Issue 1707173003: tools/android/loading Add 'redirect' and 'ping' content types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: indent Created 4 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
« no previous file with comments | « tools/android/loading/request_track.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/android/loading/request_track_unittest.py
diff --git a/tools/android/loading/request_track_unittest.py b/tools/android/loading/request_track_unittest.py
index 7a85f07ac0798a3eccb675f89366453a21adc419..6e54208aaa05f737e7533d5d617556186c49fc84 100644
--- a/tools/android/loading/request_track_unittest.py
+++ b/tools/android/loading/request_track_unittest.py
@@ -47,10 +47,31 @@ class RequestTestCase(unittest.TestCase):
# Parameters are filtered out.
r.response_headers = {'Content-Type': 'application/javascript;bla'}
self.assertEquals('application/javascript', r.GetContentType())
- # MIME type takes precedence over headers.
+ # MIME type takes precedence over 'Content-Type' header.
r.mime_type = 'image/webp'
self.assertEquals('image/webp', r.GetContentType())
r.mime_type = None
+ # Test for 'ping' type.
+ r.status = 204
+ self.assertEquals('ping', r.GetContentType())
+ r.status = None
+ r.response_headers = {'Content-Type': 'application/javascript',
+ 'content-length': '0'}
+ self.assertEquals('ping', r.GetContentType())
+ # Test for 'redirect' type.
+ r.response_headers = {'Content-Type': 'application/javascript',
+ 'location': 'http://foo',
+ 'content-length': '0'}
+ self.assertEquals('redirect', r.GetContentType())
+
+ def testGetHTTPResponseHeader(self):
+ r = Request()
+ r.response_headers = {}
+ self.assertEquals(None, r.GetHTTPResponseHeader('Foo'))
+ r.response_headers = {'Foo': 'Bar', 'Baz': 'Foo'}
+ self.assertEquals('Bar', r.GetHTTPResponseHeader('Foo'))
+ r.response_headers = {'foo': 'Bar', 'Baz': 'Foo'}
+ self.assertEquals('Bar', r.GetHTTPResponseHeader('Foo'))
class RequestTrackTestCase(unittest.TestCase):
« no previous file with comments | « tools/android/loading/request_track.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698