OLD | NEW |
---|---|
(Empty) | |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 import logging | |
5 | |
6 from telemetry.page import page as page_module | |
7 from telemetry.page import page_set as page_set_module | |
8 from telemetry.core.backends.chrome_inspector import devtools_client_backend | |
9 | |
10 | |
11 class ToughScrollingWhileZoomedInCasesPage(page_module.Page): | |
12 | |
13 def __init__(self, url, page_set): | |
14 super(ToughScrollingWhileZoomedInCasesPage, self).__init__( | |
15 url=url, | |
16 page_set=page_set) | |
17 | |
18 def CanRunOnBrowser(self, browser_info): | |
19 if not browser_info.HasDiagonalScrollingSupport(): | |
20 logging.warning('Browser does not support syhtnetic diagonal scrolling,' | |
21 ' skipping test') | |
22 return False | |
23 return True | |
nednguyen
2015/03/16 16:52:40
I think we will not support CanRunOnBrowser as the
aiolos (Not reviewing)
2015/03/16 21:30:03
+1
| |
24 | |
25 def RunPageInteractions(self, action_runner): | |
26 # First, zoom into the page | |
27 action_runner.PinchPage( | |
28 scale_factor=20.0, | |
29 speed_in_pixels_per_second=10000) | |
30 # 20.0 was chosen because at the time it was close to the maximum. | |
31 # The more zoomed in, the more noticable the tile rasterization. | |
32 # | |
33 # 10,000 was chosen to complete this pre-step quickly. | |
34 | |
35 # Then start measurements | |
36 interaction = action_runner.BeginGestureInteraction( | |
37 'ScrollAction', is_smooth=True) | |
38 # And begin the diagonal scroll | |
39 action_runner.ScrollPage( | |
40 direction='downright', | |
41 speed_in_pixels_per_second=10000) | |
42 # 10,000 was chosen because it is fast enough to completely stress the | |
43 # rasterization (on a Nexus 5) without saturating results. | |
44 interaction.End() | |
45 | |
46 | |
47 class ToughScrollingWhileZoomedInCasesPageSet(page_set_module.PageSet): | |
48 """ | |
49 Description: A collection of difficult scrolling tests | |
50 """ | |
51 | |
52 def __init__(self): | |
53 super(ToughScrollingWhileZoomedInCasesPageSet, self).__init__( | |
54 user_agent_type='desktop', | |
55 archive_data_file='data/tough_pinch_zoom_cases.json', | |
56 bucket=page_set_module.PARTNER_BUCKET) | |
57 | |
58 # The following urls were chosen because they tend to have >15% | |
59 # mean_pixels_approximated at this scrolling speed. | |
60 urls_list = [ | |
61 'file://tough_scrolling_cases/background_fixed.html', | |
62 'file://tough_scrolling_cases/fixed_nonstacking.html', | |
63 'file://tough_scrolling_cases/iframe_scrolls.html', | |
64 'file://tough_scrolling_cases/wheel_div_prevdefault.html' | |
65 ] | |
66 | |
67 for url in urls_list: | |
68 self.AddUserStory(ToughScrollingWhileZoomedInCasesPage(url, self)) | |
OLD | NEW |