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

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

Issue 820093002: Integration tests for desktop platforms and safebrowsing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed redundant variables. Created 5 years, 11 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 integration_tests import chrome_proxy_metrics as metrics 9 from integration_tests import chrome_proxy_metrics as metrics
10 from metrics import loading 10 from metrics import loading
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 class ChromeProxyBlockOnce(ChromeProxyValidation): 132 class ChromeProxyBlockOnce(ChromeProxyValidation):
133 """Correctness measurement for block-once responses.""" 133 """Correctness measurement for block-once responses."""
134 134
135 def __init__(self): 135 def __init__(self):
136 super(ChromeProxyBlockOnce, self).__init__(restart_after_each_page=True) 136 super(ChromeProxyBlockOnce, self).__init__(restart_after_each_page=True)
137 137
138 def AddResults(self, tab, results): 138 def AddResults(self, tab, results):
139 self._metrics.AddResultsForBlockOnce(tab, results) 139 self._metrics.AddResultsForBlockOnce(tab, results)
140 140
141 141
142 class ChromeProxySafebrowsing(ChromeProxyValidation): 142 class ChromeProxySafebrowsingMobile(ChromeProxyValidation):
143 """Correctness measurement for safebrowsing.""" 143 """Correctness measurement for safebrowsing."""
144 144
145 def __init__(self): 145 def __init__(self):
146 super(ChromeProxySafebrowsing, self).__init__() 146 super(ChromeProxySafebrowsingMobile, self).__init__()
147 147
148 def WillNavigateToPage(self, page, tab): 148 def WillNavigateToPage(self, page, tab):
149 super(ChromeProxySafebrowsing, self).WillNavigateToPage(page, tab) 149 super(ChromeProxySafebrowsingMobile, self).WillNavigateToPage(page, tab)
150 self._expect_timeout = True 150 self._expect_timeout = True
151 151
152 def AddResults(self, tab, results): 152 def AddResults(self, tab, results):
153 self._metrics.AddResultsForSafebrowsing(tab, results) 153 self._metrics.AddResultsForSafebrowsingMobile(tab, results)
154 154
155 class ChromeProxySafebrowsingDesktop(ChromeProxyValidation):
156 """Correctness measurement for safebrowsing."""
157
158 def __init__(self):
159 super(ChromeProxySafebrowsingDesktop, self).__init__()
160
161 def AddResults(self, tab, results):
162 self._metrics.AddResultsForSafebrowsingDesktop(tab, results)
155 163
156 _FAKE_PROXY_AUTH_VALUE = 'aabbccdd3b7579186c1b0620614fdb1f0000ffff' 164 _FAKE_PROXY_AUTH_VALUE = 'aabbccdd3b7579186c1b0620614fdb1f0000ffff'
157 _TEST_SERVER = 'chromeproxy-test.appspot.com' 165 _TEST_SERVER = 'chromeproxy-test.appspot.com'
158 _TEST_SERVER_DEFAULT_URL = 'http://' + _TEST_SERVER + '/default' 166 _TEST_SERVER_DEFAULT_URL = 'http://' + _TEST_SERVER + '/default'
159 167
160 168
161 # We rely on the chromeproxy-test server to facilitate some of the tests. 169 # We rely on the chromeproxy-test server to facilitate some of the tests.
162 # The test server code is at <TBD location> and runs at _TEST_SERVER 170 # The test server code is at <TBD location> and runs at _TEST_SERVER
163 # 171 #
164 # The test server allow request to override response status, headers, and 172 # The test server allow request to override response status, headers, and
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 330
323 331
324 class ChromeProxySmoke(ChromeProxyValidation): 332 class ChromeProxySmoke(ChromeProxyValidation):
325 """Smoke measurement for basic chrome proxy correctness.""" 333 """Smoke measurement for basic chrome proxy correctness."""
326 334
327 def __init__(self): 335 def __init__(self):
328 super(ChromeProxySmoke, self).__init__() 336 super(ChromeProxySmoke, self).__init__()
329 337
330 def WillNavigateToPage(self, page, tab): 338 def WillNavigateToPage(self, page, tab):
331 super(ChromeProxySmoke, self).WillNavigateToPage(page, tab) 339 super(ChromeProxySmoke, self).WillNavigateToPage(page, tab)
332 if page.name == 'safebrowsing':
333 self._expect_timeout = True
334 340
335 def AddResults(self, tab, results): 341 def AddResults(self, tab, results):
336 # Map a page name to its AddResults func. 342 # Map a page name to its AddResults func.
337 page_to_metrics = { 343 page_to_metrics = {
338 'header validation': [self._metrics.AddResultsForHeaderValidation], 344 'header validation': [self._metrics.AddResultsForHeaderValidation],
339 'compression: image': [ 345 'compression: image': [
340 self._metrics.AddResultsForHeaderValidation, 346 self._metrics.AddResultsForHeaderValidation,
341 self._metrics.AddResultsForDataSaving, 347 self._metrics.AddResultsForDataSaving,
342 ], 348 ],
343 'compression: javascript': [ 349 'compression: javascript': [
344 self._metrics.AddResultsForHeaderValidation, 350 self._metrics.AddResultsForHeaderValidation,
345 self._metrics.AddResultsForDataSaving, 351 self._metrics.AddResultsForDataSaving,
346 ], 352 ],
347 'compression: css': [ 353 'compression: css': [
348 self._metrics.AddResultsForHeaderValidation, 354 self._metrics.AddResultsForHeaderValidation,
349 self._metrics.AddResultsForDataSaving, 355 self._metrics.AddResultsForDataSaving,
350 ], 356 ],
351 'bypass': [self._metrics.AddResultsForBypass], 357 'bypass': [self._metrics.AddResultsForBypass],
352 'safebrowsing': [self._metrics.AddResultsForSafebrowsing],
353 } 358 }
354 if not self._page.name in page_to_metrics: 359 if not self._page.name in page_to_metrics:
355 raise page_test.MeasurementFailure( 360 raise page_test.MeasurementFailure(
356 'Invalid page name (%s) in smoke. Page name must be one of:\n%s' % ( 361 'Invalid page name (%s) in smoke. Page name must be one of:\n%s' % (
357 self._page.name, page_to_metrics.keys())) 362 self._page.name, page_to_metrics.keys()))
358 for add_result in page_to_metrics[self._page.name]: 363 for add_result in page_to_metrics[self._page.name]:
359 add_result(tab, results) 364 add_result(tab, results)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698