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

Side by Side Diff: tools/perf/page_sets/gmail_alt_two_labels.py

Issue 323833003: Create ActionRunner wrapper API over TapAction and ClickElementAction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing to head. Created 6 years, 6 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 unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 # pylint: disable=W0401,W0614 4 # pylint: disable=W0401,W0614
5 from telemetry.page.actions.all_page_actions import * 5 from telemetry.page.actions.all_page_actions import *
6 from telemetry.page import page as page_module 6 from telemetry.page import page as page_module
7 from telemetry.page import page_set as page_set_module 7 from telemetry.page import page_set as page_set_module
8 8
9 9
10 def _GetCurrentLocation(action_runner):
11 return action_runner.EvaluateJavaScript('document.location.href')
12
13
14 def _WaitForLocationChange(action_runner, old_href):
15 action_runner.WaitForJavaScriptCondition(
16 'document.location.href != "%s"' % old_href)
17
18
10 class GmailAltTwoLabelsPage(page_module.Page): 19 class GmailAltTwoLabelsPage(page_module.Page):
11 20
12 """ Why: Alternate between Inbox and Sent Mail """ 21 """ Why: Alternate between Inbox and Sent Mail """
13 22
14 def __init__(self, page_set): 23 def __init__(self, page_set):
15 super(GmailAltTwoLabelsPage, self).__init__( 24 super(GmailAltTwoLabelsPage, self).__init__(
16 url='https://mail.google.com/mail/', 25 url='https://mail.google.com/mail/',
17 page_set=page_set, 26 page_set=page_set,
18 name='gmail_alt_two_labels') 27 name='gmail_alt_two_labels')
19 28
20 self.credentials_path = 'data/credentials.json' 29 self.credentials_path = 'data/credentials.json'
21 self.credentials = 'google' 30 self.credentials = 'google'
22 self.user_agent_type = 'desktop' 31 self.user_agent_type = 'desktop'
23 self.archive_data_file = 'data/gmail_alt_two_labels.json' 32 self.archive_data_file = 'data/gmail_alt_two_labels.json'
24 33
25 def RunNavigateSteps(self, action_runner): 34 def RunNavigateSteps(self, action_runner):
26 action_runner.NavigateToPage(self) 35 action_runner.NavigateToPage(self)
27 action_runner.WaitForJavaScriptCondition( 36 action_runner.WaitForJavaScriptCondition(
28 'window.gmonkey !== undefined && ' 37 'window.gmonkey !== undefined && '
29 'document.getElementById("gb") !== null') 38 'document.getElementById("gb") !== null')
30 39
31 def RunEndure(self, action_runner): 40 def RunEndure(self, action_runner):
32 action_runner.RunAction(ClickElementAction( 41 old_href = _GetCurrentLocation(action_runner)
33 { 42 action_runner.ClickElement(
34 'wait_until': {'condition': 'href_change'}, 43 'a[href="https://mail.google.com/mail/u/0/?shva=1#sent"]')
35 'selector': 'a[href="https://mail.google.com/mail/u/0/?shva=1#sent"]' 44 _WaitForLocationChange(action_runner, old_href)
36 }))
37 action_runner.Wait(1) 45 action_runner.Wait(1)
38 action_runner.RunAction(ClickElementAction( 46 old_href = _GetCurrentLocation(action_runner)
39 { 47 action_runner.ClickElement(
40 'wait_until': {'condition': 'href_change'}, 48 'a[href="https://mail.google.com/mail/u/0/?shva=1#inbox"]')
41 'selector': 'a[href="https://mail.google.com/mail/u/0/?shva=1#inbox"]' 49 _WaitForLocationChange(action_runner, old_href)
42 }))
43 action_runner.Wait(1) 50 action_runner.Wait(1)
44 51
45 52
46 class GmailAltTwoLabelsPageSet(page_set_module.PageSet): 53 class GmailAltTwoLabelsPageSet(page_set_module.PageSet):
47 54
48 """ Chrome Endure test for GMail. """ 55 """ Chrome Endure test for GMail. """
49 56
50 def __init__(self): 57 def __init__(self):
51 super(GmailAltTwoLabelsPageSet, self).__init__( 58 super(GmailAltTwoLabelsPageSet, self).__init__(
52 credentials_path='data/credentials.json', 59 credentials_path='data/credentials.json',
53 user_agent_type='desktop', 60 user_agent_type='desktop',
54 archive_data_file='data/gmail_alt_two_labels.json') 61 archive_data_file='data/gmail_alt_two_labels.json')
55 62
56 self.AddPage(GmailAltTwoLabelsPage(self)) 63 self.AddPage(GmailAltTwoLabelsPage(self))
OLDNEW
« no previous file with comments | « tools/perf/page_sets/gmail_alt_threadlist_conversation.py ('k') | tools/perf/page_sets/gmail_compose_discard.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698