Chromium Code Reviews| Index: tools/telemetry/telemetry/core/chrome/browser_backend.py |
| diff --git a/tools/telemetry/telemetry/core/chrome/browser_backend.py b/tools/telemetry/telemetry/core/chrome/browser_backend.py |
| index 66c64dea9ba503d1d5e3d59530730af37ca6272e..e65c72bd9e788098a3a9558e6edd38854f16df66 100644 |
| --- a/tools/telemetry/telemetry/core/chrome/browser_backend.py |
| +++ b/tools/telemetry/telemetry/core/chrome/browser_backend.py |
| @@ -2,12 +2,13 @@ |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| -import urllib2 |
| import httplib |
| -import socket |
| +import logging |
| import json |
| import re |
| +import socket |
| import sys |
| +import urllib2 |
| from telemetry.core import util |
| from telemetry.core import exceptions |
| @@ -228,6 +229,25 @@ class BrowserBackend(object): |
| def GetRemotePort(self, _): |
| return util.GetAvailableLocalPort() |
| + def CloseConnections(self): |
| + tab = self._tab_list_backend[0] |
| + try: |
| + tab.ExecuteJavaScript("""window.chrome && chrome.benchmarking && |
| + chrome.benchmarking.closeConnections();""") |
| + except Exception: |
| + pass |
| + |
| + def ClearCache(self): |
| + tab = self._tab_list_backend[0] |
| + try: |
| + tab.ExecuteJavaScript("""chrome.benchmarking.clearCache(); |
| + chrome.benchmarking.clearHostResolverCache(); |
| + chrome.benchmarking.clearPredictorCache(); |
| + chrome.benchmarking.closeConnections();""") |
| + except exceptions.EvaluateException: |
|
nduca
2013/06/06 22:49:04
this seems pretty funky, how do you know that this
tonyg
2013/06/20 02:42:29
This is gone now.
|
| + logging.error('Failed to clear cache. Is --enable-net-benchmarking set?') |
| + raise |
| + |
| def Close(self): |
| if self._tracing_backend: |
| self._tracing_backend.Close() |