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

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

Issue 165193002: [Telemetry] Fix --cold-load-percent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unittest Created 6 years, 10 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 d44fc097f83dbf521a42a47eb16408fc6838defd..8b677df19c5e58e8b69561ea4d01c2b88fb85e80 100644
--- a/tools/telemetry/telemetry/core/tab.py
+++ b/tools/telemetry/telemetry/core/tab.py
@@ -253,6 +253,21 @@ class Tab(web_contents.WebContents):
def CollectGarbage(self):
self._inspector_backend.CollectGarbage()
- def ClearCache(self):
- """Clears the browser's HTTP disk cache and the tab's HTTP memory cache."""
- self._inspector_backend.ClearCache()
+ def ClearCache(self, force):
+ """Clears the browser's networking related disk, memory and other caches.
+
+ Args:
+ force: Iff true, navigates to about:blank which destroys the previous
+ renderer, ensuring that even "live" resources in the memory cache are
+ cleared.
+ """
+ self.ExecuteJavaScript("""
+ if (window.chrome && chrome.benchmarking &&
+ chrome.benchmarking.clearCache) {
+ chrome.benchmarking.clearCache();
+ chrome.benchmarking.clearPredictorCache();
+ chrome.benchmarking.clearHostResolverCache();
+ }
+ """)
+ if force:
+ self.Navigate('about:blank')

Powered by Google App Engine
This is Rietveld 408576698