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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/inspector/network-test.js

Issue 2570553002: Clear cache before running the test (Closed)
Patch Set: Fix Created 4 years 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: third_party/WebKit/LayoutTests/http/tests/inspector/network-test.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/network-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector/network-test.js
index 470d3d7a49d77328ae916923e13293be9f64bfc7..d36ed1b593594b60da396c8b1ba2d113398062ff 100644
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/network-test.js
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/network-test.js
@@ -48,6 +48,18 @@ function makeFetch(url, requestInitializer)
return fetch(url, requestInitializer).catch(e => e);
}
+function onCacheStorageError(e)
+{
+ console.error("CacheStorage error: " + e);
+}
+
+function clearAllCaches()
+{
+ return caches.keys()
+ .then((keys) => Promise.all(keys.map((key) => caches.delete(key))))
allada 2016/12/15 19:01:49 I see you pulled this from http/tests/inspector/ca
+ .catch(onCacheStorageError.bind(this));
+}
+
var initialize_NetworkTest = function() {
InspectorTest.preloadPanel("network");
@@ -120,6 +132,11 @@ InspectorTest.makeFetch = function(url, requestInitializer, callback)
InspectorTest.callFunctionInPageAsync("makeFetch", [url, requestInitializer]).then(callback);
}
+InspectorTest.clearAllCaches = function()
+{
+ return InspectorTest.evaluateInPage("clearAllCaches");
+}
+
InspectorTest.HARPropertyFormatters = {
bodySize: "formatAsTypeName",
compression: "formatAsTypeName",

Powered by Google App Engine
This is Rietveld 408576698