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

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: Addressed second round of review comments. 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..979b6453df09e5e4e7641d3d6da23019c287e508 100644
--- a/tools/telemetry/telemetry/core/tab.py
+++ b/tools/telemetry/telemetry/core/tab.py
@@ -31,6 +31,25 @@ class Tab(web_contents.WebContents):
def url(self):
return self._inspector_backend.url
+ @property
+ def dom_stats(self):
+ """A dictionary populated with measured DOM statistics.
+
+ Currently this dictionary contains:
+ {
+ 'document_count': integer,
+ 'node_count': integer,
+ 'event_listener_count': integer
+ }
+ """
+ dom_counters = self._inspector_backend.GetDOMStats(
+ timeout=DEFAULT_TAB_TIMEOUT)
+ assert (len(dom_counters) == 3 and
+ all([x in dom_counters for x in ['document_count', 'node_count',
+ 'event_listener_count']]))
+ return dom_counters
+
+
def Activate(self):
"""Brings this tab to the foreground asynchronously.

Powered by Google App Engine
This is Rietveld 408576698