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

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

Issue 2726423003: Integration tests for WebLite to Lo-Fi fallback (Closed)
Patch Set: 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/lite_page.py » ('j') | tools/chrome_proxy/webdriver/lite_page.py » ('J')
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 be29345e3fb6c7535d19ac85044f47b29f6aa46c..57bab09efb664ef194417e4e23a0979dfc6cce59 100644
--- a/tools/chrome_proxy/webdriver/common.py
+++ b/tools/chrome_proxy/webdriver/common.py
@@ -578,11 +578,12 @@ 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.
+ def checkLoFiResponse(self, http_response, expected_lo_fi):
+ """Asserts that if expected the response headers contain the Lo-Fi directive
+ then the request headers do too. Also checks that 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.
@@ -613,6 +614,29 @@ class IntegrationTest(unittest.TestCase):
self.assertTrue(int(content_length) > 100)
return False;
+ def checkLitePageResponse(self, http_response):
+ """Asserts that if the response headers contain the Lite Page directive then
+ the request headers do too.
+
+ Args:
+ http_response: The HTTPResponse object to check.
+
+ Returns:
+ Whether the response was a Lite Page.
+ """
+
+ self.assertHasChromeProxyViaHeader(http_response)
+ if ('chrome-proxy-content-transform' not in http_response.response_headers):
+ return False;
+ cpct_response = http_response.response_headers[
+ 'chrome-proxy-content-transform']
+ cpat_request = http_response.request_headers[
+ 'chrome-proxy-accept-transform']
+ if ('lite-page' in cpct_response):
+ self.assertIn('lite-page', cpat_request)
+ return True;
+ 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/lite_page.py » ('j') | tools/chrome_proxy/webdriver/lite_page.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698