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

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

Issue 1259393002: DevTools: add support for logging fetch requests when XHR logging is enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fixed the test Created 5 years, 5 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: LayoutTests/http/tests/inspector/network-test.js
diff --git a/LayoutTests/http/tests/inspector/network-test.js b/LayoutTests/http/tests/inspector/network-test.js
index 8b33d0a423de5ff0067d4ed6eda43067e1bc4af0..3780e5d34522ad7ca658499b9c41c3dc99f86207 100644
--- a/LayoutTests/http/tests/inspector/network-test.js
+++ b/LayoutTests/http/tests/inspector/network-test.js
@@ -6,6 +6,48 @@ function xhrLoadedCallback()
console.log("XHR loaded: " + (++lastXHRIndex));
}
+function makeSimpleXHR(method, url, async, callback)
+{
+ makeSimpleXHRWithPayload(method, url, async, null, callback);
+}
+
+function makeSimpleXHRWithPayload(method, url, async, payload, callback)
+{
+ makeXHR(method, url, async, undefined, undefined, [], false, payload, callback)
+}
+
+function makeXHR(method, url, async, user, password, headers, withCredentials, payload, type, callback)
+{
+ var xhr = new XMLHttpRequest();
+ if (type == undefined)
+ xhr.responseType = "";
+ else
+ xhr.responseType = type;
+ xhr.onreadystatechange = function()
+ {
+ if (xhr.readyState === XMLHttpRequest.DONE) {
+ if (typeof(callback) === "function")
+ callback();
+ }
+ }
+ xhr.open(method, url, async, user, password);
+ xhr.withCredentials = withCredentials;
+ for (var i = 0; i < headers.length; ++i)
+ xhr.setRequestHeader(headers[i][0], headers[i][1]);
+ xhr.send(payload);
+}
+
+function makeXHRForJSONArguments(jsonArgs)
+{
+ var args = JSON.parse(jsonArgs);
+ makeXHR(args.method, args.url, args.async, args.user, args.password, args.headers || [], args.withCredentials, args.payload, args.type, xhrLoadedCallback);
+}
+
+function makeFetch(url, requestInitializer, callback)
+{
+ fetch(url, requestInitializer).then(callback).catch(callback);
+}
+
var initialize_NetworkTest = function() {
InspectorTest.preloadPanel("network");
@@ -65,6 +107,11 @@ InspectorTest.makeXHR = function(method, url, async, user, password, headers, wi
InspectorTest.evaluateInPage("makeXHRForJSONArguments(\"" + jsonArgs + "\")");
}
+InspectorTest.makeFetch = function(url, requestInitializer, callback)
+{
+ InspectorTest.invokePageFunctionAsync("makeFetch", url, requestInitializer, callback);
+}
+
InspectorTest.HARPropertyFormatters = {
bodySize: "formatAsTypeName",
compression: "formatAsTypeName",
@@ -89,40 +136,3 @@ InspectorTest.HARPropertyFormattersWithSize = JSON.parse(JSON.stringify(Inspecto
InspectorTest.HARPropertyFormattersWithSize.size = "formatAsTypeName";
};
-
-function makeSimpleXHR(method, url, async, callback)
-{
- makeSimpleXHRWithPayload(method, url, async, null, callback);
-}
-
-function makeSimpleXHRWithPayload(method, url, async, payload, callback)
-{
- makeXHR(method, url, async, undefined, undefined, [], false, payload, callback)
-}
-
-function makeXHR(method, url, async, user, password, headers, withCredentials, payload, type, callback)
-{
- var xhr = new XMLHttpRequest();
- if (type == undefined)
- xhr.responseType = "";
- else
- xhr.responseType = type;
- xhr.onreadystatechange = function()
- {
- if (xhr.readyState === XMLHttpRequest.DONE) {
- if (typeof(callback) === "function")
- callback();
- }
- }
- xhr.open(method, url, async, user, password);
- xhr.withCredentials = withCredentials;
- for (var i = 0; i < headers.length; ++i)
- xhr.setRequestHeader(headers[i][0], headers[i][1]);
- xhr.send(payload);
-}
-
-function makeXHRForJSONArguments(jsonArgs)
-{
- var args = JSON.parse(jsonArgs);
- makeXHR(args.method, args.url, args.async, args.user, args.password, args.headers || [], args.withCredentials, args.payload, args.type, xhrLoadedCallback);
-}
« no previous file with comments | « LayoutTests/http/tests/inspector/inspector-test.js ('k') | LayoutTests/http/tests/inspector/network/network-eventsource.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698