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

Side by Side Diff: tools/perf/perf_tools/smoothness_benchmark_unittest.py

Issue 11366197: Refactoring benchmarks for perf bot efficiency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 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 from telemetry import multi_page_benchmark 4 from telemetry import multi_page_benchmark
5 from telemetry import multi_page_benchmark_unittest_base 5 from telemetry import multi_page_benchmark_unittest_base
6 from perf_tools import scrolling_benchmark 6 from perf_tools import smoothness_benchmark
7 7
8 from telemetry import browser_finder 8 from telemetry import browser_finder
9 from telemetry import options_for_unittests 9 from telemetry import options_for_unittests
10 10
11 import os 11 import os
12 import urlparse 12 import urlparse
13 13
14 class ScrollingBenchmarkUnitTest( 14 class SmoothnessBenchmarkUnitTest(
15 multi_page_benchmark_unittest_base.MultiPageBenchmarkUnitTestBase): 15 multi_page_benchmark_unittest_base.MultiPageBenchmarkUnitTestBase):
16 16
17 def testFirstPaintTimeMeasurement(self):
18 ps = self.CreatePageSetFromFileInUnittestDataDir('scrollable_page.html')
19
20 benchmark = smoothness_benchmark.SmoothnessBenchmark()
21 all_results = self.RunBenchmark(benchmark, ps)
22
23 self.assertEqual(0, len(all_results.page_failures))
24 self.assertEqual(1, len(all_results.page_results))
25
26 results0 = all_results.page_results[0]
27 if results0['first_paint'] == 'unsupported':
28 # This test can't run on content_shell.
29 return
30 self.assertTrue(results0['first_paint'] > 0)
31
17 def testScrollingWithGpuBenchmarkingExtension(self): 32 def testScrollingWithGpuBenchmarkingExtension(self):
18 ps = self.CreatePageSetFromFileInUnittestDataDir('scrollable_page.html') 33 ps = self.CreatePageSetFromFileInUnittestDataDir('scrollable_page.html')
19 34
20 benchmark = scrolling_benchmark.ScrollingBenchmark() 35 benchmark = smoothness_benchmark.SmoothnessBenchmark()
21 all_results = self.RunBenchmark(benchmark, ps) 36 all_results = self.RunBenchmark(benchmark, ps)
22 37
23 self.assertEqual(0, len(all_results.page_failures)) 38 self.assertEqual(0, len(all_results.page_failures))
24 self.assertEqual(1, len(all_results.page_results)) 39 self.assertEqual(1, len(all_results.page_results))
25 results0 = all_results.page_results[0] 40 results0 = all_results.page_results[0]
26 41
27 self.assertTrue('dropped_percent' in results0) 42 self.assertTrue('dropped_percent' in results0)
28 self.assertTrue('mean_frame_time' in results0) 43 self.assertTrue('mean_frame_time' in results0)
29 44
30 def testCalcResultsFromRAFRenderStats(self): 45 def testCalcResultsFromRAFRenderStats(self):
31 rendering_stats = {'droppedFrameCount': 5, 46 rendering_stats = {'droppedFrameCount': 5,
32 'totalTimeInSeconds': 1, 47 'totalTimeInSeconds': 1,
33 'numAnimationFrames': 10, 48 'numAnimationFrames': 10,
34 'numFramesSentToScreen': 10} 49 'numFramesSentToScreen': 10}
35 res = multi_page_benchmark.BenchmarkResults() 50 res = multi_page_benchmark.BenchmarkResults()
36 res.WillMeasurePage(True) 51 res.WillMeasurePage(True)
37 scrolling_benchmark.CalcScrollResults(rendering_stats, res) 52 smoothness_benchmark.CalcScrollResults(rendering_stats, res)
38 res.DidMeasurePage() 53 res.DidMeasurePage()
39 self.assertEquals(50, res.page_results[0]['dropped_percent']) 54 self.assertEquals(50, res.page_results[0]['dropped_percent'])
40 self.assertAlmostEquals(100, res.page_results[0]['mean_frame_time'], 2) 55 self.assertAlmostEquals(100, res.page_results[0]['mean_frame_time'], 2)
41 56
42 def testCalcResultsRealRenderStats(self): 57 def testCalcResultsRealRenderStats(self):
43 rendering_stats = {'numFramesSentToScreen': 60, 58 rendering_stats = {'numFramesSentToScreen': 60,
44 'globalTotalTextureUploadTimeInSeconds': 0, 59 'globalTotalTextureUploadTimeInSeconds': 0,
45 'totalProcessingCommandsTimeInSeconds': 0, 60 'totalProcessingCommandsTimeInSeconds': 0,
46 'globalTextureUploadCount': 0, 61 'globalTextureUploadCount': 0,
47 'droppedFrameCount': 0, 62 'droppedFrameCount': 0,
48 'textureUploadCount': 0, 63 'textureUploadCount': 0,
49 'numAnimationFrames': 10, 64 'numAnimationFrames': 10,
50 'totalPaintTimeInSeconds': 0.35374299999999986, 65 'totalPaintTimeInSeconds': 0.35374299999999986,
51 'globalTotalProcessingCommandsTimeInSeconds': 0, 66 'globalTotalProcessingCommandsTimeInSeconds': 0,
52 'totalTextureUploadTimeInSeconds': 0, 67 'totalTextureUploadTimeInSeconds': 0,
53 'totalRasterizeTimeInSeconds': 0, 68 'totalRasterizeTimeInSeconds': 0,
54 'totalTimeInSeconds': 1.0} 69 'totalTimeInSeconds': 1.0}
55 res = multi_page_benchmark.BenchmarkResults() 70 res = multi_page_benchmark.BenchmarkResults()
56 res.WillMeasurePage(True) 71 res.WillMeasurePage(True)
57 scrolling_benchmark.CalcScrollResults(rendering_stats, res) 72 smoothness_benchmark.CalcScrollResults(rendering_stats, res)
58 res.DidMeasurePage() 73 res.DidMeasurePage()
59 self.assertEquals(0, res.page_results[0]['dropped_percent']) 74 self.assertEquals(0, res.page_results[0]['dropped_percent'])
60 self.assertAlmostEquals(1000/60., res.page_results[0]['mean_frame_time'], 2) 75 self.assertAlmostEquals(1000/60., res.page_results[0]['mean_frame_time'], 2)
61 76
62 def testBoundingClientRect(self): 77 def testBoundingClientRect(self):
63 options = options_for_unittests.Get() 78 options = options_for_unittests.Get()
64 browser_to_create = browser_finder.FindBrowser(options) 79 browser_to_create = browser_finder.FindBrowser(options)
65 if not browser_to_create: 80 if not browser_to_create:
66 raise Exception('No browser found, cannot continue test.') 81 raise Exception('No browser found, cannot continue test.')
67 82
(...skipping 27 matching lines...) Expand all
95 __ScrollTest_GetBoundingVisibleRect(document.body).height""")) 110 __ScrollTest_GetBoundingVisibleRect(document.body).height"""))
96 rect_right = int(tab.runtime.Evaluate(""" 111 rect_right = int(tab.runtime.Evaluate("""
97 __ScrollTest_GetBoundingVisibleRect(document.body).left + 112 __ScrollTest_GetBoundingVisibleRect(document.body).left +
98 __ScrollTest_GetBoundingVisibleRect(document.body).width""")) 113 __ScrollTest_GetBoundingVisibleRect(document.body).width"""))
99 viewport_width = int(tab.runtime.Evaluate('window.innerWidth')) 114 viewport_width = int(tab.runtime.Evaluate('window.innerWidth'))
100 viewport_height = int(tab.runtime.Evaluate('window.innerHeight')) 115 viewport_height = int(tab.runtime.Evaluate('window.innerHeight'))
101 116
102 self.assertTrue(rect_bottom <= viewport_height) 117 self.assertTrue(rect_bottom <= viewport_height)
103 self.assertTrue(rect_right <= viewport_width) 118 self.assertTrue(rect_right <= viewport_width)
104 119
105 class ScrollingBenchmarkWithoutGpuBenchmarkingUnitTest( 120 class SmoothnessBenchmarkWithoutGpuBenchmarkingUnitTest(
106 multi_page_benchmark_unittest_base.MultiPageBenchmarkUnitTestBase): 121 multi_page_benchmark_unittest_base.MultiPageBenchmarkUnitTestBase):
107 122
108 def CustomizeOptionsForTest(self, options): 123 def CustomizeOptionsForTest(self, options):
109 options.no_gpu_benchmarking_extension = True 124 options.no_gpu_benchmarking_extension = True
110 125
111 def testScrollingWithoutGpuBenchmarkingExtension(self): 126 def testScrollingWithoutGpuBenchmarkingExtension(self):
112 ps = self.CreatePageSetFromFileInUnittestDataDir('scrollable_page.html') 127 ps = self.CreatePageSetFromFileInUnittestDataDir('scrollable_page.html')
113 128
114 benchmark = scrolling_benchmark.ScrollingBenchmark() 129 benchmark = smoothness_benchmark.SmoothnessBenchmark()
115 benchmark.use_gpu_benchmarking_extension = False 130 benchmark.use_gpu_benchmarking_extension = False
116 131
117 all_results = self.RunBenchmark(benchmark, ps) 132 all_results = self.RunBenchmark(benchmark, ps)
118 133
119 self.assertEqual(0, len(all_results.page_failures)) 134 self.assertEqual(0, len(all_results.page_failures))
120 self.assertEqual(1, len(all_results.page_results)) 135 self.assertEqual(1, len(all_results.page_results))
121 results0 = all_results.page_results[0] 136 results0 = all_results.page_results[0]
122 137
123 self.assertTrue('dropped_percent' in results0) 138 self.assertTrue('dropped_percent' in results0)
124 self.assertTrue('mean_frame_time' in results0) 139 self.assertTrue('mean_frame_time' in results0)
OLDNEW
« no previous file with comments | « tools/perf/perf_tools/smoothness_benchmark.py ('k') | tools/perf/perf_tools/texture_upload_benchmark.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698