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 a9219e3525ff602f4a725d3405493557eb990409..b8304d1ac9c77b86c3d958351f56dc22e9052829 100644 |
--- a/tools/chrome_proxy/webdriver/lite_page.py |
+++ b/tools/chrome_proxy/webdriver/lite_page.py |
@@ -70,18 +70,23 @@ class LitePage(IntegrationTest): |
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) |
+ # Scroll to the bottom of the window and ensure scrollHeight increases. |
+ original_scroll_height = test_driver.ExecuteJavascriptStatement( |
+ 'document.body.scrollHeight') |
+ test_driver.ExecuteJavascriptStatement( |
+ 'window.scrollTo(0,Math.max(document.body.scrollHeight));') |
+ # Give some time for loading after scrolling. |
time.sleep(2) |
+ new_scroll_height = test_driver.ExecuteJavascriptStatement( |
+ 'document.body.scrollHeight') |
+ self.assertGreater(new_scroll_height, original_scroll_height) |
+ |
+ # Make sure there were more requests that were proxied. |
responses = test_driver.GetHTTPResponses(override_has_logs=True) |
self.assertNotEqual(0, len(responses)) |
for response in responses: |
self.assertHasChromeProxyViaHeader(response) |
+ self.assertIn(response.status, [200, 204]) |
# Checks that Lo-Fi images are used when the user is in the |
# DataCompressionProxyLitePageFallback field trial and a Lite Page is not |