| 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)
|
| +
|
| # Checks that Lo-Fi images are used when the user is in the
|
| # DataCompressionProxyLitePageFallback field trial and a Lite Page is not
|
| # served.
|
|
|