| OLD | NEW |
| 1 # Copyright 2012 The Chromium Authors. All rights reserved. | 1 # Copyright 2012 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 Octane 2.0 javascript benchmark. | 5 """Runs Octane 2.0 javascript benchmark. |
| 6 | 6 |
| 7 Octane 2.0 is a modern benchmark that measures a JavaScript engine's performance | 7 Octane 2.0 is a modern benchmark that measures a JavaScript engine's performance |
| 8 by running a suite of tests representative of today's complex and demanding web | 8 by running a suite of tests representative of today's complex and demanding web |
| 9 applications. Octane's goal is to measure the performance of JavaScript code | 9 applications. Octane's goal is to measure the performance of JavaScript code |
| 10 found in large, real-world web applications. | 10 found in large, real-world web applications. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 __results.push(msg); | 92 __results.push(msg); |
| 93 __real_log.apply(this, [msg]); | 93 __real_log.apply(this, [msg]); |
| 94 } | 94 } |
| 95 skipBenchmarks = [%s] | 95 skipBenchmarks = [%s] |
| 96 """ % (skipBenchmarks) | 96 """ % (skipBenchmarks) |
| 97 | 97 |
| 98 def DidNavigateToPage(self, page, tab): | 98 def DidNavigateToPage(self, page, tab): |
| 99 self._power_metric.Start(page, tab) | 99 self._power_metric.Start(page, tab) |
| 100 | 100 |
| 101 def ValidateAndMeasurePage(self, page, tab, results): | 101 def ValidateAndMeasurePage(self, page, tab, results): |
| 102 tab.WaitForJavaScriptCondition2('window.completed', timeout=10) | 102 tab.WaitForJavaScriptCondition('window.completed', timeout=10) |
| 103 tab.WaitForJavaScriptCondition2( | 103 tab.WaitForJavaScriptCondition( |
| 104 '!document.getElementById("progress-bar-container")', timeout=1200) | 104 '!document.getElementById("progress-bar-container")', timeout=1200) |
| 105 | 105 |
| 106 self._power_metric.Stop(page, tab) | 106 self._power_metric.Stop(page, tab) |
| 107 self._power_metric.AddResults(tab, results) | 107 self._power_metric.AddResults(tab, results) |
| 108 | 108 |
| 109 results_log = tab.EvaluateJavaScript2('__results') | 109 results_log = tab.EvaluateJavaScript('__results') |
| 110 all_scores = [] | 110 all_scores = [] |
| 111 for output in results_log: | 111 for output in results_log: |
| 112 # Split the results into score and test name. | 112 # Split the results into score and test name. |
| 113 # results log e.g., "Richards: 18343" | 113 # results log e.g., "Richards: 18343" |
| 114 score_and_name = output.split(': ', 2) | 114 score_and_name = output.split(': ', 2) |
| 115 assert len(score_and_name) == 2, \ | 115 assert len(score_and_name) == 2, \ |
| 116 'Unexpected result format "%s"' % score_and_name | 116 'Unexpected result format "%s"' % score_and_name |
| 117 if 'Skipped' not in score_and_name[1]: | 117 if 'Skipped' not in score_and_name[1]: |
| 118 name = score_and_name[0] | 118 name = score_and_name[0] |
| 119 score = float(score_and_name[1]) | 119 score = float(score_and_name[1]) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 144 | 144 |
| 145 def CreateStorySet(self, options): | 145 def CreateStorySet(self, options): |
| 146 ps = story.StorySet( | 146 ps = story.StorySet( |
| 147 archive_data_file='../page_sets/data/octane.json', | 147 archive_data_file='../page_sets/data/octane.json', |
| 148 base_dir=os.path.dirname(os.path.abspath(__file__)), | 148 base_dir=os.path.dirname(os.path.abspath(__file__)), |
| 149 cloud_storage_bucket=story.PUBLIC_BUCKET) | 149 cloud_storage_bucket=story.PUBLIC_BUCKET) |
| 150 ps.AddStory(page_module.Page( | 150 ps.AddStory(page_module.Page( |
| 151 'http://chromium.github.io/octane/index.html?auto=1', | 151 'http://chromium.github.io/octane/index.html?auto=1', |
| 152 ps, ps.base_dir, make_javascript_deterministic=False)) | 152 ps, ps.base_dir, make_javascript_deterministic=False)) |
| 153 return ps | 153 return ps |
| OLD | NEW |