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

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

Issue 2852533002: Add lite page BTF test (Closed)
Patch Set: Grammer nit Created 3 years, 8 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/chrome_proxy/webdriver/common.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/chrome_proxy/webdriver/lite_page.py
diff --git a/tools/chrome_proxy/webdriver/lite_page.py b/tools/chrome_proxy/webdriver/lite_page.py
index d7fe48aa6b8860f458d66fb7fe4ceac56b97e3d4..a9219e3525ff602f4a725d3405493557eb990409 100644
--- a/tools/chrome_proxy/webdriver/lite_page.py
+++ b/tools/chrome_proxy/webdriver/lite_page.py
@@ -6,6 +6,7 @@ import common
from common import TestDriver
from common import IntegrationTest
+import time
class LitePage(IntegrationTest):
@@ -39,6 +40,49 @@ class LitePage(IntegrationTest):
# Verify that a Lite Page response for the main frame was seen.
self.assertEqual(1, lite_page_responses)
+ # Checks that a Lite Page does not have an error when scrolling to the bottom
+ # of the page and is able to load all resources.
+ def testLitePageBTF(self):
+ # If it was attempted to run with another experiment, skip this test.
+ if common.ParseFlags().browser_args and ('--data-reduction-proxy-experiment'
+ in common.ParseFlags().browser_args):
+ self.skipTest('This test cannot be run with other experiments.')
+ with TestDriver() as test_driver:
+ test_driver.AddChromeArg('--enable-spdy-proxy-auth')
+ test_driver.AddChromeArg('--data-reduction-proxy-lo-fi=always-on')
+ test_driver.AddChromeArg('--enable-data-reduction-proxy-lite-page')
+
+ # This page is long and has many media resources.
+ test_driver.LoadURL('http://check.googlezip.net/metrics/index.html')
+
+ # Verify that a Lite Page response for the main frame was seen.
+ lite_page_responses = 0
+ for response in test_driver.GetHTTPResponses():
+ # Skip CSI requests when validating Lite Page headers. CSI requests
+ # aren't expected to have LoFi headers.
+ if '/csi?' in response.url:
+ continue
+ if response.url.startswith('data:'):
+ continue
+ self.assertIn('exp=ignore_preview_blacklist',
+ response.request_headers['chrome-proxy'])
+ if (self.checkLitePageResponse(response)):
+ lite_page_responses = lite_page_responses + 1
+ self.assertEqual(1, lite_page_responses)
+
+ # Scroll to the bottom of the window and make sure there were more
+ # requests that were proxied.
+ scroll_js = 'window.scrollTo(0,Math.max(document.body.scrollHeight));'
+ test_driver.ExecuteJavascriptStatement(scroll_js)
+ # Give some time for loading after each scroll.
+ time.sleep(2)
+ test_driver.ExecuteJavascriptStatement(scroll_js)
+ time.sleep(2)
+ responses = test_driver.GetHTTPResponses(override_has_logs=True)
+ self.assertNotEqual(0, len(responses))
+ for response in responses:
+ self.assertHasChromeProxyViaHeader(response)
tombergan 2017/04/27 22:19:58 IIUC, this checks that there was another response
+
# Checks that Lo-Fi images are used when the user is in the
# DataCompressionProxyLitePageFallback field trial and a Lite Page is not
# served.
« no previous file with comments | « tools/chrome_proxy/webdriver/common.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698