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

Unified Diff: tools/perf/page_sets/system_health/searching_stories.py

Issue 2787103003: Add System health stories for Emerging market (Closed)
Patch Set: fixes. Created 3 years, 8 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
Index: tools/perf/page_sets/system_health/searching_stories.py
diff --git a/tools/perf/page_sets/system_health/searching_stories.py b/tools/perf/page_sets/system_health/searching_stories.py
index 329a0cb5ab276b5a16f3b94ee2e5bd9da0109144..c63588eca8c5f7618a8622644be463b56c872a36 100644
--- a/tools/perf/page_sets/system_health/searching_stories.py
+++ b/tools/perf/page_sets/system_health/searching_stories.py
@@ -2,12 +2,18 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+from page_sets.system_health import platforms
+from page_sets.system_health import story_tags
from page_sets.system_health import system_health_story
+from devil.android.sdk import keyevent # pylint: disable=import-error
+
+# TODO(ssid): Rename the search stories to browse stories crbug.com/708300.
class SearchGoogleStory(system_health_story.SystemHealthStory):
NAME = 'search:portal:google'
URL = 'https://www.google.co.uk/'
+ TAGS = [story_tags.EMERGING_MARKET]
_SEARCH_BOX_SELECTOR = 'input[aria-label="Search"]'
_RESULT_SELECTOR = '.r > a[href*="wikipedia"]'
@@ -33,3 +39,60 @@ class SearchGoogleStory(system_health_story.SystemHealthStory):
action_runner.Wait(1)
action_runner.TapElement(selector=self._RESULT_SELECTOR)
action_runner.tab.WaitForDocumentReadyStateToBeComplete()
+
+
+class SearchOmniboxStory(system_health_story.SystemHealthStory):
nednguyen 2017/04/11 22:24:10 Can you add description explain what this story do
ssid 2017/04/13 21:08:54 Done.
+ NAME = 'browse:chrome:omnibox'
+ URL = 'https://www.google.co.in'
+ SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
+ TAGS = [story_tags.EMERGING_MARKET]
+
+ def _DidLoadDocument(self, action_runner):
+ app_ui = action_runner.tab.browser.app_ui
+ platform = action_runner.tab.browser.platform
+ app_ui.WaitForUiNode(resource_id='url_bar')
+ url_bar = app_ui.GetUiNode(resource_id='url_bar')
+ url_bar.Tap()
+ action_runner.Wait(1) # user wait before typing
+ platform.android_action_runner.InputText('drake')
+ action_runner.Wait(0.5) # user wait after typing
+ platform.android_action_runner.InputKeyEvent(keyevent.KEYCODE_ENTER)
+
+ action_runner.WaitForNavigate(15)
nednguyen 2017/04/11 22:24:10 why is this 15 seconds? Can you make this wait to
ssid 2017/04/13 21:08:54 I didn't know this argument was not required. remo
+ action_runner.ScrollPage(use_touch=True, distance=500)
+
+
+class MobileNewTabPageStory(system_health_story.SystemHealthStory):
+ """Story that loads new tab page and opens menu."""
nednguyen 2017/04/11 22:24:10 The story below does more than this. Can you impro
ssid 2017/04/13 21:08:54 Done.
+
+ NAME = 'browse:chrome:newtab'
+ URL = 'chrome://newtab'
+ _SEARCH_TEXTS = ['does google know everything',
+ 'most famous paintings',
+ 'current weather',
+ 'best movies 2016',
+ 'how to tie a tie']
+
+ SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
+ TAGS = [story_tags.EMERGING_MARKET]
+
+ def _DidLoadDocument(self, action_runner):
+ app_ui = action_runner.tab.browser.app_ui
+ platform = action_runner.tab.browser.platform
+ renderer_view = app_ui.WaitForUiNode(resource_id='compositor_view_holder')
+ scroll_start = 0.5 * (
+ renderer_view.bounds.center + renderer_view.bounds.bottom_right)
+ platform.android_action_runner.SmoothScrollBy(
+ scroll_start.x, scroll_start.y, 'down', 300)
+ for keyword in self._SEARCH_TEXTS:
+ app_ui.WaitForUiNode(resource_id='search_box').Tap()
+ platform.android_action_runner.InputText(keyword)
+ platform.android_action_runner.InputKeyEvent(keyevent.KEYCODE_ENTER)
+ action_runner.WaitForNavigate()
+ action_runner.Wait(1.5) # Read results
+ action_runner.ScrollPage(use_touch=True)
+ action_runner.NavigateBack()
+ action_runner.WaitForNavigate()
+
+ app_ui.WaitForUiNode(resource_id='menu_button').Tap()
+ app_ui.WaitForUiNode(resource_id='menu_item_text')

Powered by Google App Engine
This is Rietveld 408576698