OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import logging | 6 import logging |
7 import math | 7 import math |
8 import os | 8 import os |
9 import time | 9 import time |
10 | 10 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 def testV8BenchmarkSuite(self): | 119 def testV8BenchmarkSuite(self): |
120 """Measures score from online v8 benchmark suite.""" | 120 """Measures score from online v8 benchmark suite.""" |
121 | 121 |
122 def _RunSingleV8BenchmarkSuite(): | 122 def _RunSingleV8BenchmarkSuite(): |
123 """Runs a single v8 benchmark suite test and returns the final score. | 123 """Runs a single v8 benchmark suite test and returns the final score. |
124 | 124 |
125 Returns: | 125 Returns: |
126 The integer score computed from running the v8 benchmark suite. | 126 The integer score computed from running the v8 benchmark suite. |
127 """ | 127 """ |
128 # TODO(dennisjeffrey@chromium.org): Check in V8 benchmark version 6 to | 128 url = self.GetFileURLForDataPath('v8_benchmark_v6', 'run.html') |
129 # the repo, and then change this to use it. | |
130 url = 'http://v8.googlecode.com/svn/data/benchmarks/v6/run.html' | |
131 self.AppendTab(pyauto.GURL(url)) | 129 self.AppendTab(pyauto.GURL(url)) |
132 js = """ | 130 js = """ |
133 var val = document.getElementById("status").innerHTML; | 131 var val = document.getElementById("status").innerHTML; |
134 window.domAutomationController.send(val); | 132 window.domAutomationController.send(val); |
135 """ | 133 """ |
136 self.WaitUntil( | 134 self.WaitUntil( |
137 lambda: 'Score:' in self.ExecuteJavascript(js, 0, 1), timeout=300, | 135 lambda: 'Score:' in self.ExecuteJavascript(js, 0, 1), timeout=300, |
138 expect_retval=True) | 136 expect_retval=True) |
139 val = self.ExecuteJavascript(js, 0, 1) | 137 val = self.ExecuteJavascript(js, 0, 1) |
140 score = val[val.find(':') + 2:] | 138 score = val[val.find(':') + 2:] |
141 self.GetBrowserWindow(0).GetTab(1).Close(True) | 139 self.GetBrowserWindow(0).GetTab(1).Close(True) |
142 return int(score) | 140 return int(score) |
143 | 141 |
144 orig_score = _RunSingleV8BenchmarkSuite() | 142 orig_score = _RunSingleV8BenchmarkSuite() |
145 self.assertEqual(1, self.GetTabCount(), | 143 self.assertEqual(1, self.GetTabCount(), |
146 msg='Did not clean up after running benchmark suite.') | 144 msg='Did not clean up after running benchmark suite.') |
147 | 145 |
148 scores = [] | 146 scores = [] |
149 for _ in range(self._NUM_ITERATIONS): | 147 for _ in range(self._NUM_ITERATIONS): |
150 score = _RunSingleV8BenchmarkSuite() | 148 score = _RunSingleV8BenchmarkSuite() |
151 self.assertEqual(1, self.GetTabCount(), | 149 self.assertEqual(1, self.GetTabCount(), |
152 msg='Did not clean up after running benchmark suite.') | 150 msg='Did not clean up after running benchmark suite.') |
153 scores.append(score) | 151 scores.append(score) |
154 | 152 |
155 self._PrintSummaryResults(orig_score, self._NUM_ITERATIONS, scores, 'score') | 153 self._PrintSummaryResults(orig_score, self._NUM_ITERATIONS, scores, 'score') |
156 | 154 |
157 | 155 |
158 if __name__ == '__main__': | 156 if __name__ == '__main__': |
159 pyauto_functional.Main() | 157 pyauto_functional.Main() |
OLD | NEW |