Commit 2adf1996 authored by bolian@chromium.org's avatar bolian@chromium.org

Move chrome_proxy tests from under tools/perf to tools/chrome_proxy/integration_tests.

BUG=393360

Review URL: https://codereview.chromium.org/397483002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284310 0039d316-1c4b-4281-b951-d872f2087c98
parent 19c5eafc
bengr@chromium.org bengr@chromium.org
bolian@chromium.org bolian@chromium.org
kundaji@chromium.org
marq@chromium.org marq@chromium.org
megjablon@chromium.org
...@@ -2,105 +2,105 @@ ...@@ -2,105 +2,105 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
from measurements import chrome_proxy from integration_tests import chrome_proxy_measurements as measurements
import page_sets from integration_tests import chrome_proxy_pagesets as pagesets
from telemetry import benchmark from telemetry import benchmark
@benchmark.Disabled @benchmark.Enabled('android')
class ChromeProxyLatency(benchmark.Benchmark): class ChromeProxyLatency(benchmark.Benchmark):
tag = 'latency' tag = 'latency'
test = chrome_proxy.ChromeProxyLatency test = measurements.ChromeProxyLatency
page_set = page_sets.Top20PageSet page_set = pagesets.Top20PageSet
options = {'pageset_repeat_iters': 2} options = {'pageset_repeat_iters': 2}
def CustomizeBrowserOptions(self, options): def CustomizeBrowserOptions(self, options):
options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth') options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth')
@benchmark.Disabled @benchmark.Enabled('android')
class ChromeProxyLatencyDirect(benchmark.Benchmark): class ChromeProxyLatencyDirect(benchmark.Benchmark):
tag = 'latency_direct' tag = 'latency_direct'
test = chrome_proxy.ChromeProxyLatency test = measurements.ChromeProxyLatency
page_set = page_sets.Top20PageSet page_set = pagesets.Top20PageSet
options = {'pageset_repeat_iters': 2} options = {'pageset_repeat_iters': 2}
@benchmark.Disabled @benchmark.Enabled('android')
class ChromeProxyLatencySynthetic(ChromeProxyLatency): class ChromeProxyLatencySynthetic(ChromeProxyLatency):
page_set = page_sets.SyntheticPageSet page_set = pagesets.SyntheticPageSet
@benchmark.Disabled @benchmark.Enabled('android')
class ChromeProxyLatencySyntheticDirect(ChromeProxyLatencyDirect): class ChromeProxyLatencySyntheticDirect(ChromeProxyLatencyDirect):
page_set = page_sets.SyntheticPageSet page_set = pagesets.SyntheticPageSet
@benchmark.Disabled @benchmark.Enabled('android')
class ChromeProxyDataSaving(benchmark.Benchmark): class ChromeProxyDataSaving(benchmark.Benchmark):
tag = 'data_saving' tag = 'data_saving'
test = chrome_proxy.ChromeProxyDataSaving test = measurements.ChromeProxyDataSaving
page_set = page_sets.Top20PageSet page_set = pagesets.Top20PageSet
options = {'pageset_repeat_iters': 1} options = {'pageset_repeat_iters': 1}
def CustomizeBrowserOptions(self, options): def CustomizeBrowserOptions(self, options):
options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth') options.AppendExtraBrowserArgs('--enable-spdy-proxy-auth')
@benchmark.Disabled @benchmark.Enabled('android')
class ChromeProxyDataSavingDirect(benchmark.Benchmark): class ChromeProxyDataSavingDirect(benchmark.Benchmark):
tag = 'data_saving_direct' tag = 'data_saving_direct'
test = chrome_proxy.ChromeProxyDataSaving test = measurements.ChromeProxyDataSaving
page_set = page_sets.Top20PageSet page_set = pagesets.Top20PageSet
options = {'pageset_repeat_iters': 2} options = {'pageset_repeat_iters': 2}
@benchmark.Disabled @benchmark.Enabled('android')
class ChromeProxyDataSavingSynthetic(ChromeProxyDataSaving): class ChromeProxyDataSavingSynthetic(ChromeProxyDataSaving):
page_set = page_sets.SyntheticPageSet page_set = pagesets.SyntheticPageSet
@benchmark.Disabled @benchmark.Enabled('android')
class ChromeProxyDataSavingSyntheticDirect(ChromeProxyDataSavingDirect): class ChromeProxyDataSavingSyntheticDirect(ChromeProxyDataSavingDirect):
page_set = page_sets.SyntheticPageSet page_set = pagesets.SyntheticPageSet
@benchmark.Disabled @benchmark.Enabled('android')
class ChromeProxyHeaderValidation(benchmark.Benchmark): class ChromeProxyHeaderValidation(benchmark.Benchmark):
tag = 'header_validation' tag = 'header_validation'
test = chrome_proxy.ChromeProxyHeaders test = measurements.ChromeProxyHeaders
page_set = page_sets.Top20PageSet page_set = pagesets.Top20PageSet
@benchmark.Disabled @benchmark.Enabled('android')
class ChromeProxyBypass(benchmark.Benchmark): class ChromeProxyBypass(benchmark.Benchmark):
tag = 'bypass' tag = 'bypass'
test = chrome_proxy.ChromeProxyBypass test = measurements.ChromeProxyBypass
page_set = page_sets.BypassPageSet page_set = pagesets.BypassPageSet
@benchmark.Disabled @benchmark.Enabled('android')
class ChromeProxySafeBrowsing(benchmark.Benchmark): class ChromeProxySafeBrowsing(benchmark.Benchmark):
tag = 'safebrowsing' tag = 'safebrowsing'
test = chrome_proxy.ChromeProxySafebrowsing test = measurements.ChromeProxySafebrowsing
page_set = page_sets.SafebrowsingPageSet page_set = pagesets.SafebrowsingPageSet
@benchmark.Disabled @benchmark.Enabled('android')
class ChromeProxyHTTPFallbackProbeURL(benchmark.Benchmark): class ChromeProxyHTTPFallbackProbeURL(benchmark.Benchmark):
tag = 'fallback-probe' tag = 'fallback-probe'
test = chrome_proxy.ChromeProxyHTTPFallbackProbeURL test = measurements.ChromeProxyHTTPFallbackProbeURL
page_set = page_sets.SyntheticPageSet page_set = pagesets.SyntheticPageSet
@benchmark.Disabled @benchmark.Enabled('android')
class ChromeProxyHTTPFallbackViaHeader(benchmark.Benchmark): class ChromeProxyHTTPFallbackViaHeader(benchmark.Benchmark):
tag = 'fallback-viaheader' tag = 'fallback-viaheader'
test = chrome_proxy.ChromeProxyHTTPFallbackViaHeader test = measurements.ChromeProxyHTTPFallbackViaHeader
page_set = page_sets.FallbackViaHeaderPageSet page_set = pagesets.FallbackViaHeaderPageSet
@benchmark.Disabled @benchmark.Enabled('android')
class ChromeProxySmoke(benchmark.Benchmark): class ChromeProxySmoke(benchmark.Benchmark):
tag = 'smoke' tag = 'smoke'
test = chrome_proxy.ChromeProxySmoke test = measurements.ChromeProxySmoke
page_set = page_sets.SmokePageSet page_set = pagesets.SmokePageSet
...@@ -6,7 +6,7 @@ import base64 ...@@ -6,7 +6,7 @@ import base64
import logging import logging
import urlparse import urlparse
from metrics import chrome_proxy from integration_tests import chrome_proxy_metrics as metrics
from metrics import loading from metrics import loading
from telemetry.core import util from telemetry.core import util
from telemetry.page import page_measurement from telemetry.page import page_measurement
...@@ -31,7 +31,7 @@ class ChromeProxyDataSaving(page_measurement.PageMeasurement): ...@@ -31,7 +31,7 @@ class ChromeProxyDataSaving(page_measurement.PageMeasurement):
"""Chrome proxy data daving measurement.""" """Chrome proxy data daving measurement."""
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(ChromeProxyDataSaving, self).__init__(*args, **kwargs) super(ChromeProxyDataSaving, self).__init__(*args, **kwargs)
self._metrics = chrome_proxy.ChromeProxyMetric() self._metrics = metrics.ChromeProxyMetric()
def WillNavigateToPage(self, page, tab): def WillNavigateToPage(self, page, tab):
tab.ClearCache(force=True) tab.ClearCache(force=True)
...@@ -50,7 +50,7 @@ class ChromeProxyValidation(page_measurement.PageMeasurement): ...@@ -50,7 +50,7 @@ class ChromeProxyValidation(page_measurement.PageMeasurement):
def __init__(self, restart_after_each_page=False): def __init__(self, restart_after_each_page=False):
super(ChromeProxyValidation, self).__init__( super(ChromeProxyValidation, self).__init__(
needs_browser_restart_after_each_page=restart_after_each_page) needs_browser_restart_after_each_page=restart_after_each_page)
self._metrics = chrome_proxy.ChromeProxyMetric() self._metrics = metrics.ChromeProxyMetric()
self._page = None self._page = None
# Whether a timeout exception is expected during the test. # Whether a timeout exception is expected during the test.
self._expect_timeout = False self._expect_timeout = False
......
...@@ -6,8 +6,8 @@ import datetime ...@@ -6,8 +6,8 @@ import datetime
import logging import logging
import os import os
from integration_tests import network_metrics
from telemetry.page import page_measurement from telemetry.page import page_measurement
from metrics import network
from telemetry.value import scalar from telemetry.value import scalar
...@@ -30,7 +30,8 @@ DEFAULT_BYPASS_MAX_SECONDS = 5 * 60 ...@@ -30,7 +30,8 @@ DEFAULT_BYPASS_MAX_SECONDS = 5 * 60
def GetProxyInfoFromNetworkInternals(tab, url='chrome://net-internals#proxy'): def GetProxyInfoFromNetworkInternals(tab, url='chrome://net-internals#proxy'):
tab.Navigate(url) tab.Navigate(url)
with open(os.path.join(os.path.dirname(__file__), 'chrome_proxy.js')) as f: with open(os.path.join(os.path.dirname(__file__),
'chrome_proxy_metrics.js')) as f:
js = f.read() js = f.read()
tab.ExecuteJavaScript(js) tab.ExecuteJavaScript(js)
tab.WaitForJavaScriptExpression('performance.timing.loadEventStart', 300) tab.WaitForJavaScriptExpression('performance.timing.loadEventStart', 300)
...@@ -43,7 +44,7 @@ def ProxyRetryTimeInRange(retry_time, low, high, grace_seconds=30): ...@@ -43,7 +44,7 @@ def ProxyRetryTimeInRange(retry_time, low, high, grace_seconds=30):
(retry_time < high + datetime.timedelta(seconds=grace_seconds))) (retry_time < high + datetime.timedelta(seconds=grace_seconds)))
class ChromeProxyResponse(network.HTTPResponse): class ChromeProxyResponse(network_metrics.HTTPResponse):
""" Represents an HTTP response from a timeleine event.""" """ Represents an HTTP response from a timeleine event."""
def __init__(self, event): def __init__(self, event):
super(ChromeProxyResponse, self).__init__(event) super(ChromeProxyResponse, self).__init__(event)
...@@ -88,7 +89,7 @@ class ChromeProxyResponse(network.HTTPResponse): ...@@ -88,7 +89,7 @@ class ChromeProxyResponse(network.HTTPResponse):
return False return False
class ChromeProxyMetric(network.NetworkMetric): class ChromeProxyMetric(network_metrics.NetworkMetric):
"""A Chrome proxy timeline metric.""" """A Chrome proxy timeline metric."""
def __init__(self): def __init__(self):
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
import base64 import base64
import unittest import unittest
from metrics import chrome_proxy from integration_tests import chrome_proxy_metrics as metrics
from metrics import network_unittest from integration_tests import network_metrics_unittest as network_unittest
from metrics import test_page_measurement_results from metrics import test_page_measurement_results
...@@ -28,7 +28,7 @@ EVENT_HTML_PROXY_DEPRECATED_VIA = ( ...@@ -28,7 +28,7 @@ EVENT_HTML_PROXY_DEPRECATED_VIA = (
'Content-Type': 'text/html', 'Content-Type': 'text/html',
'Content-Encoding': 'gzip', 'Content-Encoding': 'gzip',
'X-Original-Content-Length': str(len(network_unittest.HTML_BODY)), 'X-Original-Content-Length': str(len(network_unittest.HTML_BODY)),
'Via': (chrome_proxy.CHROME_PROXY_VIA_HEADER_DEPRECATED + 'Via': (metrics.CHROME_PROXY_VIA_HEADER_DEPRECATED +
',other-via'), ',other-via'),
}, },
body=network_unittest.HTML_BODY)) body=network_unittest.HTML_BODY))
...@@ -41,7 +41,7 @@ EVENT_IMAGE_PROXY_CACHED = ( ...@@ -41,7 +41,7 @@ EVENT_IMAGE_PROXY_CACHED = (
'Content-Type': 'image/jpeg', 'Content-Type': 'image/jpeg',
'Content-Encoding': 'gzip', 'Content-Encoding': 'gzip',
'X-Original-Content-Length': str(network_unittest.IMAGE_OCL), 'X-Original-Content-Length': str(network_unittest.IMAGE_OCL),
'Via': '1.1 ' + chrome_proxy.CHROME_PROXY_VIA_HEADER, 'Via': '1.1 ' + metrics.CHROME_PROXY_VIA_HEADER,
}, },
body=base64.b64encode(network_unittest.IMAGE_BODY), body=base64.b64encode(network_unittest.IMAGE_BODY),
base64_encoded_body=True, base64_encoded_body=True,
...@@ -64,7 +64,7 @@ EVENT_MALWARE_PROXY = ( ...@@ -64,7 +64,7 @@ EVENT_MALWARE_PROXY = (
url='http://test.malware', url='http://test.malware',
response_headers={ response_headers={
'X-Malware-Url': '1', 'X-Malware-Url': '1',
'Via': '1.1 ' + chrome_proxy.CHROME_PROXY_VIA_HEADER, 'Via': '1.1 ' + metrics.CHROME_PROXY_VIA_HEADER,
'Location': 'http://test.malware', 'Location': 'http://test.malware',
}, },
status=307)) status=307))
...@@ -77,12 +77,12 @@ class ChromeProxyMetricTest(unittest.TestCase): ...@@ -77,12 +77,12 @@ class ChromeProxyMetricTest(unittest.TestCase):
def _StubGetProxyInfo(self, info): def _StubGetProxyInfo(self, info):
def stub(unused_tab, unused_url=''): # pylint: disable=W0613 def stub(unused_tab, unused_url=''): # pylint: disable=W0613
return ChromeProxyMetricTest._test_proxy_info return ChromeProxyMetricTest._test_proxy_info
chrome_proxy.GetProxyInfoFromNetworkInternals = stub metrics.GetProxyInfoFromNetworkInternals = stub
ChromeProxyMetricTest._test_proxy_info = info ChromeProxyMetricTest._test_proxy_info = info
def testChromeProxyResponse(self): def testChromeProxyResponse(self):
# An https non-proxy response. # An https non-proxy response.
resp = chrome_proxy.ChromeProxyResponse( resp = metrics.ChromeProxyResponse(
network_unittest.NetworkMetricTest.MakeNetworkTimelineEvent( network_unittest.NetworkMetricTest.MakeNetworkTimelineEvent(
url='https://test.url', url='https://test.url',
response_headers={ response_headers={
...@@ -96,13 +96,13 @@ class ChromeProxyMetricTest(unittest.TestCase): ...@@ -96,13 +96,13 @@ class ChromeProxyMetricTest(unittest.TestCase):
self.assertTrue(resp.IsValidByViaHeader()) self.assertTrue(resp.IsValidByViaHeader())
# A proxied JPEG image response # A proxied JPEG image response
resp = chrome_proxy.ChromeProxyResponse( resp = metrics.ChromeProxyResponse(
network_unittest.NetworkMetricTest.MakeNetworkTimelineEvent( network_unittest.NetworkMetricTest.MakeNetworkTimelineEvent(
url='http://test.image', url='http://test.image',
response_headers={ response_headers={
'Content-Type': 'image/jpeg', 'Content-Type': 'image/jpeg',
'Content-Encoding': 'gzip', 'Content-Encoding': 'gzip',
'Via': '1.1 ' + chrome_proxy.CHROME_PROXY_VIA_HEADER, 'Via': '1.1 ' + metrics.CHROME_PROXY_VIA_HEADER,
'X-Original-Content-Length': str(network_unittest.IMAGE_OCL), 'X-Original-Content-Length': str(network_unittest.IMAGE_OCL),
}, },
body=base64.b64encode(network_unittest.IMAGE_BODY), body=base64.b64encode(network_unittest.IMAGE_BODY),
...@@ -112,7 +112,7 @@ class ChromeProxyMetricTest(unittest.TestCase): ...@@ -112,7 +112,7 @@ class ChromeProxyMetricTest(unittest.TestCase):
self.assertTrue(resp.IsValidByViaHeader()) self.assertTrue(resp.IsValidByViaHeader())
def testChromeProxyMetricForDataSaving(self): def testChromeProxyMetricForDataSaving(self):
metric = chrome_proxy.ChromeProxyMetric() metric = metrics.ChromeProxyMetric()
events = [ events = [
EVENT_HTML_PROXY, EVENT_HTML_PROXY,
EVENT_HTML_PROXY_DEPRECATED_VIA, EVENT_HTML_PROXY_DEPRECATED_VIA,
...@@ -129,7 +129,7 @@ class ChromeProxyMetricTest(unittest.TestCase): ...@@ -129,7 +129,7 @@ class ChromeProxyMetricTest(unittest.TestCase):
results.AssertHasPageSpecificScalarValue('resources_direct', 'count', 2) results.AssertHasPageSpecificScalarValue('resources_direct', 'count', 2)
def testChromeProxyMetricForHeaderValidation(self): def testChromeProxyMetricForHeaderValidation(self):
metric = chrome_proxy.ChromeProxyMetric() metric = metrics.ChromeProxyMetric()
metric.SetEvents([ metric.SetEvents([
EVENT_HTML_PROXY, EVENT_HTML_PROXY,
EVENT_HTML_PROXY_DEPRECATED_VIA, EVENT_HTML_PROXY_DEPRECATED_VIA,
...@@ -141,7 +141,7 @@ class ChromeProxyMetricTest(unittest.TestCase): ...@@ -141,7 +141,7 @@ class ChromeProxyMetricTest(unittest.TestCase):
missing_via_exception = False missing_via_exception = False
try: try:
metric.AddResultsForHeaderValidation(None, results) metric.AddResultsForHeaderValidation(None, results)
except chrome_proxy.ChromeProxyMetricException: except metrics.ChromeProxyMetricException:
missing_via_exception = True missing_via_exception = True
# Only the HTTP image response does not have a valid Via header. # Only the HTTP image response does not have a valid Via header.
self.assertTrue(missing_via_exception) self.assertTrue(missing_via_exception)
...@@ -154,7 +154,7 @@ class ChromeProxyMetricTest(unittest.TestCase): ...@@ -154,7 +154,7 @@ class ChromeProxyMetricTest(unittest.TestCase):
results.AssertHasPageSpecificScalarValue('checked_via_header', 'count', 2) results.AssertHasPageSpecificScalarValue('checked_via_header', 'count', 2)
def testChromeProxyMetricForBypass(self): def testChromeProxyMetricForBypass(self):
metric = chrome_proxy.ChromeProxyMetric() metric = metrics.ChromeProxyMetric()
metric.SetEvents([ metric.SetEvents([
EVENT_HTML_PROXY, EVENT_HTML_PROXY,
EVENT_HTML_PROXY_DEPRECATED_VIA, EVENT_HTML_PROXY_DEPRECATED_VIA,
...@@ -165,7 +165,7 @@ class ChromeProxyMetricTest(unittest.TestCase): ...@@ -165,7 +165,7 @@ class ChromeProxyMetricTest(unittest.TestCase):
bypass_exception = False bypass_exception = False
try: try:
metric.AddResultsForBypass(None, results) metric.AddResultsForBypass(None, results)
except chrome_proxy.ChromeProxyMetricException: except metrics.ChromeProxyMetricException:
bypass_exception = True bypass_exception = True
# Two of the first three events have Via headers. # Two of the first three events have Via headers.
self.assertTrue(bypass_exception) self.assertTrue(bypass_exception)
...@@ -176,7 +176,7 @@ class ChromeProxyMetricTest(unittest.TestCase): ...@@ -176,7 +176,7 @@ class ChromeProxyMetricTest(unittest.TestCase):
results.AssertHasPageSpecificScalarValue('bypass', 'count', 1) results.AssertHasPageSpecificScalarValue('bypass', 'count', 1)
def testChromeProxyMetricForHTTPFallback(self): def testChromeProxyMetricForHTTPFallback(self):
metric = chrome_proxy.ChromeProxyMetric() metric = metrics.ChromeProxyMetric()
metric.SetEvents([ metric.SetEvents([
EVENT_HTML_PROXY, EVENT_HTML_PROXY,
EVENT_HTML_PROXY_DEPRECATED_VIA]) EVENT_HTML_PROXY_DEPRECATED_VIA])
...@@ -188,7 +188,7 @@ class ChromeProxyMetricTest(unittest.TestCase): ...@@ -188,7 +188,7 @@ class ChromeProxyMetricTest(unittest.TestCase):
self._StubGetProxyInfo(info) self._StubGetProxyInfo(info)
try: try:
metric.AddResultsForBypass(None, results) metric.AddResultsForBypass(None, results)
except chrome_proxy.ChromeProxyMetricException: except metrics.ChromeProxyMetricException:
fallback_exception = True fallback_exception = True
self.assertTrue(fallback_exception) self.assertTrue(fallback_exception)
...@@ -196,25 +196,25 @@ class ChromeProxyMetricTest(unittest.TestCase): ...@@ -196,25 +196,25 @@ class ChromeProxyMetricTest(unittest.TestCase):
info['enabled'] = True info['enabled'] = True
info['proxies'] = [ info['proxies'] = [
'something.else.com:80', 'something.else.com:80',
chrome_proxy.PROXY_SETTING_DIRECT metrics.PROXY_SETTING_DIRECT
] ]
self._StubGetProxyInfo(info) self._StubGetProxyInfo(info)
try: try:
metric.AddResultsForBypass(None, results) metric.AddResultsForBypass(None, results)
except chrome_proxy.ChromeProxyMetricException: except metrics.ChromeProxyMetricException:
fallback_exception = True fallback_exception = True
self.assertTrue(fallback_exception) self.assertTrue(fallback_exception)
info['enabled'] = True info['enabled'] = True
info['proxies'] = [ info['proxies'] = [
chrome_proxy.PROXY_SETTING_HTTP, metrics.PROXY_SETTING_HTTP,
chrome_proxy.PROXY_SETTING_DIRECT metrics.PROXY_SETTING_DIRECT
] ]
self._StubGetProxyInfo(info) self._StubGetProxyInfo(info)
metric.AddResultsForHTTPFallback(None, results) metric.AddResultsForHTTPFallback(None, results)
def testChromeProxyMetricForSafebrowsing(self): def testChromeProxyMetricForSafebrowsing(self):
metric = chrome_proxy.ChromeProxyMetric() metric = metrics.ChromeProxyMetric()
metric.SetEvents([EVENT_MALWARE_PROXY]) metric.SetEvents([EVENT_MALWARE_PROXY])
results = test_page_measurement_results.TestPageMeasurementResults(self) results = test_page_measurement_results.TestPageMeasurementResults(self)
......
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import inspect
import os
import sys
from telemetry.core import discover
from telemetry.page import page_set
# Import all submodules' PageSet classes.
start_dir = os.path.dirname(os.path.abspath(__file__))
top_level_dir = os.path.abspath(os.path.join(start_dir, os.pardir, os.pardir))
base_class = page_set.PageSet
for cls in discover.DiscoverClasses(
start_dir, top_level_dir, base_class).values():
setattr(sys.modules[__name__], cls.__name__, cls)
# Copyright 2014 The Chromium Authors. All rights reserved. # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
from telemetry.page import page as page_module from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module from telemetry.page import page_set as page_set_module
......
# Copyright 2014 The Chromium Authors. All rights reserved. # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
from telemetry.page import page as page_module from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module from telemetry.page import page_set as page_set_module
......
# Copyright 2014 The Chromium Authors. All rights reserved. # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
from telemetry.page import page as page_module from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module from telemetry.page import page_set as page_set_module
......
# Copyright 2014 The Chromium Authors. All rights reserved. # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
from telemetry.page import page as page_module from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module from telemetry.page import page_set as page_set_module
......
# Copyright 2014 The Chromium Authors. All rights reserved. # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
from telemetry.page import page as page_module from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module from telemetry.page import page_set as page_set_module
......
# Copyright 2014 The Chromium Authors. All rights reserved. # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
from telemetry.page import page as page_module from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module from telemetry.page import page_set as page_set_module
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
import base64 import base64
import unittest import unittest
from integration_tests import network_metrics
from metrics import test_page_measurement_results from metrics import test_page_measurement_results
from metrics import network
from telemetry.timeline import event from telemetry.timeline import event
...@@ -18,7 +18,7 @@ HTML_BODY = """<!DOCTYPE HTML> ...@@ -18,7 +18,7 @@ HTML_BODY = """<!DOCTYPE HTML>
</body> </body>
</html>""" </html>"""
IMAGE_BODY = """fake image data""" IMAGE_BODY = """fake image data"""
GZIPPED_HTML_LEN = network.HTTPResponse.GetGizppedBodyLength(HTML_BODY) GZIPPED_HTML_LEN = network_metrics.HTTPResponse.GetGizppedBodyLength(HTML_BODY)
# Make up original content length for the image. # Make up original content length for the image.
IMAGE_OCL = 3 * len(IMAGE_BODY) IMAGE_OCL = 3 * len(IMAGE_BODY)
...@@ -49,7 +49,7 @@ class NetworkMetricTest(unittest.TestCase): ...@@ -49,7 +49,7 @@ class NetworkMetricTest(unittest.TestCase):
self.assertLess(GZIPPED_HTML_LEN, len(HTML_BODY)) self.assertLess(GZIPPED_HTML_LEN, len(HTML_BODY))
# A plain text HTML response # A plain text HTML response
resp = network.HTTPResponse(self.MakeNetworkTimelineEvent( resp = network_metrics.HTTPResponse(self.MakeNetworkTimelineEvent(
url=url, url=url,
response_headers={ response_headers={
'Content-Type': 'text/html', 'Content-Type': 'text/html',
...@@ -68,7 +68,7 @@ class NetworkMetricTest(unittest.TestCase): ...@@ -68,7 +68,7 @@ class NetworkMetricTest(unittest.TestCase):
self.assertEqual(0.0, resp.data_saving_rate) self.assertEqual(0.0, resp.data_saving_rate)
# A gzipped HTML response # A gzipped HTML response
resp = network.HTTPResponse(self.MakeNetworkTimelineEvent( resp = network_metrics.HTTPResponse(self.MakeNetworkTimelineEvent(
url=url, url=url,
response_headers={ response_headers={
'Content-Type': 'text/html', 'Content-Type': 'text/html',
...@@ -87,7 +87,7 @@ class NetworkMetricTest(unittest.TestCase): ...@@ -87,7 +87,7 @@ class NetworkMetricTest(unittest.TestCase):
resp.data_saving_rate) resp.data_saving_rate)
# A JPEG image response. # A JPEG image response.
resp = network.HTTPResponse(self.MakeNetworkTimelineEvent( resp = network_metrics.HTTPResponse(self.MakeNetworkTimelineEvent(
url='http://test.image', url='http://test.image',
response_headers={ response_headers={
'Content-Type': 'image/jpeg', 'Content-Type': 'image/jpeg',
...@@ -107,7 +107,7 @@ class NetworkMetricTest(unittest.TestCase): ...@@ -107,7 +107,7 @@ class NetworkMetricTest(unittest.TestCase):
resp.data_saving_rate) resp.data_saving_rate)
# A JPEG image response from cache. # A JPEG image response from cache.
resp = network.HTTPResponse(self.MakeNetworkTimelineEvent( resp = network_metrics.HTTPResponse(self.MakeNetworkTimelineEvent(
url='http://test.image', url='http://test.image',
response_headers={ response_headers={
'Content-Type': 'image/jpeg', 'Content-Type': 'image/jpeg',
...@@ -154,7 +154,7 @@ class NetworkMetricTest(unittest.TestCase): ...@@ -154,7 +154,7 @@ class NetworkMetricTest(unittest.TestCase):
body=base64.b64encode(IMAGE_BODY), body=base64.b64encode(IMAGE_BODY),
base64_encoded_body=True), base64_encoded_body=True),
] ]
metric = network.NetworkMetric() metric = network_metrics.NetworkMetric()
metric._events = events metric._events = events
metric.compute_data_saving = True metric.compute_data_saving = True
......
#!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, 'telemetry'))
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, 'perf'))
from telemetry import test_runner
from telemetry.core import environment
if __name__ == '__main__':
base_dir = os.path.dirname(os.path.realpath(__file__))
test_runner.config = environment.Environment([base_dir])
sys.exit(test_runner.main())
#!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""This script runs unit tests of the code in the perf directory.
This script DOES NOT run benchmarks. run_benchmark does that.
"""
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, 'telemetry'))
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, 'perf'))
from telemetry.unittest import gtest_output_formatter
from telemetry.unittest import run_tests
if __name__ == '__main__':
base_dir = os.path.dirname(os.path.realpath(__file__))
output_formatters = [
gtest_output_formatter.GTestOutputFormatter(sys.stdout)]
run_tests.config = run_tests.Config(base_dir, [base_dir], output_formatters)
sys.exit(run_tests.RunTestsCommand.main())
per-file *chrome_proxy*=bengr@chromium.org
per-file *chrome_proxy*=bolian@chromium.org
per-file *chrome_proxy*=marq@chromium.org
per-file *chrome_proxy*=bengr@chromium.org
per-file *chrome_proxy*=bolian@chromium.org
per-file *chrome_proxy*=marq@chromium.org
per-file *chrome_proxy*=bengr@chromium.org
per-file *chrome_proxy*=bolian@chromium.org
per-file *chrome_proxy*=marq@chromium.org
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
per-file *chrome_proxy*=bengr@chromium.org
per-file *chrome_proxy*=bolian@chromium.org
per-file *chrome_proxy*=marq@chromium.org
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment