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

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

Issue 321563003: Add Wait* API to ActionRunner to wrap over WaitAction. (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 side-by-side diff with in-line comments
Download patch
Index: tools/perf/page_sets/gmail_compose_discard.py
diff --git a/tools/perf/page_sets/gmail_compose_discard.py b/tools/perf/page_sets/gmail_compose_discard.py
index 264878ba90b73baaca375f336e19b9f0bf8d7a3b..018dd9eec9968b4e989a574b3d14fe7a3aeaff2e 100644
--- a/tools/perf/page_sets/gmail_compose_discard.py
+++ b/tools/perf/page_sets/gmail_compose_discard.py
@@ -1,12 +1,21 @@
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+
+import re
+
# pylint: disable=W0401,W0614
from telemetry.page.actions.all_page_actions import *
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
+def _CreateXpathFunction(xpath):
+ return ('document.evaluate(%s, document, null, '
+ 'XPathResult.FIRST_ORDERED_NODE_TYPE, null)'
+ '.singleNodeEvaluate') % re.escape(xpath)
+
+
class GmailComposeDiscardPage(page_module.Page):
""" Why: Compose and discard a new email """
@@ -21,12 +30,9 @@ class GmailComposeDiscardPage(page_module.Page):
def RunNavigateSteps(self, action_runner):
action_runner.NavigateToPage(self)
- action_runner.RunAction(WaitAction(
- {
- 'javascript': (
- 'window.gmonkey !== undefined &&'
- 'document.getElementById("gb") !== null')
- }))
+ action_runner.WaitForJavaScriptCondition(
+ 'window.gmonkey !== undefined &&'
+ 'document.getElementById("gb") !== null')
def ComposeClick(self, action_runner):
action_runner.ExecuteJavaScript('''
@@ -41,23 +47,17 @@ class GmailComposeDiscardPage(page_module.Page):
button.dispatchEvent(mouseupevent);''')
def RunEndure(self, action_runner):
- action_runner.RunAction(WaitAction(
- {
- 'xpath': '//div[text()="COMPOSE"]',
- 'condition': 'element'
- }))
+ action_runner.WaitForElement(
+ element_function=_CreateXpathFunction('//div[text()="COMPOSE"]'))
self.ComposeClick(action_runner)
- action_runner.RunAction(WaitAction({"seconds": 1}))
- action_runner.RunAction(WaitAction(
- {
- 'condition': 'element',
- 'selector': 'div[class~="oh"][data-tooltip="Discard draft"]'
- }))
+ action_runner.Wait(1)
+ action_runner.WaitForElement(
+ 'div[class~="oh"][data-tooltip="Discard draft"]')
action_runner.RunAction(ClickElementAction(
{
'selector': 'div[class~="oh"][data-tooltip="Discard draft"]'
}))
- action_runner.RunAction(WaitAction({'seconds': 1}))
+ action_runner.Wait(1)
class GmailComposeDiscardPageSet(page_set_module.PageSet):
« no previous file with comments | « tools/perf/page_sets/gmail_alt_two_labels.py ('k') | tools/perf/page_sets/gmail_expand_collapse_conversation.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698