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

Unified Diff: tools/perf/page_sets/top_25_smooth.py

Issue 985603003: Adding telemetry test for page scroll using scrollbar drag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed comment. Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/telemetry/telemetry/page/actions/action_runner.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/page_sets/top_25_smooth.py
diff --git a/tools/perf/page_sets/top_25_smooth.py b/tools/perf/page_sets/top_25_smooth.py
index b19a0bf8b7d5e372870fd61229fd1faa6ae3f408..06bcb2483d812e6e451d5324762037ab58c12a10 100644
--- a/tools/perf/page_sets/top_25_smooth.py
+++ b/tools/perf/page_sets/top_25_smooth.py
@@ -53,6 +53,51 @@ class GmailSmoothPage(top_pages.GmailPage):
interaction.End()
+class GmailMouseScrollPage(top_pages.GmailPage):
+
+ """ Why: productivity, top google properties """
+
+ def RunPageInteractions(self, action_runner):
+ action_runner.ExecuteJavaScript('''
+ gmonkey.load('2.0', function(api) {
+ window.__scrollableElementForTelemetry = api.getScrollableElement();
+ });''')
+ action_runner.WaitForJavaScriptCondition(
+ 'window.__scrollableElementForTelemetry != null')
+ scrollbar_x, start_y, end_y = self._CalculateScrollBarRatios(action_runner)
+
+ interaction = action_runner.BeginGestureInteraction(
+ 'DragAction', is_smooth=True)
+ action_runner.DragPage(left_start_ratio=scrollbar_x,
+ top_start_ratio=start_y, left_end_ratio=scrollbar_x,
+ top_end_ratio=end_y, speed_in_pixels_per_second=100,
+ element_function='window.__scrollableElementForTelemetry')
+ interaction.End()
+
+ def CanRunOnBrowser(self, browser_info):
+ return (browser_info._browser._platform_backend.platform.GetOSName() !=
+ 'android')
+
+ def _CalculateScrollBarRatios(self, action_runner):
+ viewport_height = float(action_runner.EvaluateJavaScript(
+ 'window.__scrollableElementForTelemetry.clientHeight'))
+ content_height = float(action_runner.EvaluateJavaScript(
+ 'window.__scrollableElementForTelemetry.scrollHeight'))
+ viewport_width = float(action_runner.EvaluateJavaScript(
+ 'window.__scrollableElementForTelemetry.offsetWidth'))
+ scrollbar_width = float(action_runner.EvaluateJavaScript('''
+ window.__scrollableElementForTelemetry.offsetWidth -
+ window.__scrollableElementForTelemetry.scrollWidth'''))
+
+ # This calculation is correct only when the element doesn't have border or
+ # padding or scroll buttons (eg: gmail mail element).
+ scrollbar_start_mid_y = viewport_height / (2 * content_height)
+ scrollbar_end_mid_y = 1 - scrollbar_start_mid_y
+ scrollbar_mid_x_offset = scrollbar_width / (2 * viewport_width)
+ scrollbar_mid_x = 1 - scrollbar_mid_x_offset
+ return scrollbar_mid_x, scrollbar_start_mid_y, scrollbar_end_mid_y
+
+
class GoogleCalendarSmoothPage(top_pages.GoogleCalendarPage):
""" Why: productivity, top google properties """
@@ -118,6 +163,7 @@ class Top25SmoothPageSet(page_set_module.PageSet):
self.AddUserStory(_CreatePageClassWithSmoothInteractions(
top_pages.GoogleWebSearchPage)(self))
self.AddUserStory(GmailSmoothPage(self))
+ self.AddUserStory(GmailMouseScrollPage(self))
self.AddUserStory(GoogleCalendarSmoothPage(self))
self.AddUserStory(_CreatePageClassWithSmoothInteractions(
top_pages.GoogleImageSearchPage)(self))
« no previous file with comments | « no previous file | tools/telemetry/telemetry/page/actions/action_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698