Index: chrome/test/functional/perf.py |
diff --git a/chrome/test/functional/perf.py b/chrome/test/functional/perf.py |
index e75faba04bf779fb1880ca44b1d8cd526c5db21d..cdf4158b2229a48fa7bb06444d4910477b720b3f 100755 |
--- a/chrome/test/functional/perf.py |
+++ b/chrome/test/functional/perf.py |
@@ -751,6 +751,39 @@ class WebGLTest(BasePerfTest): |
'WebGLSpaceRocks') |
+class HTML5Test(BasePerfTest): |
Nirnimesh
2011/12/07 22:55:22
Change name to HTML5BenchmarkTest
dennis_jeffrey
2011/12/07 23:04:46
Done.
|
+ """Tests for HTML5 performance.""" |
Nirnimesh
2011/12/07 22:55:22
It'd be nice to declare the URL here.
dennis_jeffrey
2011/12/07 23:04:46
Leaving alone as per offline discussion. The URL
|
+ |
+ def testHTML5Benchmark(self): |
+ """Measures performance using the benchmark at html5-benchmark.com.""" |
+ self.NavigateToURL('http://html5-benchmark.com') |
+ |
+ start_benchmark_js = """ |
+ benchmark(); |
+ window.domAutomationController.send("done"); |
+ """ |
+ self.ExecuteJavascript(start_benchmark_js) |
+ |
+ js_final_score = """ |
+ var score = "-1"; |
+ var elem = document.getElementById("score"); |
+ if (elem) |
+ score = elem.innerHTML; |
+ window.domAutomationController.send(score); |
+ """ |
+ # Wait for the benchmark to complete, which is assumed to be when the value |
+ # of the 'score' DOM element changes to something other than '87485'. |
+ self.assertTrue( |
+ self.WaitUntil( |
+ lambda: self.ExecuteJavascript(js_final_score) != '87485', |
+ timeout=900, retry_sleep=1), |
+ msg='Timed out when waiting for final score to be available.') |
+ |
+ score = self.ExecuteJavascript(js_final_score) |
+ logging.info('HTML5 Benchmark final score: %.2f' % float(score)) |
+ self._OutputPerfGraphValue('score_HTML5Benchmark', float(score)) |
+ |
+ |
class FileUploadDownloadTest(BasePerfTest): |
"""Tests that involve measuring performance of upload and download.""" |