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

Side by Side Diff: tools/telemetry/telemetry/page/wait_action.py

Issue 12278015: [Telemetry] Reorganize everything. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-add shebangs. Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 import time 4 import time
5 5
6 from telemetry import page_action 6 from telemetry.core import util
7 from telemetry import util 7 from telemetry.page import page_action
8 8
9 class WaitAction(page_action.PageAction): 9 class WaitAction(page_action.PageAction):
10 DEFAULT_TIMEOUT = 60 10 DEFAULT_TIMEOUT = 60
11 11
12 def __init__(self, attributes=None): 12 def __init__(self, attributes=None):
13 super(WaitAction, self).__init__(attributes) 13 super(WaitAction, self).__init__(attributes)
14 14
15 def RunsPreviousAction(self): 15 def RunsPreviousAction(self):
16 assert hasattr(self, 'condition') 16 assert hasattr(self, 'condition')
17 return self.condition == 'navigate' or self.condition == 'href_change' 17 return self.condition == 'navigate' or self.condition == 'href_change'
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 tab, self.text, callback_code), self.DEFAULT_TIMEOUT) 50 tab, self.text, callback_code), self.DEFAULT_TIMEOUT)
51 elif self.selector: 51 elif self.selector:
52 util.WaitFor(lambda: tab.EvaluateJavaScript( 52 util.WaitFor(lambda: tab.EvaluateJavaScript(
53 'document.querySelector("%s") != null' % self.selector), 53 'document.querySelector("%s") != null' % self.selector),
54 self.DEFAULT_TIMEOUT) 54 self.DEFAULT_TIMEOUT)
55 55
56 elif self.condition == 'javascript': 56 elif self.condition == 'javascript':
57 assert hasattr(self, 'javascript') 57 assert hasattr(self, 'javascript')
58 util.WaitFor(lambda: tab.EvaluateJavaScript(self.javascript), 58 util.WaitFor(lambda: tab.EvaluateJavaScript(self.javascript),
59 self.DEFAULT_TIMEOUT) 59 self.DEFAULT_TIMEOUT)
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/page/scrolling_action_unittest.py ('k') | tools/telemetry/telemetry/page/wait_action_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698