| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 """Runs Chromium's IndexedDB performance test. These test: | 5 """Runs Chromium's IndexedDB performance test. These test: |
| 6 | 6 |
| 7 Databases: | 7 Databases: |
| 8 create/delete | 8 create/delete |
| 9 Keys: | 9 Keys: |
| 10 create/delete | 10 create/delete |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 def DidStartBrowser(self, browser): | 58 def DidStartBrowser(self, browser): |
| 59 """Initialize metrics once right after the browser has been launched.""" | 59 """Initialize metrics once right after the browser has been launched.""" |
| 60 self._memory_metric = memory.MemoryMetric(browser) | 60 self._memory_metric = memory.MemoryMetric(browser) |
| 61 | 61 |
| 62 def DidNavigateToPage(self, page, tab): | 62 def DidNavigateToPage(self, page, tab): |
| 63 self._memory_metric.Start(page, tab) | 63 self._memory_metric.Start(page, tab) |
| 64 self._power_metric.Start(page, tab) | 64 self._power_metric.Start(page, tab) |
| 65 | 65 |
| 66 def ValidateAndMeasurePage(self, page, tab, results): | 66 def ValidateAndMeasurePage(self, page, tab, results): |
| 67 tab.WaitForDocumentReadyStateToBeComplete() | 67 tab.WaitForDocumentReadyStateToBeComplete() |
| 68 tab.WaitForJavaScriptCondition2('window.done', timeout=600) | 68 tab.WaitForJavaScriptCondition('window.done', timeout=600) |
| 69 | 69 |
| 70 self._power_metric.Stop(page, tab) | 70 self._power_metric.Stop(page, tab) |
| 71 self._memory_metric.Stop(page, tab) | 71 self._memory_metric.Stop(page, tab) |
| 72 | 72 |
| 73 self._memory_metric.AddResults(tab, results) | 73 self._memory_metric.AddResults(tab, results) |
| 74 self._power_metric.AddResults(tab, results) | 74 self._power_metric.AddResults(tab, results) |
| 75 | 75 |
| 76 result_dict = json.loads(tab.EvaluateJavaScript2( | 76 result_dict = json.loads(tab.EvaluateJavaScript( |
| 77 'JSON.stringify(automation.getResults());')) | 77 'JSON.stringify(automation.getResults());')) |
| 78 total = 0.0 | 78 total = 0.0 |
| 79 for key in result_dict: | 79 for key in result_dict: |
| 80 if key == 'OverallTestDuration': | 80 if key == 'OverallTestDuration': |
| 81 continue | 81 continue |
| 82 msec = float(result_dict[key]) | 82 msec = float(result_dict[key]) |
| 83 results.AddValue(scalar.ScalarValue( | 83 results.AddValue(scalar.ScalarValue( |
| 84 results.current_page, key, 'ms', msec, important=False)) | 84 results.current_page, key, 'ms', msec, important=False)) |
| 85 | 85 |
| 86 total += msec | 86 total += msec |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 return timeline_based_measurement.Options( | 133 return timeline_based_measurement.Options( |
| 134 overhead_level=cat_filter) | 134 overhead_level=cat_filter) |
| 135 | 135 |
| 136 @classmethod | 136 @classmethod |
| 137 def Name(cls): | 137 def Name(cls): |
| 138 return 'storage.indexeddb_endure_tracing' | 138 return 'storage.indexeddb_endure_tracing' |
| 139 | 139 |
| 140 @classmethod | 140 @classmethod |
| 141 def ValueCanBeAddedPredicate(cls, value, is_first_result): | 141 def ValueCanBeAddedPredicate(cls, value, is_first_result): |
| 142 return 'idb' in value.name | 142 return 'idb' in value.name |
| OLD | NEW |