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.
4 # pylint: disable=W0401,W0614
5 from telemetry.page.actions.all_page_actions import *
6 from telemetry.page import page as page_module
7 from telemetry.page import page_set as page_set_module
10 class IndexeddbOfflinePage(page_module.Page):
12 """ Why: Simulates user input while offline and sync while online. """
14 def __init__(self, page_set):
15 super(IndexeddbOfflinePage, self).__init__(
16 url='file://endure/indexeddb_app.html',
18 name='indexeddb_offline')
19 self.user_agent_type = 'desktop'
21 def RunNavigateSteps(self, action_runner):
22 action_runner.RunAction(NavigateAction())
23 action_runner.RunAction(WaitAction(
25 'text': 'initialized',
26 'condition': 'element'
29 def RunEndure(self, action_runner):
30 action_runner.RunAction(WaitAction(
32 'condition': 'element',
33 'selector': 'button[id="online"]:not(disabled)'
35 action_runner.RunAction(ClickElementAction(
37 'selector': 'button[id="online"]:not(disabled)'
39 action_runner.RunAction(WaitAction(
41 'xpath': 'id("state")[text()="online"]',
42 'condition': 'element'
44 action_runner.RunAction(WaitAction(
48 action_runner.RunAction(WaitAction(
50 'condition': 'element',
51 'selector': 'button[id="offline"]:not(disabled)'
53 action_runner.RunAction(ClickElementAction(
55 'selector': 'button[id="offline"]:not(disabled)'
57 action_runner.RunAction(WaitAction(
59 'xpath': 'id("state")[text()="offline"]',
60 'condition': 'element'
64 class IndexeddbOfflinePageSet(page_set_module.PageSet):
66 """ Chrome Endure test for IndexedDB. """
69 super(IndexeddbOfflinePageSet, self).__init__(
70 user_agent_type='desktop')
72 self.AddPage(IndexeddbOfflinePage(self))