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

Unified Diff: tools/telemetry/telemetry/core/tab.py

Issue 12800004: [Telemetry] Add tab API function GetJavascriptStats(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
Index: tools/telemetry/telemetry/core/tab.py
diff --git a/tools/telemetry/telemetry/core/tab.py b/tools/telemetry/telemetry/core/tab.py
index 6e5c804892f7179365e67081daf4677f90401c39..29f35400dab37ee3159bb47ab5c711bf2a82600f 100644
--- a/tools/telemetry/telemetry/core/tab.py
+++ b/tools/telemetry/telemetry/core/tab.py
@@ -70,3 +70,20 @@ class Tab(web_contents.WebContents):
def GetCookieByName(self, name, timeout=DEFAULT_TAB_TIMEOUT):
"""Returns the value of the cookie by the given |name|."""
return self._inspector_backend.GetCookieByName(name, timeout)
+
+ def GetJavascriptStats(self, timeout=DEFAULT_TAB_TIMEOUT):
nduca 2013/03/13 03:58:44 GetDOMStats? Sorry if you suggested that in the p
dennis_jeffrey 2013/03/13 21:42:46 Yes, GetDOMStats sounds good to me. I made that c
+ """Returns a dictionary populated with measured Javascript statistics.
+
+ Currently this function returns:
+ {
+ 'document_count': integer,
+ 'node_count': integer,
+ 'event_listener_count': integer
+ }
+ """
+ dom_counters = self._inspector_backend.GetDomCounters(timeout)
nduca 2013/03/13 03:58:44 DOM or Dom? Just curious tbh. Shoudl the name mat
dennis_jeffrey 2013/03/13 21:42:46 Actually I prefer DOM when typing in MixedCase, so
+ return {
+ 'document_count': dom_counters['documents'],
nduca 2013/03/13 03:58:44 Should this conversion to the expected return type
dennis_jeffrey 2013/03/13 21:42:46 Done.
+ 'node_count': dom_counters['nodes'],
+ 'event_listener_count': dom_counters['jsEventListeners']
+ }

Powered by Google App Engine
This is Rietveld 408576698