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

Unified Diff: tools/chrome_proxy/webdriver/common.py

Issue 2705413004: Implement the Lo-Fi cache related integration tests with ChromeDriver (Closed)
Patch Set: remove disable-quic Created 3 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 | « no previous file | tools/chrome_proxy/webdriver/lofi.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/chrome_proxy/webdriver/common.py
diff --git a/tools/chrome_proxy/webdriver/common.py b/tools/chrome_proxy/webdriver/common.py
index 2572a64a9253049576e6d5b6364a950ce18c46c3..bba3dfbf340a3484b4032044debe19bfa3c5e695 100644
--- a/tools/chrome_proxy/webdriver/common.py
+++ b/tools/chrome_proxy/webdriver/common.py
@@ -548,6 +548,41 @@ class IntegrationTest(unittest.TestCase):
self.assertNotIn(expected_via_header,
http_response.response_headers['via'])
+ def assertLoFiResponse(self, http_response, expected_lo_fi):
+ """Asserts that the response and request headers contain the given directive
+ and the content size is less than 100 if |expected_lo_fi|. Otherwise, checks
+ that the response and request headers don't contain the Lo-Fi directive and
+ the content size is greater than 100.
+
+ Args:
+ http_response: The HTTPResponse object to check.
+ expected_lo_fi: Whether the response should be Lo-Fi.
+
+ Returns:
+ Whether the response was Lo-Fi.
+ """
+
+ if (expected_lo_fi) :
+ self.assertHasChromeProxyViaHeader(http_response)
+ content_length = http_response.response_headers['content-length']
+ cpat_request = http_response.request_headers[
+ 'chrome-proxy-accept-transform']
+ cpct_response = http_response.response_headers[
+ 'chrome-proxy-content-transform']
+ if ('empty-image' in cpct_response):
+ self.assertIn('empty-image', cpat_request)
+ self.assertTrue(int(content_length) < 100)
+ return True;
+ return False;
+ else:
+ self.assertNotIn('chrome-proxy-accept-transform',
+ http_response.request_headers)
+ self.assertNotIn('chrome-proxy-content-transform',
+ http_response.response_headers)
+ content_length = http_response.response_headers['content-length']
+ self.assertTrue(int(content_length) > 100)
+ return False;
+
@staticmethod
def RunAllTests(run_all_tests=False):
"""A simple helper method to run all tests using unittest.main().
« no previous file with comments | « no previous file | tools/chrome_proxy/webdriver/lofi.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698