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

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

Issue 11753023: [telemetry] Clean up image decoding benchmark (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: helps if i upload a working patch Created 7 years, 11 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 os 4 import os
5 import re 5 import re
6 import time 6 import time
7 import urlparse 7 import urlparse
8 8
9 from telemetry import util 9 from telemetry import util
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 def __str__(self): 61 def __str__(self):
62 return self.url 62 return self.url
63 63
64 def WaitToLoad(self, tab, timeout, poll_interval=0.1): 64 def WaitToLoad(self, tab, timeout, poll_interval=0.1):
65 Page.WaitForPageToLoad(self, tab, timeout, poll_interval) 65 Page.WaitForPageToLoad(self, tab, timeout, poll_interval)
66 66
67 @staticmethod 67 @staticmethod
68 def WaitForPageToLoad(obj, tab, timeout, poll_interval=0.1): 68 def WaitForPageToLoad(obj, tab, timeout, poll_interval=0.1):
69 """Waits for various wait conditions present in obj.""" 69 """Waits for various wait conditions present in obj."""
70 if hasattr(obj, 'post_navigate_javascript_to_execute'):
71 tab.runtime.Evaluate(obj.post_navigate_javascript_to_execute)
72
70 if hasattr(obj, 'wait_seconds'): 73 if hasattr(obj, 'wait_seconds'):
71 time.sleep(obj.wait_seconds) 74 time.sleep(obj.wait_seconds)
72 if hasattr(obj, 'wait_for_element_with_text'): 75 if hasattr(obj, 'wait_for_element_with_text'):
73 callback_code = 'function(element) { return element != null; }' 76 callback_code = 'function(element) { return element != null; }'
74 util.WaitFor( 77 util.WaitFor(
75 lambda: util.FindElementAndPerformAction( 78 lambda: util.FindElementAndPerformAction(
76 tab, obj.wait_for_element_with_text, callback_code), 79 tab, obj.wait_for_element_with_text, callback_code),
77 timeout, poll_interval) 80 timeout, poll_interval)
78 if hasattr(obj, 'wait_for_element_with_selector'): 81 if hasattr(obj, 'wait_for_element_with_selector'):
79 util.WaitFor(lambda: tab.runtime.Evaluate( 82 util.WaitFor(lambda: tab.runtime.Evaluate(
80 'document.querySelector(\'' + obj.wait_for_element_with_selector + 83 'document.querySelector(\'' + obj.wait_for_element_with_selector +
81 '\') != null'), timeout, poll_interval) 84 '\') != null'), timeout, poll_interval)
82 if hasattr(obj, 'wait_for_javascript_expression'): 85 if hasattr(obj, 'wait_for_javascript_expression'):
83 util.WaitFor( 86 util.WaitFor(
84 lambda: tab.runtime.Evaluate(obj.wait_for_javascript_expression), 87 lambda: tab.runtime.Evaluate(obj.wait_for_javascript_expression),
85 timeout, poll_interval) 88 timeout, poll_interval)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698