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

Side by Side Diff: tools/gpu/gpu_tools/scrolling_benchmark_unittest.py

Issue 10916227: More polish in prep for CrOS support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for landing Created 8 years, 3 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 import scrolling_benchmark 4 import scrolling_benchmark
5 import multi_page_benchmark 5 import multi_page_benchmark
6 6
7 class ScrollingBenchmarkUnitTest( 7 class ScrollingBenchmarkUnitTest(
8 multi_page_benchmark.MultiPageBenchmarkUnitTest): 8 multi_page_benchmark.MultiPageBenchmarkUnitTest):
9 9
10 def testBasicFunctionality(self): 10 def testScrollingWithGpuBenchmarkingExtension(self):
11 ps = self.CreatePageSetFromFileInUnittestDataDir('scrollable_page.html') 11 ps = self.CreatePageSetFromFileInUnittestDataDir('scrollable_page.html')
12 12
13 benchmark = scrolling_benchmark.ScrollingBenchmark() 13 benchmark = scrolling_benchmark.ScrollingBenchmark()
14 rows = self.RunBenchmark(benchmark, ps) 14 rows = self.RunBenchmark(benchmark, ps)
15 15
16 self.assertEqual(0, len(benchmark.page_failures)) 16 self.assertEqual(0, len(benchmark.page_failures))
17 17
18 header = rows[0] 18 header = rows[0]
19 results = rows[1:] 19 results = rows[1:]
20 self.assertEqual(['url', 'dropped_percent', 'mean_frame_time_ms'], 20 self.assertEqual(['url', 'dropped_percent', 'mean_frame_time_ms'],
21 header) 21 header)
22 self.assertEqual(1, len(results)) 22 self.assertEqual(1, len(results))
23 self.assertTrue('scrollable_page.html' in results[0][0]) 23 self.assertTrue('scrollable_page.html' in results[0][0])
24 24
25 def testScrollingWithoutGpuBenchmarkingExtension(self):
26 ps = self.CreatePageSetFromFileInUnittestDataDir('scrollable_page.html')
27
28 benchmark = scrolling_benchmark.ScrollingBenchmark()
29 benchmark.use_gpu_bencharking_extension = False
30
31 rows = self.RunBenchmark(benchmark, ps)
32
33 self.assertEqual(0, len(benchmark.page_failures))
34
35 header = rows[0]
36 results = rows[1:]
37 self.assertEqual(['url', 'dropped_percent', 'mean_frame_time_ms'],
38 header)
39 self.assertEqual(1, len(results))
40 self.assertTrue('scrollable_page.html' in results[0][0])
41
25 def testCalcResultsFromRAFRenderStats(self): 42 def testCalcResultsFromRAFRenderStats(self):
26 rendering_stats = {'droppedFrameCount': 5, 43 rendering_stats = {'droppedFrameCount': 5,
27 'totalTimeInSeconds': 1, 44 'totalTimeInSeconds': 1,
28 'numAnimationFrames': 10, 45 'numAnimationFrames': 10,
29 'numFramesSentToScreen': 10} 46 'numFramesSentToScreen': 10}
30 res = scrolling_benchmark._CalcScrollResults(rendering_stats) 47 res = scrolling_benchmark._CalcScrollResults(rendering_stats)
31 self.assertEquals(50, res["dropped_percent"]) 48 self.assertEquals(50, res["dropped_percent"])
32 self.assertAlmostEquals(100, res["mean_frame_time_ms"], 2) 49 self.assertAlmostEquals(100, res["mean_frame_time_ms"], 2)
33 50
34 51
35 def testCalcResultsRealRenderStats(self): 52 def testCalcResultsRealRenderStats(self):
36 rendering_stats = {'numFramesSentToScreen': 60, 53 rendering_stats = {'numFramesSentToScreen': 60,
37 'globalTotalTextureUploadTimeInSeconds': 0, 54 'globalTotalTextureUploadTimeInSeconds': 0,
38 'totalProcessingCommandsTimeInSeconds': 0, 55 'totalProcessingCommandsTimeInSeconds': 0,
39 'globalTextureUploadCount': 0, 56 'globalTextureUploadCount': 0,
40 'droppedFrameCount': 0, 57 'droppedFrameCount': 0,
41 'textureUploadCount': 0, 58 'textureUploadCount': 0,
42 'numAnimationFrames': 10, 59 'numAnimationFrames': 10,
43 'totalPaintTimeInSeconds': 0.35374299999999986, 60 'totalPaintTimeInSeconds': 0.35374299999999986,
44 'globalTotalProcessingCommandsTimeInSeconds': 0, 61 'globalTotalProcessingCommandsTimeInSeconds': 0,
45 'totalTextureUploadTimeInSeconds': 0, 62 'totalTextureUploadTimeInSeconds': 0,
46 'totalRasterizeTimeInSeconds': 0, 63 'totalRasterizeTimeInSeconds': 0,
47 'totalTimeInSeconds': 1.0} 64 'totalTimeInSeconds': 1.0}
48 res = scrolling_benchmark._CalcScrollResults(rendering_stats) 65 res = scrolling_benchmark._CalcScrollResults(rendering_stats)
49 self.assertEquals(0, res["dropped_percent"]) 66 self.assertEquals(0, res["dropped_percent"])
50 self.assertAlmostEquals(1000/60.0, res["mean_frame_time_ms"], 2) 67 self.assertAlmostEquals(1000/60.0, res["mean_frame_time_ms"], 2)
OLDNEW
« no previous file with comments | « tools/gpu/gpu_tools/scrolling_benchmark.py ('k') | tools/gpu/unittest_data/non_scrollable_page.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698