| Index: tools/perf/page_sets/gmail_alt_threadlist_conversation.py
|
| diff --git a/tools/perf/page_sets/gmail_alt_threadlist_conversation.py b/tools/perf/page_sets/gmail_alt_threadlist_conversation.py
|
| index 5e1c53641c29e6d99032e88cfee393f825418595..7630c5af5da2ccacdf8d1fa99693e95354128c25 100644
|
| --- a/tools/perf/page_sets/gmail_alt_threadlist_conversation.py
|
| +++ b/tools/perf/page_sets/gmail_alt_threadlist_conversation.py
|
| @@ -1,12 +1,33 @@
|
| # 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)'
|
| + '.singleNodeValue' % re.escape(xpath))
|
| +
|
| +
|
| +def _GetCurrentLocation(action_runner):
|
| + return action_runner.EvaluateJavaScript('document.location.href')
|
| +
|
| +
|
| +def _WaitForLocationChange(action_runner, old_href):
|
| + action_runner.WaitForJavaScriptCondition(
|
| + 'document.location.href != "%s"' % old_href)
|
| +
|
| +
|
| class GmailAltThreadlistConversationPage(
|
| page_module.Page):
|
|
|
| @@ -29,17 +50,15 @@ class GmailAltThreadlistConversationPage(
|
| 'document.getElementById("gb") !== null')
|
|
|
| def RunEndure(self, action_runner):
|
| - action_runner.RunAction(ClickElementAction(
|
| - {
|
| - 'xpath': '//span[@email]',
|
| - 'wait_until': {'condition': 'href_change'}
|
| - }))
|
| + old_href = _GetCurrentLocation(action_runner)
|
| + action_runner.ClickElement(
|
| + element_function=_CreateXpathFunction('//span[@email]'))
|
| + _WaitForLocationChange(action_runner, old_href)
|
| action_runner.Wait(1)
|
| - action_runner.RunAction(ClickElementAction(
|
| - {
|
| - 'wait_until': {'condition': 'href_change'},
|
| - 'selector': 'a[href="https://mail.google.com/mail/u/0/?shva=1#inbox"]'
|
| - }))
|
| + old_href = _GetCurrentLocation(action_runner)
|
| + action_runner.ClickElement(
|
| + 'a[href="https://mail.google.com/mail/u/0/?shva=1#inbox"]')
|
| + _WaitForLocationChange(action_runner, old_href)
|
| action_runner.Wait(1)
|
|
|
|
|
|
|