| Index: tools/chrome_proxy/webdriver/lofi.py | 
| diff --git a/tools/chrome_proxy/webdriver/lofi.py b/tools/chrome_proxy/webdriver/lofi.py | 
| index a0753b1ad6c2cb54e29cec1ad0e7764803ae653b..8b2fd5d43ae3ba547c6d779f1ebed029fe47b098 100644 | 
| --- a/tools/chrome_proxy/webdriver/lofi.py | 
| +++ b/tools/chrome_proxy/webdriver/lofi.py | 
| @@ -19,7 +19,6 @@ class LoFi(IntegrationTest): | 
| # Disable server experiments such as tamper detection. | 
| test_driver.AddChromeArg('--data-reduction-proxy-server-experiments-' | 
| 'disabled') | 
| -      test_driver.AddChromeArg('--disable-quic') | 
|  | 
| test_driver.LoadURL('http://check.googlezip.net/static/index.html') | 
|  | 
| @@ -29,15 +28,8 @@ class LoFi(IntegrationTest): | 
| continue | 
| if not response.request_headers: | 
| continue | 
| -        self.assertHasChromeProxyViaHeader(response) | 
| -        content_length = response.response_headers['content-length'] | 
| -        cpat_request = response.request_headers['chrome-proxy-accept-transform'] | 
| -        cpct_response = response.response_headers[ | 
| -                          'chrome-proxy-content-transform'] | 
| -        if ('empty-image' in cpct_response): | 
| +        if (self.assertLoFiResponse(response, True)): | 
| lofi_responses = lofi_responses + 1 | 
| -          self.assertIn('empty-image', cpat_request) | 
| -          self.assertTrue(int(content_length) < 100) | 
|  | 
| # Verify that Lo-Fi responses were seen. | 
| self.assertNotEqual(0, lofi_responses) | 
| @@ -74,5 +66,79 @@ class LoFi(IntegrationTest): | 
| # Verify that a Lite Page response for the main frame was seen. | 
| self.assertEqual(1, lite_page_responses) | 
|  | 
| +  # Checks that Lo-Fi placeholder images are not loaded from cache on page | 
| +  # reloads when Lo-Fi mode is disabled or data reduction proxy is disabled. | 
| +  # First a test page is opened with Lo-Fi and chrome proxy enabled. This allows | 
| +  # Chrome to cache the Lo-Fi placeholder image. The browser is restarted with | 
| +  # chrome proxy disabled and the same test page is loaded. This second page | 
| +  # load should not pick the Lo-Fi placeholder from cache and original image | 
| +  # should be loaded. Finally, the browser is restarted with chrome proxy | 
| +  # enabled and Lo-Fi disabled and the same test page is loaded. This third page | 
| +  # load should not pick the Lo-Fi placeholder from cache and original image | 
| +  # should be loaded. | 
| +  def testLoFiCacheBypass(self): | 
| +    with TestDriver() as test_driver: | 
| +      # First page load, enable Lo-Fi and chrome proxy. Disable server | 
| +      # experiments such as tamper detection. This test should be run with | 
| +      # --profile-type=default command line for the same user profile and cache | 
| +      # to be used across the two page loads. | 
| +      test_driver.AddChromeArg('--enable-spdy-proxy-auth') | 
| +      test_driver.AddChromeArg('--data-reduction-proxy-lo-fi=always-on') | 
| +      test_driver.AddChromeArg('--profile-type=default') | 
| +      test_driver.AddChromeArg('--data-reduction-proxy-server-experiments-' | 
| +                               'disabled') | 
| + | 
| +      test_driver.LoadURL('http://check.googlezip.net/cacheable/test.html') | 
| + | 
| +      lofi_responses = 0 | 
| +      for response in test_driver.GetHTTPResponses(): | 
| +        if not response.url.endswith('png'): | 
| +          continue | 
| +        if not response.request_headers: | 
| +          continue | 
| +        if (self.assertLoFiResponse(response, True)): | 
| +          lofi_responses = lofi_responses + 1 | 
| + | 
| +      # Verify that Lo-Fi responses were seen. | 
| +      self.assertNotEqual(0, lofi_responses) | 
| + | 
| +      # Second page load with the chrome proxy off. | 
| +      test_driver._StopDriver() | 
| +      test_driver.RemoveChromeArg('--enable-spdy-proxy-auth') | 
| +      test_driver.LoadURL('http://check.googlezip.net/cacheable/test.html') | 
| + | 
| +      responses = 0 | 
| +      for response in test_driver.GetHTTPResponses(): | 
| +        if not response.url.endswith('png'): | 
| +          continue | 
| +        if not response.request_headers: | 
| +          continue | 
| +        responses = responses + 1 | 
| +        self.assertNotHasChromeProxyViaHeader(response) | 
| +        self.assertLoFiResponse(response, False) | 
| + | 
| +      # Verify that responses were seen. | 
| +      self.assertNotEqual(0, responses) | 
| + | 
| +      # Third page load with the chrome proxy on and Lo-Fi off. | 
| +      test_driver._StopDriver() | 
| +      test_driver.AddChromeArg('--enable-spdy-proxy-auth') | 
| +      test_driver.RemoveChromeArg('--data-reduction-proxy-lo-fi=always-on') | 
| +      test_driver.AddChromeArg('--data-reduction-proxy-lo-fi=disabled') | 
| +      test_driver.LoadURL('http://check.googlezip.net/cacheable/test.html') | 
| + | 
| +      responses = 0 | 
| +      for response in test_driver.GetHTTPResponses(): | 
| +        if not response.url.endswith('png'): | 
| +          continue | 
| +        if not response.request_headers: | 
| +          continue | 
| +        responses = responses + 1 | 
| +        self.assertHasChromeProxyViaHeader(response) | 
| +        self.assertLoFiResponse(response, False) | 
| + | 
| +      # Verify that responses were seen. | 
| +      self.assertNotEqual(0, responses) | 
| + | 
| if __name__ == '__main__': | 
| IntegrationTest.RunAllTests() | 
|  |