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

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: Created 6 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 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 WillNavigateToPage(self, page, tab):
162 super(ChromeProxySafebrowsingDesktop, self).WillNavigateToPage(page, tab)
163 self._expect_timeout = True
164
165 def AddResults(self, tab, results):
166 self._metrics.AddResultsForSafebrowsingDesktop(tab, results)
155 167
156 _FAKE_PROXY_AUTH_VALUE = 'aabbccdd3b7579186c1b0620614fdb1f0000ffff' 168 _FAKE_PROXY_AUTH_VALUE = 'aabbccdd3b7579186c1b0620614fdb1f0000ffff'
157 _TEST_SERVER = 'chromeproxy-test.appspot.com' 169 _TEST_SERVER = 'chromeproxy-test.appspot.com'
158 _TEST_SERVER_DEFAULT_URL = 'http://' + _TEST_SERVER + '/default' 170 _TEST_SERVER_DEFAULT_URL = 'http://' + _TEST_SERVER + '/default'
159 171
160 172
161 # We rely on the chromeproxy-test server to facilitate some of the tests. 173 # 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 174 # The test server code is at <TBD location> and runs at _TEST_SERVER
163 # 175 #
164 # The test server allow request to override response status, headers, and 176 # The test server allow request to override response status, headers, and
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 374
363 375
364 class ChromeProxySmoke(ChromeProxyValidation): 376 class ChromeProxySmoke(ChromeProxyValidation):
365 """Smoke measurement for basic chrome proxy correctness.""" 377 """Smoke measurement for basic chrome proxy correctness."""
366 378
367 def __init__(self): 379 def __init__(self):
368 super(ChromeProxySmoke, self).__init__() 380 super(ChromeProxySmoke, self).__init__()
369 381
370 def WillNavigateToPage(self, page, tab): 382 def WillNavigateToPage(self, page, tab):
371 super(ChromeProxySmoke, self).WillNavigateToPage(page, tab) 383 super(ChromeProxySmoke, self).WillNavigateToPage(page, tab)
372 if page.name == 'safebrowsing': 384 if page.name == 'safebrowsingmobile':
sclittle 2014/12/29 18:51:35 You should remove this if statement if you're remo
Not at Google. Contact bengr 2015/01/22 21:27:16 Done.
373 self._expect_timeout = True 385 self._expect_timeout = True
374 386
375 def AddResults(self, tab, results): 387 def AddResults(self, tab, results):
376 # Map a page name to its AddResults func. 388 # Map a page name to its AddResults func.
377 page_to_metrics = { 389 page_to_metrics = {
378 'header validation': [self._metrics.AddResultsForHeaderValidation], 390 'header validation': [self._metrics.AddResultsForHeaderValidation],
379 'compression: image': [ 391 'compression: image': [
380 self._metrics.AddResultsForHeaderValidation, 392 self._metrics.AddResultsForHeaderValidation,
381 self._metrics.AddResultsForDataSaving, 393 self._metrics.AddResultsForDataSaving,
382 ], 394 ],
383 'compression: javascript': [ 395 'compression: javascript': [
384 self._metrics.AddResultsForHeaderValidation, 396 self._metrics.AddResultsForHeaderValidation,
385 self._metrics.AddResultsForDataSaving, 397 self._metrics.AddResultsForDataSaving,
386 ], 398 ],
387 'compression: css': [ 399 'compression: css': [
388 self._metrics.AddResultsForHeaderValidation, 400 self._metrics.AddResultsForHeaderValidation,
389 self._metrics.AddResultsForDataSaving, 401 self._metrics.AddResultsForDataSaving,
390 ], 402 ],
391 'bypass': [self._metrics.AddResultsForBypass], 403 'bypass': [self._metrics.AddResultsForBypass],
392 'safebrowsing': [self._metrics.AddResultsForSafebrowsing],
393 } 404 }
394 if not self._page.name in page_to_metrics: 405 if not self._page.name in page_to_metrics:
395 raise page_test.MeasurementFailure( 406 raise page_test.MeasurementFailure(
396 'Invalid page name (%s) in smoke. Page name must be one of:\n%s' % ( 407 'Invalid page name (%s) in smoke. Page name must be one of:\n%s' % (
397 self._page.name, page_to_metrics.keys())) 408 self._page.name, page_to_metrics.keys()))
398 for add_result in page_to_metrics[self._page.name]: 409 for add_result in page_to_metrics[self._page.name]:
399 add_result(tab, results) 410 add_result(tab, results)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698