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

Unified Diff: tools/perf/page_sets/indexeddb_offline.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
« no previous file with comments | « tools/perf/page_sets/image_decoding_measurement.py ('k') | tools/perf/page_sets/key_desktop_sites.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/page_sets/indexeddb_offline.py
diff --git a/tools/perf/page_sets/indexeddb_offline.py b/tools/perf/page_sets/indexeddb_offline.py
index 58bfffeacca7ab100617f669f1fcc2825db2550d..aef9af953b3d85d1be420aef5816b9a3363c74b8 100644
--- a/tools/perf/page_sets/indexeddb_offline.py
+++ b/tools/perf/page_sets/indexeddb_offline.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 IndexeddbOfflinePage(page_module.Page):
""" Why: Simulates user input while offline and sync while online. """
@@ -20,45 +29,24 @@ class IndexeddbOfflinePage(page_module.Page):
def RunNavigateSteps(self, action_runner):
action_runner.NavigateToPage(self)
- action_runner.RunAction(WaitAction(
- {
- 'text': 'initialized',
- 'condition': 'element'
- }))
+ action_runner.WaitForElement(text='initialized')
def RunEndure(self, action_runner):
- action_runner.RunAction(WaitAction(
- {
- 'condition': 'element',
- 'selector': 'button[id="online"]:not(disabled)'
- }))
+ action_runner.WaitForElement('button[id="online"]:not(disabled)')
action_runner.RunAction(ClickElementAction(
{
'selector': 'button[id="online"]:not(disabled)'
}))
- action_runner.RunAction(WaitAction(
- {
- 'xpath': 'id("state")[text()="online"]',
- 'condition': 'element'
- }))
- action_runner.RunAction(WaitAction(
- {
- "seconds": 1
- }))
- action_runner.RunAction(WaitAction(
- {
- 'condition': 'element',
- 'selector': 'button[id="offline"]:not(disabled)'
- }))
+ action_runner.WaitForElement(
+ element_function=_CreateXpathFunction('id("state")[text()="online"]'))
+ action_runner.Wait(1)
+ action_runner.WaitForElement('button[id="offline"]:not(disabled)')
action_runner.RunAction(ClickElementAction(
{
'selector': 'button[id="offline"]:not(disabled)'
}))
- action_runner.RunAction(WaitAction(
- {
- 'xpath': 'id("state")[text()="offline"]',
- 'condition': 'element'
- }))
+ action_runner.WaitForElement(
+ element_function=_CreateXpathFunction('id("state")[text()="offline"]'))
class IndexeddbOfflinePageSet(page_set_module.PageSet):
« no previous file with comments | « tools/perf/page_sets/image_decoding_measurement.py ('k') | tools/perf/page_sets/key_desktop_sites.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698