| OLD | NEW |
| 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 chrome_remote_control import multi_page_benchmark | 4 from chrome_remote_control import multi_page_benchmark |
| 5 from chrome_remote_control import multi_page_benchmark_unittest_base | 5 from chrome_remote_control import multi_page_benchmark_unittest_base |
| 6 from perf_tools import scrolling_benchmark | 6 from perf_tools import scrolling_benchmark |
| 7 | 7 |
| 8 class ScrollingBenchmarkUnitTest( | 8 class ScrollingBenchmarkUnitTest( |
| 9 multi_page_benchmark_unittest_base.MultiPageBenchmarkUnitTestBase): | 9 multi_page_benchmark_unittest_base.MultiPageBenchmarkUnitTestBase): |
| 10 | 10 |
| 11 def testScrollingWithGpuBenchmarkingExtension(self): | 11 def testScrollingWithGpuBenchmarkingExtension(self): |
| 12 ps = self.CreatePageSetFromFileInUnittestDataDir('scrollable_page.html') | 12 ps = self.CreatePageSetFromFileInUnittestDataDir('scrollable_page.html') |
| 13 | 13 |
| 14 benchmark = scrolling_benchmark.ScrollingBenchmark() | 14 benchmark = scrolling_benchmark.ScrollingBenchmark() |
| 15 all_results = self.RunBenchmark(benchmark, ps) | 15 all_results = self.RunBenchmark(benchmark, ps) |
| 16 | 16 |
| 17 self.assertEqual(0, len(all_results.page_failures)) | 17 self.assertEqual(0, len(all_results.page_failures)) |
| 18 self.assertEqual(1, len(all_results.page_results)) | 18 self.assertEqual(1, len(all_results.page_results)) |
| 19 results0 = all_results.page_results[0] | 19 results0 = all_results.page_results[0] |
| 20 | 20 |
| 21 self.assertTrue('dropped_percent' in results0) | 21 self.assertTrue('dropped_percent' in results0) |
| 22 self.assertTrue('mean_frame_time' in results0) | 22 self.assertTrue('mean_frame_time' in results0) |
| 23 | 23 |
| 24 def testCalcResultsFromRAFRenderStats(self): | 24 def testCalcResultsFromRAFRenderStats(self): |
| 25 rendering_stats = {'droppedFrameCount': 5, | 25 rendering_stats = {'droppedFrameCount': 5, |
| 26 'totalTimeInSeconds': 1, | 26 'totalTimeInSeconds': 1, |
| 27 'numAnimationFrames': 10, | 27 'numAnimationFrames': 10, |
| 28 'numFramesSentToScreen': 10} | 28 'rendererFrameCount': 10} |
| 29 res = multi_page_benchmark.BenchmarkResults() | 29 res = multi_page_benchmark.BenchmarkResults() |
| 30 res.WillMeasurePage(True) | 30 res.WillMeasurePage(True) |
| 31 scrolling_benchmark.CalcScrollResults(rendering_stats, res) | 31 scrolling_benchmark.CalcScrollResults(rendering_stats, res) |
| 32 res.DidMeasurePage() | 32 res.DidMeasurePage() |
| 33 self.assertEquals(50, res.page_results[0]['dropped_percent']) | 33 self.assertEquals(50, res.page_results[0]['dropped_percent']) |
| 34 self.assertAlmostEquals(100, res.page_results[0]['mean_frame_time'], 2) | 34 self.assertAlmostEquals(100, res.page_results[0]['mean_frame_time'], 2) |
| 35 | 35 |
| 36 def testCalcResultsRealRenderStats(self): | 36 def testCalcResultsRealRenderStats(self): |
| 37 rendering_stats = {'numFramesSentToScreen': 60, | 37 rendering_stats = {'rendererFrameCount': 60, |
| 38 'globalTotalTextureUploadTimeInSeconds': 0, | 38 'globalTotalTextureUploadTimeInSeconds': 0, |
| 39 'totalProcessingCommandsTimeInSeconds': 0, | 39 'totalProcessingCommandsTimeInSeconds': 0, |
| 40 'globalTextureUploadCount': 0, | 40 'globalTextureUploadCount': 0, |
| 41 'droppedFrameCount': 0, | 41 'droppedFrameCount': 0, |
| 42 'textureUploadCount': 0, | 42 'textureUploadCount': 0, |
| 43 'numAnimationFrames': 10, | 43 'numAnimationFrames': 10, |
| 44 'totalPaintTimeInSeconds': 0.35374299999999986, | 44 'totalPaintTimeInSeconds': 0.35374299999999986, |
| 45 'globalTotalProcessingCommandsTimeInSeconds': 0, | 45 'globalTotalProcessingCommandsTimeInSeconds': 0, |
| 46 'totalTextureUploadTimeInSeconds': 0, | 46 'totalTextureUploadTimeInSeconds': 0, |
| 47 'totalRasterizeTimeInSeconds': 0, | 47 'totalRasterizeTimeInSeconds': 0, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 66 benchmark.use_gpu_benchmarking_extension = False | 66 benchmark.use_gpu_benchmarking_extension = False |
| 67 | 67 |
| 68 all_results = self.RunBenchmark(benchmark, ps) | 68 all_results = self.RunBenchmark(benchmark, ps) |
| 69 | 69 |
| 70 self.assertEqual(0, len(all_results.page_failures)) | 70 self.assertEqual(0, len(all_results.page_failures)) |
| 71 self.assertEqual(1, len(all_results.page_results)) | 71 self.assertEqual(1, len(all_results.page_results)) |
| 72 results0 = all_results.page_results[0] | 72 results0 = all_results.page_results[0] |
| 73 | 73 |
| 74 self.assertTrue('dropped_percent' in results0) | 74 self.assertTrue('dropped_percent' in results0) |
| 75 self.assertTrue('mean_frame_time' in results0) | 75 self.assertTrue('mean_frame_time' in results0) |
| OLD | NEW |