Mojo C++ bindings: better log message for serialization warnings.
[chromium-blink-merge.git] / tools / perf / page_sets / indexeddb_offline.py
blob9e808ee8f59a1b29caccd955824f512ca01a56aa
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
3 # found in the LICENSE file.
5 import re
7 from telemetry.page import page as page_module
8 from telemetry.page import page_set as page_set_module
11 def _CreateXpathFunction(xpath):
12 return ('document.evaluate("%s",'
13 'document,'
14 'null,'
15 'XPathResult.FIRST_ORDERED_NODE_TYPE,'
16 'null)'
17 '.singleNodeValue' % re.escape(xpath))
20 class IndexeddbOfflinePage(page_module.Page):
22 """ Why: Simulates user input while offline and sync while online. """
24 def __init__(self, page_set):
25 super(IndexeddbOfflinePage, self).__init__(
26 url='file://endure/indexeddb_app.html',
27 page_set=page_set,
28 name='indexeddb_offline')
29 self.user_agent_type = 'desktop'
31 def RunNavigateSteps(self, action_runner):
32 action_runner.NavigateToPage(self)
33 action_runner.WaitForElement(text='initialized')
35 def RunEndure(self, action_runner):
36 action_runner.WaitForElement('button[id="online"]:not(disabled)')
37 action_runner.ClickElement('button[id="online"]:not(disabled)')
38 action_runner.WaitForElement(
39 element_function=_CreateXpathFunction('id("state")[text()="online"]'))
40 action_runner.Wait(1)
41 action_runner.WaitForElement('button[id="offline"]:not(disabled)')
42 action_runner.ClickElement('button[id="offline"]:not(disabled)')
43 action_runner.WaitForElement(
44 element_function=_CreateXpathFunction('id("state")[text()="offline"]'))
47 class IndexeddbOfflinePageSet(page_set_module.PageSet):
49 """ Chrome Endure test for IndexedDB. """
51 def __init__(self):
52 super(IndexeddbOfflinePageSet, self).__init__(
53 user_agent_type='desktop')
55 self.AddPage(IndexeddbOfflinePage(self))