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

Side by Side Diff: tools/perf/page_sets/system_health/background_stories.py

Issue 2505803002: Re-enable background:news:nytimes to examine crash (Closed)
Patch Set: fix story for n7 Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 4
5 from page_sets.system_health import platforms 5 from page_sets.system_health import platforms
6 from page_sets.system_health import system_health_story 6 from page_sets.system_health import system_health_story
7 from page_sets.system_health.loading_stories import LoadGmailMobileStory 7 from page_sets.system_health.loading_stories import LoadGmailMobileStory
8 8
9 from telemetry import decorators
10
11
12 _WAIT_FOR_VIDEO_SECONDS = 5 9 _WAIT_FOR_VIDEO_SECONDS = 5
13 10
14 class _BackgroundStory(system_health_story.SystemHealthStory): 11 class _BackgroundStory(system_health_story.SystemHealthStory):
15 """Abstract base class for background stories 12 """Abstract base class for background stories
16 13
17 As in _LoadingStory except it puts the browser into the 14 As in _LoadingStory except it puts the browser into the
18 background before measuring. 15 background before measuring.
19 """ 16 """
20 ABSTRACT_STORY = True 17 ABSTRACT_STORY = True
21 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY 18 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
(...skipping 13 matching lines...) Expand all
35 action_runner.ScrollPageToElement(selector='g-fab') 32 action_runner.ScrollPageToElement(selector='g-fab')
36 action_runner.TapElement(selector='g-fab') 33 action_runner.TapElement(selector='g-fab')
37 34
38 35
39 class BackgroundFacebookMobileStory(_BackgroundStory): 36 class BackgroundFacebookMobileStory(_BackgroundStory):
40 NAME = 'background:social:facebook' 37 NAME = 'background:social:facebook'
41 URL = 'https://www.facebook.com/rihanna' 38 URL = 'https://www.facebook.com/rihanna'
42 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY 39 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
43 40
44 41
45 @decorators.Disabled('android') # crbug.com/664521
46 class BackgroundNytimesMobileStory(_BackgroundStory): 42 class BackgroundNytimesMobileStory(_BackgroundStory):
47 """The third top website in http://www.alexa.com/topsites/category/News""" 43 """The third top website in http://www.alexa.com/topsites/category/News"""
48 NAME = 'background:news:nytimes' 44 NAME = 'background:news:nytimes'
49 URL = 'http://www.nytimes.com/2016/10/04/us/politics/vice-presidential-debate. html?_r=0' 45 URL = 'http://www.nytimes.com/2016/10/04/us/politics/vice-presidential-debate. html?_r=0'
50 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY 46 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
51 47
52 def _DidLoadDocument(self, action_runner): 48 def _DidLoadDocument(self, action_runner):
53 # Dismiss the 'You have n free articles' message. 49 # Dismiss the 'You have n free articles' message.
54 action_runner.WaitForElement(selector='.growl-dismiss') 50 action_runner.WaitForElement(selector='.growl-dismiss')
55 action_runner.TapElement(selector='.growl-dismiss') 51 action_runner.TapElement(selector='.growl-dismiss')
56 52
57 # Tap the 'Show Full Article' button. 53 # Tap the 'Show Full Article' button.
58 action_runner.WaitForElement(selector='#additional-content button') 54 action_runner.WaitForElement(selector='#additional-content button')
59 action_runner.ScrollPageToElement(selector='#additional-content button') 55 action_runner.ScrollPageToElement(selector='#additional-content button')
60 # TapElement seems flaky here so use JavaScript instead. 56 # TapElement seems flaky here so use JavaScript instead.
61 action_runner.ExecuteJavaScript( 57 action_runner.ExecuteJavaScript(
62 'document.querySelector("#additional-content button").click()') 58 'document.querySelector("#additional-content button").click()')
63 59
64 # Scroll to video, start it and then wait for a few seconds. 60 # Scroll to video, start it and then wait for a few seconds.
65 action_runner.WaitForElement(selector='.nytd-player-poster') 61 action_runner.WaitForElement(selector='.nytd-player-poster')
66 action_runner.ScrollPageToElement(selector='.nytd-player-poster') 62 action_runner.ScrollPageToElement(selector='.nytd-player-poster')
63 # For some reason on some devices (e.g. Nexus7) we don't scroll all the way
64 # to the element. I think this might be caused by the page reflowing (due to
65 # vidoes loading) during the scroll. To be sure we get to the element
66 # wait a moment and then try to scroll again.
67 action_runner.Wait(1)
68 action_runner.ScrollPageToElement(selector='.nytd-player-poster')
perezju 2016/11/25 14:05:40 I'm OK with this as a short-term fix, but sounds l
67 action_runner.TapElement(selector='.nytd-player-poster') 69 action_runner.TapElement(selector='.nytd-player-poster')
68 action_runner.Wait(_WAIT_FOR_VIDEO_SECONDS) 70 action_runner.Wait(_WAIT_FOR_VIDEO_SECONDS)
69 71
70 72
71 class BackgroundImgurMobileStory(_BackgroundStory): 73 class BackgroundImgurMobileStory(_BackgroundStory):
72 NAME = 'background:media:imgur' 74 NAME = 'background:media:imgur'
73 URL = 'http://imgur.com/gallery/hUita' 75 URL = 'http://imgur.com/gallery/hUita'
74 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY 76 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
75 77
76 78
77 class BackgroundGmailMobileStory(LoadGmailMobileStory): 79 class BackgroundGmailMobileStory(LoadGmailMobileStory):
78 NAME = 'background:tools:gmail' 80 NAME = 'background:tools:gmail'
79 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY 81 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
80 82
81 def _Measure(self, action_runner): 83 def _Measure(self, action_runner):
82 action_runner.tab.browser.Background() 84 action_runner.tab.browser.Background()
83 super(BackgroundGmailMobileStory, self)._Measure(action_runner) 85 super(BackgroundGmailMobileStory, self)._Measure(action_runner)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698