| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 self._v8_object_stats_metric.AddResults(tab, results) | 72 self._v8_object_stats_metric.AddResults(tab, results) |
| 73 | 73 |
| 74 js_get_results = "JSON.stringify(automation.getResults());" | 74 js_get_results = "JSON.stringify(automation.getResults());" |
| 75 result_dict = json.loads(tab.EvaluateJavaScript(js_get_results)) | 75 result_dict = json.loads(tab.EvaluateJavaScript(js_get_results)) |
| 76 total = 0.0 | 76 total = 0.0 |
| 77 for key in result_dict: | 77 for key in result_dict: |
| 78 if key == 'OverallTestDuration': | 78 if key == 'OverallTestDuration': |
| 79 continue | 79 continue |
| 80 msec = float(result_dict[key]) | 80 msec = float(result_dict[key]) |
| 81 results.AddValue(scalar.ScalarValue( | 81 results.AddValue(scalar.ScalarValue( |
| 82 results.current_page, key, 'ms', msec, important=False)) | 82 results.current_page, key, 'ms', msec, important=False, |
| 83 higher_is_better=False)) |
| 83 | 84 |
| 84 total += msec | 85 total += msec |
| 85 results.AddValue(scalar.ScalarValue( | 86 results.AddValue(scalar.ScalarValue( |
| 86 results.current_page, 'Total Perf', 'ms', total)) | 87 results.current_page, 'Total Perf', 'ms', total, |
| 88 higher_is_better=False)) |
| 87 | 89 |
| 88 | 90 |
| 89 def CustomizeBrowserOptions(self, options): | 91 def CustomizeBrowserOptions(self, options): |
| 90 memory.MemoryMetric.CustomizeBrowserOptions(options) | 92 memory.MemoryMetric.CustomizeBrowserOptions(options) |
| 91 power.PowerMetric.CustomizeBrowserOptions(options) | 93 power.PowerMetric.CustomizeBrowserOptions(options) |
| 92 v8_object_stats.V8ObjectStatsMetric.CustomizeBrowserOptions(options) | 94 v8_object_stats.V8ObjectStatsMetric.CustomizeBrowserOptions(options) |
| 93 | 95 |
| 94 class IndexedDb(benchmark.Benchmark): | 96 class IndexedDb(benchmark.Benchmark): |
| 95 """Chromium's IndexedDB Performance tests.""" | 97 """Chromium's IndexedDB Performance tests.""" |
| 96 test = _IndexedDbMeasurement | 98 test = _IndexedDbMeasurement |
| 97 | 99 |
| 98 def CreatePageSet(self, options): | 100 def CreatePageSet(self, options): |
| 99 indexeddb_dir = os.path.join(util.GetChromiumSrcDir(), 'chrome', 'test', | 101 indexeddb_dir = os.path.join(util.GetChromiumSrcDir(), 'chrome', 'test', |
| 100 'data', 'indexeddb') | 102 'data', 'indexeddb') |
| 101 ps = page_set.PageSet(file_path=indexeddb_dir) | 103 ps = page_set.PageSet(file_path=indexeddb_dir) |
| 102 ps.AddUserStory(page_module.Page('file://perf_test.html', ps, ps.base_dir)) | 104 ps.AddUserStory(page_module.Page('file://perf_test.html', ps, ps.base_dir)) |
| 103 return ps | 105 return ps |
| OLD | NEW |