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

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

Issue 2719853003: [Telemetry refactor] Drop "2" from method calls to JS API (Closed)
Patch Set: Created 3 years, 9 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
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 29 matching lines...) Expand all
40 options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth') 40 options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth')
41 41
42 def WillNavigateToPage(self, page, tab): 42 def WillNavigateToPage(self, page, tab):
43 if self._enable_proxy: 43 if self._enable_proxy:
44 measurements.WaitForViaHeader(tab) 44 measurements.WaitForViaHeader(tab)
45 tab.ClearCache(force=True) 45 tab.ClearCache(force=True)
46 self._metrics.Start(page, tab) 46 self._metrics.Start(page, tab)
47 47
48 def ValidateAndMeasurePage(self, page, tab, results): 48 def ValidateAndMeasurePage(self, page, tab, results):
49 # Wait for the load event. 49 # Wait for the load event.
50 tab.WaitForJavaScriptCondition2( 50 tab.WaitForJavaScriptCondition(
51 'performance.timing.loadEventStart', timeout=300) 51 'performance.timing.loadEventStart', timeout=300)
52 self._metrics.Stop(page, tab) 52 self._metrics.Stop(page, tab)
53 self._metrics.AddResultsForDataSaving(tab, results) 53 self._metrics.AddResultsForDataSaving(tab, results)
54 54
55 55
56 class ChromeProxyHeaders(ChromeProxyValidation): 56 class ChromeProxyHeaders(ChromeProxyValidation):
57 """Correctness measurement for response headers.""" 57 """Correctness measurement for response headers."""
58 58
59 def __init__(self): 59 def __init__(self):
60 super(ChromeProxyHeaders, self).__init__( 60 super(ChromeProxyHeaders, self).__init__(
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 """Correctness measurement for bypass responses for CORS requests.""" 117 """Correctness measurement for bypass responses for CORS requests."""
118 118
119 def __init__(self): 119 def __init__(self):
120 super(ChromeProxyCorsBypass, self).__init__( 120 super(ChromeProxyCorsBypass, self).__init__(
121 restart_after_each_page=True, 121 restart_after_each_page=True,
122 metrics=metrics.ChromeProxyMetric()) 122 metrics=metrics.ChromeProxyMetric())
123 123
124 def ValidateAndMeasurePage(self, page, tab, results): 124 def ValidateAndMeasurePage(self, page, tab, results):
125 # The test page sets window.xhrRequestCompleted to true when the XHR fetch 125 # The test page sets window.xhrRequestCompleted to true when the XHR fetch
126 # finishes. 126 # finishes.
127 tab.WaitForJavaScriptCondition2('window.xhrRequestCompleted', timeout=300) 127 tab.WaitForJavaScriptCondition('window.xhrRequestCompleted', timeout=300)
128 super(ChromeProxyCorsBypass, 128 super(ChromeProxyCorsBypass,
129 self).ValidateAndMeasurePage(page, tab, results) 129 self).ValidateAndMeasurePage(page, tab, results)
130 130
131 def AddResults(self, tab, results): 131 def AddResults(self, tab, results):
132 self._metrics.AddResultsForCorsBypass(tab, results) 132 self._metrics.AddResultsForCorsBypass(tab, results)
133 133
134 134
135 class ChromeProxyBlockOnce(ChromeProxyValidation): 135 class ChromeProxyBlockOnce(ChromeProxyValidation):
136 """Correctness measurement for block-once responses.""" 136 """Correctness measurement for block-once responses."""
137 137
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 self._is_lo_fi_enabled = False 359 self._is_lo_fi_enabled = False
360 360
361 def WillNavigateToPage(self, page, tab): 361 def WillNavigateToPage(self, page, tab):
362 super(ChromeProxyCacheLoFiDisabled, self).WillNavigateToPage(page, tab) 362 super(ChromeProxyCacheLoFiDisabled, self).WillNavigateToPage(page, tab)
363 if self._is_lo_fi_enabled: 363 if self._is_lo_fi_enabled:
364 # Clear cache for the first page to pick LoFi image from server. 364 # Clear cache for the first page to pick LoFi image from server.
365 tab.ClearCache(force=True) 365 tab.ClearCache(force=True)
366 366
367 def DidNavigateToPage(self, page, tab): 367 def DidNavigateToPage(self, page, tab):
368 if not self._is_lo_fi_enabled: 368 if not self._is_lo_fi_enabled:
369 tab.ExecuteJavaScript2('window.location.reload()') 369 tab.ExecuteJavaScript('window.location.reload()')
370 util.WaitFor(tab.HasReachedQuiescence, 3) 370 util.WaitFor(tab.HasReachedQuiescence, 3)
371 371
372 class ChromeProxyCacheProxyDisabled(ChromeProxyValidation): 372 class ChromeProxyCacheProxyDisabled(ChromeProxyValidation):
373 """ 373 """
374 Correctness measurement for Lo-Fi placeholder is not loaded from cache when a 374 Correctness measurement for Lo-Fi placeholder is not loaded from cache when a
375 page is reloaded with data reduction proxy disabled. First a test page is 375 page is reloaded with data reduction proxy disabled. First a test page is
376 opened with LoFi and chrome proxy enabled. This allows Chrome to cache the 376 opened with LoFi and chrome proxy enabled. This allows Chrome to cache the
377 LoFi placeholder image. The browser is restarted with chrome proxy disabled 377 LoFi placeholder image. The browser is restarted with chrome proxy disabled
378 and the same test page is loaded. This second page load should not pick the 378 and the same test page is loaded. This second page load should not pick the
379 LoFi placeholder from cache and original image should be loaded. This test 379 LoFi placeholder from cache and original image should be loaded. This test
(...skipping 26 matching lines...) Expand all
406 self.DisableChromeProxy() 406 self.DisableChromeProxy()
407 407
408 def WillNavigateToPage(self, page, tab): 408 def WillNavigateToPage(self, page, tab):
409 super(ChromeProxyCacheProxyDisabled, self).WillNavigateToPage(page, tab) 409 super(ChromeProxyCacheProxyDisabled, self).WillNavigateToPage(page, tab)
410 if self._is_chrome_proxy_enabled: 410 if self._is_chrome_proxy_enabled:
411 # Clear cache for the first page to pick LoFi image from server. 411 # Clear cache for the first page to pick LoFi image from server.
412 tab.ClearCache(force=True) 412 tab.ClearCache(force=True)
413 413
414 def DidNavigateToPage(self, page, tab): 414 def DidNavigateToPage(self, page, tab):
415 if not self._is_chrome_proxy_enabled: 415 if not self._is_chrome_proxy_enabled:
416 tab.ExecuteJavaScript2('window.location.reload()') 416 tab.ExecuteJavaScript('window.location.reload()')
417 util.WaitFor(tab.HasReachedQuiescence, 3) 417 util.WaitFor(tab.HasReachedQuiescence, 3)
418 418
419 class ChromeProxyLitePage(ChromeProxyValidation): 419 class ChromeProxyLitePage(ChromeProxyValidation):
420 """Correctness measurement for lite pages in the Chrome-Proxy header.""" 420 """Correctness measurement for lite pages in the Chrome-Proxy header."""
421 421
422 def __init__(self): 422 def __init__(self):
423 super(ChromeProxyLitePage, self).__init__( 423 super(ChromeProxyLitePage, self).__init__(
424 restart_after_each_page=True, 424 restart_after_each_page=True,
425 metrics=metrics.ChromeProxyMetric()) 425 metrics=metrics.ChromeProxyMetric())
426 426
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 options.AppendExtraBrowserArgs( 495 options.AppendExtraBrowserArgs(
496 '--data-reduction-proxy-http-proxies=' 496 '--data-reduction-proxy-http-proxies='
497 'http://nonexistent.googlezip.net;http://compress.googlezip.net') 497 'http://nonexistent.googlezip.net;http://compress.googlezip.net')
498 498
499 def WillNavigateToPage(self, page, tab): 499 def WillNavigateToPage(self, page, tab):
500 super(ChromeProxyHTTPToDirectFallback, self).WillNavigateToPage(page, tab) 500 super(ChromeProxyHTTPToDirectFallback, self).WillNavigateToPage(page, tab)
501 # Attempt to load a page through the nonexistent primary proxy in order to 501 # Attempt to load a page through the nonexistent primary proxy in order to
502 # cause a proxy fallback, and have this test run starting from the HTTP 502 # cause a proxy fallback, and have this test run starting from the HTTP
503 # fallback proxy. 503 # fallback proxy.
504 tab.Navigate(_TEST_SERVER_DEFAULT_URL) 504 tab.Navigate(_TEST_SERVER_DEFAULT_URL)
505 tab.WaitForJavaScriptCondition2( 505 tab.WaitForJavaScriptCondition(
506 'performance.timing.loadEventStart', timeout=300) 506 'performance.timing.loadEventStart', timeout=300)
507 507
508 def AddResults(self, tab, results): 508 def AddResults(self, tab, results):
509 self._metrics.AddResultsForHTTPToDirectFallback(tab, results, _TEST_SERVER) 509 self._metrics.AddResultsForHTTPToDirectFallback(tab, results, _TEST_SERVER)
510 510
511 511
512 class ChromeProxyReenableAfterBypass(ChromeProxyValidation): 512 class ChromeProxyReenableAfterBypass(ChromeProxyValidation):
513 """Correctness measurement for re-enabling proxies after bypasses. 513 """Correctness measurement for re-enabling proxies after bypasses.
514 514
515 This test loads a page that causes all data reduction proxies to be bypassed 515 This test loads a page that causes all data reduction proxies to be bypassed
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth') 597 options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth')
598 598
599 def WillNavigateToPage(self, page, tab): 599 def WillNavigateToPage(self, page, tab):
600 if self._enable_proxy: 600 if self._enable_proxy:
601 measurements.WaitForViaHeader(tab) 601 measurements.WaitForViaHeader(tab)
602 tab.ClearCache(force=True) 602 tab.ClearCache(force=True)
603 self._metrics.Start(page, tab) 603 self._metrics.Start(page, tab)
604 604
605 def ValidateAndMeasurePage(self, page, tab, results): 605 def ValidateAndMeasurePage(self, page, tab, results):
606 # Wait for the load event. 606 # Wait for the load event.
607 tab.WaitForJavaScriptCondition2( 607 tab.WaitForJavaScriptCondition(
608 'performance.timing.loadEventStart', timeout=300) 608 'performance.timing.loadEventStart', timeout=300)
609 self._metrics.Stop(page, tab) 609 self._metrics.Stop(page, tab)
610 page_to_metrics = { 610 page_to_metrics = {
611 'header validation': [self._metrics.AddResultsForHeaderValidation], 611 'header validation': [self._metrics.AddResultsForHeaderValidation],
612 'compression: image': [ 612 'compression: image': [
613 self._metrics.AddResultsForHeaderValidation, 613 self._metrics.AddResultsForHeaderValidation,
614 self._metrics.AddResultsForDataSaving, 614 self._metrics.AddResultsForDataSaving,
615 ], 615 ],
616 'compression: javascript': [ 616 'compression: javascript': [
617 self._metrics.AddResultsForHeaderValidation, 617 self._metrics.AddResultsForHeaderValidation,
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 '--enable-stats-collection-bindings') 796 '--enable-stats-collection-bindings')
797 797
798 def WillNavigateToPage(self, page, tab): 798 def WillNavigateToPage(self, page, tab):
799 if self._enable_proxy: 799 if self._enable_proxy:
800 measurements.WaitForViaHeader(tab) 800 measurements.WaitForViaHeader(tab)
801 tab.ClearCache(force=True) 801 tab.ClearCache(force=True)
802 self._metrics.Start(page, tab) 802 self._metrics.Start(page, tab)
803 803
804 def ValidateAndMeasurePage(self, page, tab, results): 804 def ValidateAndMeasurePage(self, page, tab, results):
805 # Wait for the load event. 805 # Wait for the load event.
806 tab.WaitForJavaScriptCondition2( 806 tab.WaitForJavaScriptCondition(
807 'performance.timing.loadEventStart', timeout=300) 807 'performance.timing.loadEventStart', timeout=300)
808 self._metrics.Stop(page, tab) 808 self._metrics.Stop(page, tab)
809 self._metrics.AddResultsForQuicTransaction(tab, results) 809 self._metrics.AddResultsForQuicTransaction(tab, results)
OLDNEW
« no previous file with comments | « tools/chrome_proxy/common/chrome_proxy_measurements.py ('k') | tools/chrome_proxy/integration_tests/chrome_proxy_metrics.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698