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

Unified Diff: tools/perf/metrics/speedindex.py

Issue 185413005: [Telemetry] Move page quiescence test to WebContents (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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
« no previous file with comments | « tools/perf/metrics/speedindex.js ('k') | tools/telemetry/telemetry/core/network_quiescence.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/metrics/speedindex.py
diff --git a/tools/perf/metrics/speedindex.py b/tools/perf/metrics/speedindex.py
index e743f1848b90901b277e5507511052c61aad00ab..ab3068df5422a1f68c46b2e3673d515ae0308070 100644
--- a/tools/perf/metrics/speedindex.py
+++ b/tools/perf/metrics/speedindex.py
@@ -3,7 +3,6 @@
# found in the LICENSE file.
import collections
-import os
from metrics import Metric
from telemetry.core import bitmap
@@ -23,10 +22,6 @@ class SpeedIndexMetric(Metric):
def __init__(self):
super(SpeedIndexMetric, self).__init__()
self._impl = None
- self._script_is_loaded = False
- self._is_finished = False
- with open(os.path.join(os.path.dirname(__file__), 'speedindex.js')) as f:
- self._js = f.read()
@classmethod
def CustomizeBrowserOptions(cls, options):
@@ -42,8 +37,6 @@ class SpeedIndexMetric(Metric):
self._impl = (VideoSpeedIndexImpl() if tab.video_capture_supported else
PaintRectSpeedIndexImpl())
self._impl.Start(tab)
- self._script_is_loaded = False
- self._is_finished = False
def Stop(self, _, tab):
"""Stop timeline recording."""
@@ -78,23 +71,7 @@ class SpeedIndexMetric(Metric):
True if 2 seconds have passed since last resource received, false
otherwise.
"""
- if self._is_finished:
- return True
-
- # The script that provides the function window.timeSinceLastResponseMs()
- # needs to be loaded for this function, but it must be loaded AFTER
- # the Start method is called, because if the Start method is called in
- # the PageMeasurement's WillNavigateToPage function, then it will
- # not be available here. The script should only be re-loaded once per page
- # so that variables in the script get reset only for a new page.
- if not self._script_is_loaded:
- tab.ExecuteJavaScript(self._js)
- self._script_is_loaded = True
-
- time_since_last_response_ms = tab.EvaluateJavaScript(
- "window.timeSinceLastResponseAfterLoadMs()")
- self._is_finished = time_since_last_response_ms > 2000
- return self._is_finished
+ return tab.HasReachedQuiescence()
class SpeedIndexImpl(object):
« no previous file with comments | « tools/perf/metrics/speedindex.js ('k') | tools/telemetry/telemetry/core/network_quiescence.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698