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

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

Issue 11783056: [telemetry] More fixes for my page_test_result rewrite (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months 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
5 from telemetry import multi_page_benchmark_unittest_base 4 from telemetry import multi_page_benchmark_unittest_base
6 from telemetry import page 5 from telemetry import page
7 from perf_tools import smoothness_benchmark 6 from perf_tools import smoothness_benchmark
8 7
9 from telemetry import browser_finder 8 from telemetry import browser_finder
10 from telemetry import options_for_unittests 9 from telemetry import options_for_unittests
10 from telemetry.page_benchmark_results import PageBenchmarkResults
11 11
12 import os 12 import os
13 import urlparse 13 import urlparse
14 14
15 class SmoothnessBenchmarkUnitTest( 15 class SmoothnessBenchmarkUnitTest(
16 multi_page_benchmark_unittest_base.MultiPageBenchmarkUnitTestBase): 16 multi_page_benchmark_unittest_base.MultiPageBenchmarkUnitTestBase):
17 17
18 def testFirstPaintTimeMeasurement(self): 18 def testFirstPaintTimeMeasurement(self):
19 ps = self.CreatePageSetFromFileInUnittestDataDir('scrollable_page.html') 19 ps = self.CreatePageSetFromFileInUnittestDataDir('scrollable_page.html')
20 20
(...skipping 20 matching lines...) Expand all
41 results0 = all_results.page_results[0] 41 results0 = all_results.page_results[0]
42 42
43 self.assertTrue('dropped_percent' in results0) 43 self.assertTrue('dropped_percent' in results0)
44 self.assertTrue('mean_frame_time' in results0) 44 self.assertTrue('mean_frame_time' in results0)
45 45
46 def testCalcResultsFromRAFRenderStats(self): 46 def testCalcResultsFromRAFRenderStats(self):
47 rendering_stats = {'droppedFrameCount': 5, 47 rendering_stats = {'droppedFrameCount': 5,
48 'totalTimeInSeconds': 1, 48 'totalTimeInSeconds': 1,
49 'numAnimationFrames': 10, 49 'numAnimationFrames': 10,
50 'numFramesSentToScreen': 10} 50 'numFramesSentToScreen': 10}
51 res = multi_page_benchmark.BenchmarkResults() 51 res = PageBenchmarkResults()
52 res.WillMeasurePage(page.Page('http://foo.com/')) 52 res.WillMeasurePage(page.Page('http://foo.com/'))
53 smoothness_benchmark.CalcScrollResults(rendering_stats, res) 53 smoothness_benchmark.CalcScrollResults(rendering_stats, res)
54 res.DidMeasurePage() 54 res.DidMeasurePage()
55 self.assertEquals(50, res.page_results[0]['dropped_percent']) 55 self.assertEquals(50, res.page_results[0]['dropped_percent'].value)
56 self.assertAlmostEquals(100, res.page_results[0]['mean_frame_time'], 2) 56 self.assertAlmostEquals(
57 100,
58 res.page_results[0]['mean_frame_time'].value, 2)
57 59
58 def testCalcResultsRealRenderStats(self): 60 def testCalcResultsRealRenderStats(self):
59 rendering_stats = {'numFramesSentToScreen': 60, 61 rendering_stats = {'numFramesSentToScreen': 60,
60 'globalTotalTextureUploadTimeInSeconds': 0, 62 'globalTotalTextureUploadTimeInSeconds': 0,
61 'totalProcessingCommandsTimeInSeconds': 0, 63 'totalProcessingCommandsTimeInSeconds': 0,
62 'globalTextureUploadCount': 0, 64 'globalTextureUploadCount': 0,
63 'droppedFrameCount': 0, 65 'droppedFrameCount': 0,
64 'textureUploadCount': 0, 66 'textureUploadCount': 0,
65 'numAnimationFrames': 10, 67 'numAnimationFrames': 10,
66 'totalPaintTimeInSeconds': 0.35374299999999986, 68 'totalPaintTimeInSeconds': 0.35374299999999986,
67 'globalTotalProcessingCommandsTimeInSeconds': 0, 69 'globalTotalProcessingCommandsTimeInSeconds': 0,
68 'totalTextureUploadTimeInSeconds': 0, 70 'totalTextureUploadTimeInSeconds': 0,
69 'totalRasterizeTimeInSeconds': 0, 71 'totalRasterizeTimeInSeconds': 0,
70 'totalTimeInSeconds': 1.0} 72 'totalTimeInSeconds': 1.0}
71 res = multi_page_benchmark.BenchmarkResults() 73 res = PageBenchmarkResults()
72 res.WillMeasurePage(page.Page('http://foo.com/')) 74 res.WillMeasurePage(page.Page('http://foo.com/'))
73 smoothness_benchmark.CalcScrollResults(rendering_stats, res) 75 smoothness_benchmark.CalcScrollResults(rendering_stats, res)
74 res.DidMeasurePage() 76 res.DidMeasurePage()
75 self.assertEquals(0, res.page_results[0]['dropped_percent']) 77 self.assertEquals(0, res.page_results[0]['dropped_percent'].value)
76 self.assertAlmostEquals(1000/60., res.page_results[0]['mean_frame_time'], 2) 78 self.assertAlmostEquals(
79 1000/60.,
80 res.page_results[0]['mean_frame_time'].value, 2)
77 81
78 def testBoundingClientRect(self): 82 def testBoundingClientRect(self):
79 options = options_for_unittests.GetCopy() 83 options = options_for_unittests.GetCopy()
80 browser_to_create = browser_finder.FindBrowser(options) 84 browser_to_create = browser_finder.FindBrowser(options)
81 if not browser_to_create: 85 if not browser_to_create:
82 raise Exception('No browser found, cannot continue test.') 86 raise Exception('No browser found, cannot continue test.')
83 87
84 with browser_to_create.Create() as browser: 88 with browser_to_create.Create() as browser:
85 tab = browser.tabs[0] 89 tab = browser.tabs[0]
86 ps = self.CreatePageSetFromFileInUnittestDataDir('blank.html') 90 ps = self.CreatePageSetFromFileInUnittestDataDir('blank.html')
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 self.assertTrue(rect_right <= viewport_width) 125 self.assertTrue(rect_right <= viewport_width)
122 126
123 def testDoesImplThreadScroll(self): 127 def testDoesImplThreadScroll(self):
124 ps = self.CreatePageSetFromFileInUnittestDataDir('scrollable_page.html') 128 ps = self.CreatePageSetFromFileInUnittestDataDir('scrollable_page.html')
125 129
126 benchmark = smoothness_benchmark.SmoothnessBenchmark() 130 benchmark = smoothness_benchmark.SmoothnessBenchmark()
127 benchmark.force_enable_threaded_compositing = True 131 benchmark.force_enable_threaded_compositing = True
128 all_results = self.RunBenchmark(benchmark, ps) 132 all_results = self.RunBenchmark(benchmark, ps)
129 133
130 results0 = all_results.page_results[0] 134 results0 = all_results.page_results[0]
131 self.assertTrue(results0['percent_impl_scrolled'] > 0) 135 self.assertTrue(results0['percent_impl_scrolled'].value > 0)
132 136
133 def testScrollingWithoutGpuBenchmarkingExtension(self): 137 def testScrollingWithoutGpuBenchmarkingExtension(self):
134 ps = self.CreatePageSetFromFileInUnittestDataDir('scrollable_page.html') 138 ps = self.CreatePageSetFromFileInUnittestDataDir('scrollable_page.html')
135 139
136 benchmark = smoothness_benchmark.SmoothnessBenchmark() 140 benchmark = smoothness_benchmark.SmoothnessBenchmark()
137 benchmark.use_gpu_benchmarking_extension = False 141 benchmark.use_gpu_benchmarking_extension = False
138 all_results = self.RunBenchmark(benchmark, ps) 142 all_results = self.RunBenchmark(benchmark, ps)
139 143
140 self.assertEqual(0, len(all_results.page_failures)) 144 self.assertEqual(0, len(all_results.page_failures))
141 self.assertEqual(1, len(all_results.page_results)) 145 self.assertEqual(1, len(all_results.page_results))
142 results0 = all_results.page_results[0] 146 results0 = all_results.page_results[0]
143 147
144 self.assertTrue('dropped_percent' in results0) 148 self.assertTrue('dropped_percent' in results0)
145 self.assertTrue('mean_frame_time' in results0) 149 self.assertTrue('mean_frame_time' in results0)
OLDNEW
« no previous file with comments | « tools/perf/perf_tools/skpicture_printer_unittest.py ('k') | tools/telemetry/telemetry/csv_page_benchmark_results.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698