OLD | NEW |
1 # Copyright 2017 The Chromium Authors. All rights reserved. | 1 # Copyright 2017 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 datetime | 5 import datetime |
6 import json | 6 import json |
7 import math | 7 import math |
8 import subprocess | 8 import subprocess |
9 import time | 9 import time |
10 | 10 |
11 import common | 11 import common |
12 from common import TestDriver | 12 from common import TestDriver |
13 from common import IntegrationTest | 13 from common import IntegrationTest |
14 from common import NotAndroid | 14 from decorators import NotAndroid |
15 | 15 |
16 # The maximum number of data points that will be saved. | 16 # The maximum number of data points that will be saved. |
17 MAX_DATA_POINTS = 365 | 17 MAX_DATA_POINTS = 365 |
18 | 18 |
19 # The number of days in the past to compute the average of for regression | 19 # The number of days in the past to compute the average of for regression |
20 # alerting. | 20 # alerting. |
21 ALERT_WINDOW = 31 | 21 ALERT_WINDOW = 31 |
22 | 22 |
23 # The amount of tolerable difference a single data point can be away from the | 23 # The amount of tolerable difference a single data point can be away from the |
24 # average without alerting. This is a percentage from 0.0 to 1.0 inclusive. | 24 # average without alerting. This is a percentage from 0.0 to 1.0 inclusive. |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 for i in range(ALERT_WINDOW): | 371 for i in range(ALERT_WINDOW): |
372 date_obj = start_date + datetime.timedelta(days=i) | 372 date_obj = start_date + datetime.timedelta(days=i) |
373 datestamp = date_obj.strftime(DATE_FORMAT) | 373 datestamp = date_obj.strftime(DATE_FORMAT) |
374 data[datestamp] = {'mp4': 0.9} | 374 data[datestamp] = {'mp4': 0.9} |
375 self.assertRaises(Exception, self.checkForRegression, data, {'mp4': | 375 self.assertRaises(Exception, self.checkForRegression, data, {'mp4': |
376 (0.9 - THRESHOLD - 0.01)}) | 376 (0.9 - THRESHOLD - 0.01)}) |
377 | 377 |
378 | 378 |
379 if __name__ == '__main__': | 379 if __name__ == '__main__': |
380 IntegrationTest.RunAllTests() | 380 IntegrationTest.RunAllTests() |
OLD | NEW |