Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Side by Side Diff: chrome/test/functional/perf.py

Issue 8869001: Adding new pyauto perf test for an HTML5 benchmark. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with trunk (required minor edit). Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env 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 """Basic pyauto performance tests. 6 """Basic pyauto performance tests.
7 7
8 For tests that need to be run for multiple iterations (e.g., so that average 8 For tests that need to be run for multiple iterations (e.g., so that average
9 and standard deviation values can be reported), the default number of iterations 9 and standard deviation values can be reported), the default number of iterations
10 run for each of these tests is specified by |_DEFAULT_NUM_ITERATIONS|. 10 run for each of these tests is specified by |_DEFAULT_NUM_ITERATIONS|.
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 'WebGLField') 775 'WebGLField')
776 776
777 def testWebGLSpaceRocks(self): 777 def testWebGLSpaceRocks(self):
778 """Measures performance using the WebGL SpaceRocks demo.""" 778 """Measures performance using the WebGL SpaceRocks demo."""
779 self._RunWebGLTest( 779 self._RunWebGLTest(
780 self.GetFileURLForDataPath('pyauto_private', 'webgl', 'spacerocks', 780 self.GetFileURLForDataPath('pyauto_private', 'webgl', 'spacerocks',
781 'spacerocks.html'), 781 'spacerocks.html'),
782 'WebGLSpaceRocks') 782 'WebGLSpaceRocks')
783 783
784 784
785 class HTML5BenchmarkTest(BasePerfTest):
786 """Tests for HTML5 performance."""
787
788 def testHTML5Benchmark(self):
789 """Measures performance using the benchmark at html5-benchmark.com."""
790 self.NavigateToURL('http://html5-benchmark.com')
791
792 start_benchmark_js = """
793 benchmark();
794 window.domAutomationController.send("done");
795 """
796 self.ExecuteJavascript(start_benchmark_js)
797
798 js_final_score = """
799 var score = "-1";
800 var elem = document.getElementById("score");
801 if (elem)
802 score = elem.innerHTML;
803 window.domAutomationController.send(score);
804 """
805 # Wait for the benchmark to complete, which is assumed to be when the value
806 # of the 'score' DOM element changes to something other than '87485'.
807 self.assertTrue(
808 self.WaitUntil(
809 lambda: self.ExecuteJavascript(js_final_score) != '87485',
810 timeout=900, retry_sleep=1),
811 msg='Timed out when waiting for final score to be available.')
812
813 score = self.ExecuteJavascript(js_final_score)
814 logging.info('HTML5 Benchmark final score: %.2f' % float(score))
815 self._OutputPerfGraphValue('HTML5Benchmark', float(score), 'score',
816 graph_name='HTML5Benchmark')
817
818
785 class FileUploadDownloadTest(BasePerfTest): 819 class FileUploadDownloadTest(BasePerfTest):
786 """Tests that involve measuring performance of upload and download.""" 820 """Tests that involve measuring performance of upload and download."""
787 821
788 def setUp(self): 822 def setUp(self):
789 """Performs necessary setup work before running each test in this class.""" 823 """Performs necessary setup work before running each test in this class."""
790 self._temp_dir = tempfile.mkdtemp() 824 self._temp_dir = tempfile.mkdtemp()
791 self._test_server = PerfTestServer(self._temp_dir) 825 self._test_server = PerfTestServer(self._temp_dir)
792 self._test_server_port = self._test_server.GetPort() 826 self._test_server_port = self._test_server.GetPort()
793 self._test_server.Run() 827 self._test_server.Run()
794 self.assertTrue(self.WaitUntil(self._IsTestServerRunning), 828 self.assertTrue(self.WaitUntil(self._IsTestServerRunning),
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 """Identifies the port number to which the server is currently bound. 1545 """Identifies the port number to which the server is currently bound.
1512 1546
1513 Returns: 1547 Returns:
1514 The numeric port number to which the server is currently bound. 1548 The numeric port number to which the server is currently bound.
1515 """ 1549 """
1516 return self._server.server_address[1] 1550 return self._server.server_address[1]
1517 1551
1518 1552
1519 if __name__ == '__main__': 1553 if __name__ == '__main__':
1520 pyauto_functional.Main() 1554 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698