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

Unified Diff: tools/perf/perf_tools/scrolling_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, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/perf/perf_tools/scrolling_benchmark.py ('k') | tools/perf/perf_tools/smoothness_benchmark.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/perf_tools/scrolling_benchmark_unittest.py
diff --git a/tools/perf/perf_tools/scrolling_benchmark_unittest.py b/tools/perf/perf_tools/scrolling_benchmark_unittest.py
deleted file mode 100644
index 2a02f3868fca7d560c7a2f40a13f11c07b4be9f3..0000000000000000000000000000000000000000
--- a/tools/perf/perf_tools/scrolling_benchmark_unittest.py
+++ /dev/null
@@ -1,124 +0,0 @@
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-from telemetry import multi_page_benchmark
-from telemetry import multi_page_benchmark_unittest_base
-from perf_tools import scrolling_benchmark
-
-from telemetry import browser_finder
-from telemetry import options_for_unittests
-
-import os
-import urlparse
-
-class ScrollingBenchmarkUnitTest(
- multi_page_benchmark_unittest_base.MultiPageBenchmarkUnitTestBase):
-
- def testScrollingWithGpuBenchmarkingExtension(self):
- ps = self.CreatePageSetFromFileInUnittestDataDir('scrollable_page.html')
-
- benchmark = scrolling_benchmark.ScrollingBenchmark()
- all_results = self.RunBenchmark(benchmark, ps)
-
- self.assertEqual(0, len(all_results.page_failures))
- self.assertEqual(1, len(all_results.page_results))
- results0 = all_results.page_results[0]
-
- self.assertTrue('dropped_percent' in results0)
- self.assertTrue('mean_frame_time' in results0)
-
- def testCalcResultsFromRAFRenderStats(self):
- rendering_stats = {'droppedFrameCount': 5,
- 'totalTimeInSeconds': 1,
- 'numAnimationFrames': 10,
- 'numFramesSentToScreen': 10}
- res = multi_page_benchmark.BenchmarkResults()
- res.WillMeasurePage(True)
- scrolling_benchmark.CalcScrollResults(rendering_stats, res)
- res.DidMeasurePage()
- self.assertEquals(50, res.page_results[0]['dropped_percent'])
- self.assertAlmostEquals(100, res.page_results[0]['mean_frame_time'], 2)
-
- def testCalcResultsRealRenderStats(self):
- rendering_stats = {'numFramesSentToScreen': 60,
- 'globalTotalTextureUploadTimeInSeconds': 0,
- 'totalProcessingCommandsTimeInSeconds': 0,
- 'globalTextureUploadCount': 0,
- 'droppedFrameCount': 0,
- 'textureUploadCount': 0,
- 'numAnimationFrames': 10,
- 'totalPaintTimeInSeconds': 0.35374299999999986,
- 'globalTotalProcessingCommandsTimeInSeconds': 0,
- 'totalTextureUploadTimeInSeconds': 0,
- 'totalRasterizeTimeInSeconds': 0,
- 'totalTimeInSeconds': 1.0}
- res = multi_page_benchmark.BenchmarkResults()
- res.WillMeasurePage(True)
- scrolling_benchmark.CalcScrollResults(rendering_stats, res)
- res.DidMeasurePage()
- self.assertEquals(0, res.page_results[0]['dropped_percent'])
- self.assertAlmostEquals(1000/60., res.page_results[0]['mean_frame_time'], 2)
-
- def testBoundingClientRect(self):
- options = options_for_unittests.Get()
- browser_to_create = browser_finder.FindBrowser(options)
- if not browser_to_create:
- raise Exception('No browser found, cannot continue test.')
-
- with browser_to_create.Create() as browser:
- with browser.ConnectToNthTab(0) as tab:
- ps = self.CreatePageSetFromFileInUnittestDataDir('blank.html')
- parsed_url = urlparse.urlparse(ps.pages[0].url)
- path = os.path.join(parsed_url.netloc, parsed_url.path)
- dirname, filename = os.path.split(path)
- browser.SetHTTPServerDirectory(dirname)
- target_side_url = browser.http_server.UrlOf(filename)
- tab.page.Navigate(target_side_url)
-
- # Verify that the rect returned by getBoundingVisibleRect() in
- # scroll.js is completely contained within the viewport. Scroll
- # events dispatched by the benchmarks use the center of this rect
- # as their location, and this location needs to be within the
- # viewport bounds to correctly decide between main-thread and
- # impl-thread scrolling. If the scrollable area were not clipped
- # to the viewport bounds, then the instance used here (the scrollable
- # area being more than twice as tall as the viewport) would
- # result in a scroll location outside of the viewport bounds.
- tab.runtime.Execute("""document.body.style.height =
- (2 * window.innerHeight + 1) + 'px';""")
- scroll_js_path = os.path.join(os.path.dirname(__file__), 'scroll.js')
- scroll_js = open(scroll_js_path, 'r').read()
- tab.runtime.Evaluate(scroll_js)
-
- rect_bottom = int(tab.runtime.Evaluate("""
- __ScrollTest_GetBoundingVisibleRect(document.body).top +
- __ScrollTest_GetBoundingVisibleRect(document.body).height"""))
- rect_right = int(tab.runtime.Evaluate("""
- __ScrollTest_GetBoundingVisibleRect(document.body).left +
- __ScrollTest_GetBoundingVisibleRect(document.body).width"""))
- viewport_width = int(tab.runtime.Evaluate('window.innerWidth'))
- viewport_height = int(tab.runtime.Evaluate('window.innerHeight'))
-
- self.assertTrue(rect_bottom <= viewport_height)
- self.assertTrue(rect_right <= viewport_width)
-
-class ScrollingBenchmarkWithoutGpuBenchmarkingUnitTest(
- multi_page_benchmark_unittest_base.MultiPageBenchmarkUnitTestBase):
-
- def CustomizeOptionsForTest(self, options):
- options.no_gpu_benchmarking_extension = True
-
- def testScrollingWithoutGpuBenchmarkingExtension(self):
- ps = self.CreatePageSetFromFileInUnittestDataDir('scrollable_page.html')
-
- benchmark = scrolling_benchmark.ScrollingBenchmark()
- benchmark.use_gpu_benchmarking_extension = False
-
- all_results = self.RunBenchmark(benchmark, ps)
-
- self.assertEqual(0, len(all_results.page_failures))
- self.assertEqual(1, len(all_results.page_results))
- results0 = all_results.page_results[0]
-
- self.assertTrue('dropped_percent' in results0)
- self.assertTrue('mean_frame_time' in results0)
« no previous file with comments | « tools/perf/perf_tools/scrolling_benchmark.py ('k') | tools/perf/perf_tools/smoothness_benchmark.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698