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

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

Issue 2539973004: Update reference to page_test module to use legacy_page_test module (Closed)
Patch Set: update Created 4 years 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
11 from integration_tests import chrome_proxy_metrics as metrics 11 from integration_tests import chrome_proxy_metrics as metrics
12 from metrics import loading 12 from metrics import loading
13 from telemetry.core import exceptions, util 13 from telemetry.core import exceptions, util
14 from telemetry.page import page_test 14 from telemetry.page import legacy_page_test
15 15
16 class ChromeProxyBypassOnTimeout(ChromeProxyValidation): 16 class ChromeProxyBypassOnTimeout(ChromeProxyValidation):
17 """Checks the client bypasses when endpoint site times out.""" 17 """Checks the client bypasses when endpoint site times out."""
18 18
19 def __init__(self): 19 def __init__(self):
20 super(ChromeProxyBypassOnTimeout, self).__init__( 20 super(ChromeProxyBypassOnTimeout, self).__init__(
21 restart_after_each_page=True, 21 restart_after_each_page=True,
22 metrics=metrics.ChromeProxyMetric()) 22 metrics=metrics.ChromeProxyMetric())
23 23
24 def CustomizeBrowserOptions(self, options): 24 def CustomizeBrowserOptions(self, options):
25 super(ChromeProxyBypassOnTimeout, self).CustomizeBrowserOptions( 25 super(ChromeProxyBypassOnTimeout, self).CustomizeBrowserOptions(
26 options) 26 options)
27 27
28 def AddResults(self, tab, results): 28 def AddResults(self, tab, results):
29 self._metrics.AddResultsForBypassOnTimeout(tab, results) 29 self._metrics.AddResultsForBypassOnTimeout(tab, results)
30 30
31 class ChromeProxyDataSaving(page_test.PageTest): 31 class ChromeProxyDataSaving(legacy_page_test.LegacyPageTest):
32 """Chrome proxy data saving measurement.""" 32 """Chrome proxy data saving measurement."""
33 def __init__(self, *args, **kwargs): 33 def __init__(self, *args, **kwargs):
34 super(ChromeProxyDataSaving, self).__init__(*args, **kwargs) 34 super(ChromeProxyDataSaving, self).__init__(*args, **kwargs)
35 self._metrics = metrics.ChromeProxyMetric() 35 self._metrics = metrics.ChromeProxyMetric()
36 self._enable_proxy = True 36 self._enable_proxy = True
37 37
38 def CustomizeBrowserOptions(self, options): 38 def CustomizeBrowserOptions(self, options):
39 if self._enable_proxy: 39 if self._enable_proxy:
40 options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth') 40 options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth')
41 41
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 ], 568 ],
569 'bypass': [self._metrics.AddResultsForBypass], 569 'bypass': [self._metrics.AddResultsForBypass],
570 } 570 }
571 if not self._page.name in page_to_metrics: 571 if not self._page.name in page_to_metrics:
572 raise page_test.MeasurementFailure( 572 raise page_test.MeasurementFailure(
573 'Invalid page name (%s) in smoke. Page name must be one of:\n%s' % ( 573 'Invalid page name (%s) in smoke. Page name must be one of:\n%s' % (
574 self._page.name, page_to_metrics.keys())) 574 self._page.name, page_to_metrics.keys()))
575 for add_result in page_to_metrics[self._page.name]: 575 for add_result in page_to_metrics[self._page.name]:
576 add_result(tab, results) 576 add_result(tab, results)
577 577
578 class ChromeProxyQuicSmoke(page_test.PageTest): 578 class ChromeProxyQuicSmoke(legacy_page_test.LegacyPageTest):
579 """Smoke measurement for basic chrome proxy correctness when using a 579 """Smoke measurement for basic chrome proxy correctness when using a
580 proxy that supports QUIC.""" 580 proxy that supports QUIC."""
581 581
582 def __init__(self, *args, **kwargs): 582 def __init__(self, *args, **kwargs):
583 super(ChromeProxyQuicSmoke, self).__init__(*args, **kwargs) 583 super(ChromeProxyQuicSmoke, self).__init__(*args, **kwargs)
584 self._metrics = metrics.ChromeProxyMetric() 584 self._metrics = metrics.ChromeProxyMetric()
585 self._enable_proxy = True 585 self._enable_proxy = True
586 586
587 def CustomizeBrowserOptions(self, options): 587 def CustomizeBrowserOptions(self, options):
588 super(ChromeProxyQuicSmoke, self).CustomizeBrowserOptions(options) 588 super(ChromeProxyQuicSmoke, self).CustomizeBrowserOptions(options)
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 641
642 def CustomizeBrowserOptions(self, options): 642 def CustomizeBrowserOptions(self, options):
643 super(ChromeProxyClientConfig, self).CustomizeBrowserOptions(options) 643 super(ChromeProxyClientConfig, self).CustomizeBrowserOptions(options)
644 options.AppendExtraBrowserArgs( 644 options.AppendExtraBrowserArgs(
645 '--enable-data-reduction-proxy-config-client') 645 '--enable-data-reduction-proxy-config-client')
646 options.AppendExtraBrowserArgs('--disable-quic') 646 options.AppendExtraBrowserArgs('--disable-quic')
647 647
648 def AddResults(self, tab, results): 648 def AddResults(self, tab, results):
649 self._metrics.AddResultsForClientConfig(tab, results) 649 self._metrics.AddResultsForClientConfig(tab, results)
650 650
651 class ChromeProxyVideoValidation(page_test.PageTest): 651 class ChromeProxyVideoValidation(legacy_page_test.LegacyPageTest):
652 """Validation for video pages. 652 """Validation for video pages.
653 653
654 Measures pages using metrics.ChromeProxyVideoMetric. Pages can be fetched 654 Measures pages using metrics.ChromeProxyVideoMetric. Pages can be fetched
655 either direct from the origin server or via the proxy. If a page is fetched 655 either direct from the origin server or via the proxy. If a page is fetched
656 both ways, then the PROXIED and DIRECT measurements are compared to ensure 656 both ways, then the PROXIED and DIRECT measurements are compared to ensure
657 the same video was loaded in both cases. 657 the same video was loaded in both cases.
658 """ 658 """
659 659
660 def __init__(self): 660 def __init__(self):
661 super(ChromeProxyVideoValidation, self).__init__( 661 super(ChromeProxyVideoValidation, self).__init__(
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 err('Mismatch for %s (proxied=%s direct=%s): %s' % 727 err('Mismatch for %s (proxied=%s direct=%s): %s' %
728 (x, str(pm[x]), str(dm[x]), page.url)) 728 (x, str(pm[x]), str(dm[x]), page.url))
729 729
730 # Proxied XOCL should match direct CL. 730 # Proxied XOCL should match direct CL.
731 pxocl = pm['x_original_content_length_header'] 731 pxocl = pm['x_original_content_length_header']
732 dcl = dm['content_length_header'] 732 dcl = dm['content_length_header']
733 if pxocl != dcl: 733 if pxocl != dcl:
734 err('Mismatch for content length (proxied=%s direct=%s): %s' % 734 err('Mismatch for content length (proxied=%s direct=%s): %s' %
735 (str(pxocl), str(dcl), page.url)) 735 (str(pxocl), str(dcl), page.url))
736 736
737 class ChromeProxyInstrumentedVideoValidation(page_test.PageTest): 737 class ChromeProxyInstrumentedVideoValidation(legacy_page_test.LegacyPageTest):
738 """Tests a specially instrumented page for correct video transcoding.""" 738 """Tests a specially instrumented page for correct video transcoding."""
739 739
740 def __init__(self): 740 def __init__(self):
741 super(ChromeProxyInstrumentedVideoValidation, self).__init__( 741 super(ChromeProxyInstrumentedVideoValidation, self).__init__(
742 needs_browser_restart_after_each_page=True, 742 needs_browser_restart_after_each_page=True,
743 clear_cache_before_each_run=True) 743 clear_cache_before_each_run=True)
744 self._metrics = metrics.ChromeProxyInstrumentedVideoMetric() 744 self._metrics = metrics.ChromeProxyInstrumentedVideoMetric()
745 745
746 def CustomizeBrowserOptions(self, options): 746 def CustomizeBrowserOptions(self, options):
747 options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth') 747 options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth')
(...skipping 17 matching lines...) Expand all
765 def CustomizeBrowserOptions(self, options): 765 def CustomizeBrowserOptions(self, options):
766 super(ChromeProxyPingback, self).CustomizeBrowserOptions(options) 766 super(ChromeProxyPingback, self).CustomizeBrowserOptions(options)
767 options.AppendExtraBrowserArgs( 767 options.AppendExtraBrowserArgs(
768 '--enable-data-reduction-proxy-force-pingback') 768 '--enable-data-reduction-proxy-force-pingback')
769 options.AppendExtraBrowserArgs( 769 options.AppendExtraBrowserArgs(
770 '--enable-stats-collection-bindings') 770 '--enable-stats-collection-bindings')
771 771
772 def AddResults(self, tab, results): 772 def AddResults(self, tab, results):
773 self._metrics.AddResultsForPingback(tab, results) 773 self._metrics.AddResultsForPingback(tab, results)
774 774
775 class ChromeProxyQuicTransaction(page_test.PageTest): 775 class ChromeProxyQuicTransaction(legacy_page_test.LegacyPageTest):
776 """Chrome quic proxy usage validation when connecting to a proxy that 776 """Chrome quic proxy usage validation when connecting to a proxy that
777 supports QUIC.""" 777 supports QUIC."""
778 778
779 def __init__(self, *args, **kwargs): 779 def __init__(self, *args, **kwargs):
780 super(ChromeProxyQuicTransaction, self).__init__(*args, **kwargs) 780 super(ChromeProxyQuicTransaction, self).__init__(*args, **kwargs)
781 self._metrics = metrics.ChromeProxyMetric() 781 self._metrics = metrics.ChromeProxyMetric()
782 self._enable_proxy = True 782 self._enable_proxy = True
783 783
784 def CustomizeBrowserOptions(self, options): 784 def CustomizeBrowserOptions(self, options):
785 options.AppendExtraBrowserArgs( 785 options.AppendExtraBrowserArgs(
(...skipping 10 matching lines...) Expand all
796 if self._enable_proxy: 796 if self._enable_proxy:
797 measurements.WaitForViaHeader(tab) 797 measurements.WaitForViaHeader(tab)
798 tab.ClearCache(force=True) 798 tab.ClearCache(force=True)
799 self._metrics.Start(page, tab) 799 self._metrics.Start(page, tab)
800 800
801 def ValidateAndMeasurePage(self, page, tab, results): 801 def ValidateAndMeasurePage(self, page, tab, results):
802 # Wait for the load event. 802 # Wait for the load event.
803 tab.WaitForJavaScriptExpression('performance.timing.loadEventStart', 300) 803 tab.WaitForJavaScriptExpression('performance.timing.loadEventStart', 300)
804 self._metrics.Stop(page, tab) 804 self._metrics.Stop(page, tab)
805 self._metrics.AddResultsForQuicTransaction(tab, results) 805 self._metrics.AddResultsForQuicTransaction(tab, results)
OLDNEW
« no previous file with comments | « tools/chrome_proxy/common/network_metrics.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