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

Side by Side Diff: tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py

Issue 2062963003: Add a flag to disable server experiments in DRP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: kundaji comments Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « components/data_reduction_proxy/core/common/data_reduction_proxy_switches.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import base64 5 import base64
6 import logging 6 import logging
7 import urlparse 7 import urlparse
8 8
9 from common import chrome_proxy_measurements as measurements 9 from common import chrome_proxy_measurements as measurements
10 from common.chrome_proxy_measurements import ChromeProxyValidation 10 from common.chrome_proxy_measurements import ChromeProxyValidation
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 class ChromeProxyLoFi(ChromeProxyValidation): 268 class ChromeProxyLoFi(ChromeProxyValidation):
269 """Correctness measurement for Lo-Fi in Chrome-Proxy header.""" 269 """Correctness measurement for Lo-Fi in Chrome-Proxy header."""
270 270
271 def __init__(self): 271 def __init__(self):
272 super(ChromeProxyLoFi, self).__init__(restart_after_each_page=True, 272 super(ChromeProxyLoFi, self).__init__(restart_after_each_page=True,
273 metrics=metrics.ChromeProxyMetric()) 273 metrics=metrics.ChromeProxyMetric())
274 274
275 def CustomizeBrowserOptions(self, options): 275 def CustomizeBrowserOptions(self, options):
276 super(ChromeProxyLoFi, self).CustomizeBrowserOptions(options) 276 super(ChromeProxyLoFi, self).CustomizeBrowserOptions(options)
277 options.AppendExtraBrowserArgs('--data-reduction-proxy-lo-fi=always-on') 277 options.AppendExtraBrowserArgs('--data-reduction-proxy-lo-fi=always-on')
278 # Disable server experiments such as tamper detection.
279 options.AppendExtraBrowserArgs(
280 '--data-reduction-proxy-server-experiments-disabled')
278 281
279 def AddResults(self, tab, results): 282 def AddResults(self, tab, results):
280 self._metrics.AddResultsForLoFi(tab, results) 283 self._metrics.AddResultsForLoFi(tab, results)
281 284
282 class ChromeProxyCacheLoFiDisabled(ChromeProxyValidation): 285 class ChromeProxyCacheLoFiDisabled(ChromeProxyValidation):
283 """ 286 """
284 Correctness measurement for Lo-Fi placeholder is not loaded from cache when a 287 Correctness measurement for Lo-Fi placeholder is not loaded from cache when a
285 page is reloaded with LoFi disabled. First a test page is opened with LoFi and 288 page is reloaded with LoFi disabled. First a test page is opened with LoFi and
286 chrome proxy enabled. This allows Chrome to cache the LoFi placeholder image. 289 chrome proxy enabled. This allows Chrome to cache the LoFi placeholder image.
287 The browser is restarted with LoFi disabled and the same test page is loaded. 290 The browser is restarted with LoFi disabled and the same test page is loaded.
288 This second page load should not pick the LoFi placeholder from cache and 291 This second page load should not pick the LoFi placeholder from cache and
289 original image should be loaded. This test should be run with 292 original image should be loaded. This test should be run with
290 --profile-type=default command line for the same user profile and cache to be 293 --profile-type=default command line for the same user profile and cache to be
291 used across the two page loads. 294 used across the two page loads.
292 """ 295 """
293 296
294 def __init__(self): 297 def __init__(self):
295 super(ChromeProxyCacheLoFiDisabled, self).__init__( 298 super(ChromeProxyCacheLoFiDisabled, self).__init__(
296 restart_after_each_page=True, 299 restart_after_each_page=True,
297 metrics=metrics.ChromeProxyMetric(), 300 metrics=metrics.ChromeProxyMetric(),
298 clear_cache_before_each_run=False) 301 clear_cache_before_each_run=False)
299 302
300 def AddResults(self, tab, results): 303 def AddResults(self, tab, results):
301 self._metrics.AddResultsForLoFiCache(tab, results, self._is_lo_fi_enabled) 304 self._metrics.AddResultsForLoFiCache(tab, results, self._is_lo_fi_enabled)
302 305
303 def WillStartBrowser(self, platform): 306 def WillStartBrowser(self, platform):
304 super(ChromeProxyCacheLoFiDisabled, self).WillStartBrowser(platform) 307 super(ChromeProxyCacheLoFiDisabled, self).WillStartBrowser(platform)
305 if not self._page: 308 if not self._page:
306 # First page load, enable LoFi and chrome proxy. 309 # First page load, enable LoFi and chrome proxy. Disable server
310 # experiments such as tamper detection.
307 self.options.AppendExtraBrowserArgs( 311 self.options.AppendExtraBrowserArgs(
308 '--data-reduction-proxy-lo-fi=always-on') 312 '--data-reduction-proxy-lo-fi=always-on')
313 self.options.AppendExtraBrowserArgs(
314 '--data-reduction-proxy-server-experiments-disabled')
309 self._is_lo_fi_enabled = True 315 self._is_lo_fi_enabled = True
310 else: 316 else:
311 # Second page load, disable LoFi. Chrome proxy is still enabled. 317 # Second page load, disable LoFi. Chrome proxy is still enabled. Disable
318 # server experiments such as tamper detection.
312 self.options.browser_options.extra_browser_args.discard( 319 self.options.browser_options.extra_browser_args.discard(
313 '--data-reduction-proxy-lo-fi=always-on') 320 '--data-reduction-proxy-lo-fi=always-on')
321 self.options.AppendExtraBrowserArgs(
322 '--data-reduction-proxy-server-experiments-disabled')
314 self._is_lo_fi_enabled = False 323 self._is_lo_fi_enabled = False
315 324
316 def WillNavigateToPage(self, page, tab): 325 def WillNavigateToPage(self, page, tab):
317 super(ChromeProxyCacheLoFiDisabled, self).WillNavigateToPage(page, tab) 326 super(ChromeProxyCacheLoFiDisabled, self).WillNavigateToPage(page, tab)
318 if self._is_lo_fi_enabled: 327 if self._is_lo_fi_enabled:
319 # Clear cache for the first page to pick LoFi image from server. 328 # Clear cache for the first page to pick LoFi image from server.
320 tab.ClearCache(force=True) 329 tab.ClearCache(force=True)
321 330
322 def DidNavigateToPage(self, page, tab): 331 def DidNavigateToPage(self, page, tab):
323 if not self._is_lo_fi_enabled: 332 if not self._is_lo_fi_enabled:
(...skipping 18 matching lines...) Expand all
342 metrics=metrics.ChromeProxyMetric(), 351 metrics=metrics.ChromeProxyMetric(),
343 clear_cache_before_each_run=False) 352 clear_cache_before_each_run=False)
344 353
345 def AddResults(self, tab, results): 354 def AddResults(self, tab, results):
346 self._metrics.AddResultsForLoFiCache(tab, results, 355 self._metrics.AddResultsForLoFiCache(tab, results,
347 self._is_chrome_proxy_enabled) 356 self._is_chrome_proxy_enabled)
348 357
349 def WillStartBrowser(self, platform): 358 def WillStartBrowser(self, platform):
350 super(ChromeProxyCacheProxyDisabled, self).WillStartBrowser(platform) 359 super(ChromeProxyCacheProxyDisabled, self).WillStartBrowser(platform)
351 if not self._page: 360 if not self._page:
352 # First page load, enable LoFi and chrome proxy. 361 # First page load, enable LoFi and chrome proxy. Disable server
362 # experiments such as tamper detection.
353 self.options.AppendExtraBrowserArgs( 363 self.options.AppendExtraBrowserArgs(
354 '--data-reduction-proxy-lo-fi=always-on') 364 '--data-reduction-proxy-lo-fi=always-on')
365 self.options.AppendExtraBrowserArgs(
366 '--data-reduction-proxy-server-experiments-disabled')
355 else: 367 else:
356 # Second page load, disable chrome proxy. LoFi is still enabled. 368 # Second page load, disable chrome proxy. LoFi is still enabled.
357 self.DisableChromeProxy() 369 self.DisableChromeProxy()
358 370
359 def WillNavigateToPage(self, page, tab): 371 def WillNavigateToPage(self, page, tab):
360 super(ChromeProxyCacheProxyDisabled, self).WillNavigateToPage(page, tab) 372 super(ChromeProxyCacheProxyDisabled, self).WillNavigateToPage(page, tab)
361 if self._is_chrome_proxy_enabled: 373 if self._is_chrome_proxy_enabled:
362 # Clear cache for the first page to pick LoFi image from server. 374 # Clear cache for the first page to pick LoFi image from server.
363 tab.ClearCache(force=True) 375 tab.ClearCache(force=True)
364 376
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth') 654 options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth')
643 655
644 def WillNavigateToPage(self, page, tab): 656 def WillNavigateToPage(self, page, tab):
645 measurements.WaitForViaHeader(tab) 657 measurements.WaitForViaHeader(tab)
646 tab.ClearCache(force=True) 658 tab.ClearCache(force=True)
647 self._metrics.Start(page, tab) 659 self._metrics.Start(page, tab)
648 660
649 def ValidateAndMeasurePage(self, page, tab, results): 661 def ValidateAndMeasurePage(self, page, tab, results):
650 self._metrics.Stop(page, tab) 662 self._metrics.Stop(page, tab)
651 self._metrics.AddResults(tab, results) 663 self._metrics.AddResults(tab, results)
OLDNEW
« no previous file with comments | « components/data_reduction_proxy/core/common/data_reduction_proxy_switches.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698