Commit 05b4333d authored by Dmitry Gozman's avatar Dmitry Gozman Committed by Commit Bot

Unflake console-xhr-logging.js

Bug: none
Change-Id: I2d5b7c11a77d990e9b6c243a9fa335f970f7358f
Reviewed-on: https://chromium-review.googlesource.com/898073Reviewed-by: default avatarAleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Commit-Queue: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533832}
parent b38855a8
Tests that XMLHttpRequest Logging works when Enabled and doesn't show logs when Disabled. Tests that XMLHttpRequest Logging works when Enabled and doesn't show logs when Disabled.
Message count: 3
console-xhr-logging.js:13 sending a GET request to resources/xhr-exists.html console-xhr-logging.js:13 sending a GET request to resources/xhr-exists.html
VM:31 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/. VM:31 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
makeXHR @ VM:31 makeXHR @ VM:31
makeSimpleXHRWithPayload @ VM:13 makeSimpleXHRWithPayload @ VM:13
makeSimpleXHR @ VM:9 makeSimpleXHR @ VM:9
requestHelper @ console-xhr-logging.js:14 requestHelper @ console-xhr-logging.js:14
(anonymous) @ console-xhr-logging.js:19 (anonymous) @ console-xhr-logging.js:20
VM:37 XHR finished loading: GET "http://127.0.0.1:8000/devtools/resources/xhr-exists.html". VM:37 XHR finished loading: GET "http://127.0.0.1:8000/devtools/resources/xhr-exists.html".
makeXHR @ VM:37 makeXHR @ VM:37
makeSimpleXHRWithPayload @ VM:13 makeSimpleXHRWithPayload @ VM:13
makeSimpleXHR @ VM:9 makeSimpleXHR @ VM:9
requestHelper @ console-xhr-logging.js:14 requestHelper @ console-xhr-logging.js:14
(anonymous) @ console-xhr-logging.js:19 (anonymous) @ console-xhr-logging.js:20
Message count: 3
console-xhr-logging.js:13 sending a GET request to resources/xhr-does-not-exist.html console-xhr-logging.js:13 sending a GET request to resources/xhr-does-not-exist.html
VM:37 GET http://127.0.0.1:8000/devtools/resources/xhr-does-not-exist.html 404 (Not Found) VM:37 GET http://127.0.0.1:8000/devtools/resources/xhr-does-not-exist.html 404 (Not Found)
makeXHR @ VM:37 makeXHR @ VM:37
makeSimpleXHRWithPayload @ VM:13 makeSimpleXHRWithPayload @ VM:13
makeSimpleXHR @ VM:9 makeSimpleXHR @ VM:9
requestHelper @ console-xhr-logging.js:14 requestHelper @ console-xhr-logging.js:14
(anonymous) @ console-xhr-logging.js:20 (anonymous) @ console-xhr-logging.js:26
VM:37 XHR failed loading: GET "http://127.0.0.1:8000/devtools/resources/xhr-does-not-exist.html". VM:37 XHR failed loading: GET "http://127.0.0.1:8000/devtools/resources/xhr-does-not-exist.html".
makeXHR @ VM:37 makeXHR @ VM:37
makeSimpleXHRWithPayload @ VM:13 makeSimpleXHRWithPayload @ VM:13
makeSimpleXHR @ VM:9 makeSimpleXHR @ VM:9
requestHelper @ console-xhr-logging.js:14 requestHelper @ console-xhr-logging.js:14
(anonymous) @ console-xhr-logging.js:20 (anonymous) @ console-xhr-logging.js:26
Message count: 2
console-xhr-logging.js:13 sending a POST request to resources/post-target.cgi console-xhr-logging.js:13 sending a POST request to resources/post-target.cgi
VM:37 XHR finished loading: POST "http://127.0.0.1:8000/devtools/resources/post-target.cgi". VM:37 XHR finished loading: POST "http://127.0.0.1:8000/devtools/resources/post-target.cgi".
makeXHR @ VM:37 makeXHR @ VM:37
makeSimpleXHRWithPayload @ VM:13 makeSimpleXHRWithPayload @ VM:13
makeSimpleXHR @ VM:9 makeSimpleXHR @ VM:9
requestHelper @ console-xhr-logging.js:14 requestHelper @ console-xhr-logging.js:14
(anonymous) @ console-xhr-logging.js:21 (anonymous) @ VM:1
Message count: 3
console-xhr-logging.js:13 sending a GET request to http://localhost:8000/devtools/resources/xhr-exists.html console-xhr-logging.js:13 sending a GET request to http://localhost:8000/devtools/resources/xhr-exists.html
VM:37 Failed to load http://localhost:8000/devtools/resources/xhr-exists.html: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. VM:37 Failed to load http://localhost:8000/devtools/resources/xhr-exists.html: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access.
makeXHR @ VM:37 makeXHR @ VM:37
makeSimpleXHRWithPayload @ VM:13 makeSimpleXHRWithPayload @ VM:13
makeSimpleXHR @ VM:9 makeSimpleXHR @ VM:9
requestHelper @ console-xhr-logging.js:14 requestHelper @ console-xhr-logging.js:14
(anonymous) @ console-xhr-logging.js:22 (anonymous) @ VM:1
VM:37 XHR finished loading: GET "http://localhost:8000/devtools/resources/xhr-exists.html". VM:37 XHR finished loading: GET "http://localhost:8000/devtools/resources/xhr-exists.html".
makeXHR @ VM:37 makeXHR @ VM:37
makeSimpleXHRWithPayload @ VM:13 makeSimpleXHRWithPayload @ VM:13
makeSimpleXHR @ VM:9 makeSimpleXHR @ VM:9
requestHelper @ console-xhr-logging.js:14 requestHelper @ console-xhr-logging.js:14
(anonymous) @ console-xhr-logging.js:22 (anonymous) @ VM:1
Message count: 1
console-xhr-logging.js:13 sending a GET request to resources/xhr-exists.html console-xhr-logging.js:13 sending a GET request to resources/xhr-exists.html
Message count: 2
console-xhr-logging.js:13 sending a GET request to resources/xhr-does-not-exist.html console-xhr-logging.js:13 sending a GET request to resources/xhr-does-not-exist.html
VM:37 GET http://127.0.0.1:8000/devtools/resources/xhr-does-not-exist.html 404 (Not Found) VM:37 GET http://127.0.0.1:8000/devtools/resources/xhr-does-not-exist.html 404 (Not Found)
makeXHR @ VM:37 makeXHR @ VM:37
makeSimpleXHRWithPayload @ VM:13 makeSimpleXHRWithPayload @ VM:13
makeSimpleXHR @ VM:9 makeSimpleXHR @ VM:9
requestHelper @ console-xhr-logging.js:14 requestHelper @ console-xhr-logging.js:14
(anonymous) @ console-xhr-logging.js:26 (anonymous) @ VM:1
Message count: 1
console-xhr-logging.js:13 sending a POST request to resources/post-target.cgi console-xhr-logging.js:13 sending a POST request to resources/post-target.cgi
Message count: 2
console-xhr-logging.js:13 sending a GET request to http://localhost:8000/devtools/resources/xhr-exists.html console-xhr-logging.js:13 sending a GET request to http://localhost:8000/devtools/resources/xhr-exists.html
VM:37 Failed to load http://localhost:8000/devtools/resources/xhr-exists.html: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. VM:37 Failed to load http://localhost:8000/devtools/resources/xhr-exists.html: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access.
makeXHR @ VM:37 makeXHR @ VM:37
makeSimpleXHRWithPayload @ VM:13 makeSimpleXHRWithPayload @ VM:13
makeSimpleXHR @ VM:9 makeSimpleXHR @ VM:9
requestHelper @ console-xhr-logging.js:14 requestHelper @ console-xhr-logging.js:14
(anonymous) @ console-xhr-logging.js:28 (anonymous) @ VM:1
...@@ -16,17 +16,56 @@ ...@@ -16,17 +16,56 @@
`); `);
Common.settingForTest('consoleGroupSimilar').set(false); Common.settingForTest('consoleGroupSimilar').set(false);
Common.settingForTest('monitoringXHREnabled').set(true); Common.settingForTest('monitoringXHREnabled').set(true);
await TestRunner.evaluateInPagePromise('requestHelper(\'GET\', \'resources/xhr-exists.html\')');
await TestRunner.evaluateInPagePromise('requestHelper(\'GET\', \'resources/xhr-does-not-exist.html\')'); TestRunner.evaluateInPage(`requestHelper('GET', 'resources/xhr-exists.html')`);
await TestRunner.evaluateInPagePromise('requestHelper(\'POST\', \'resources/post-target.cgi\')'); await ConsoleTestRunner.waitForConsoleMessagesPromise(3);
await TestRunner.evaluateInPagePromise( ConsoleTestRunner.dumpConsoleMessages();
'requestHelper(\'GET\', \'http://localhost:8000/devtools/resources/xhr-exists.html\')'); ConsoleModel.consoleModel.requestClearMessages();
TestRunner.addResult('');
TestRunner.evaluateInPage(`requestHelper('GET', 'resources/xhr-does-not-exist.html')`);
await ConsoleTestRunner.waitForConsoleMessagesPromise(3);
ConsoleTestRunner.dumpConsoleMessages();
ConsoleModel.consoleModel.requestClearMessages();
TestRunner.addResult('');
TestRunner.evaluateInPageAsync(`requestHelper('POST', 'resources/post-target.cgi')`);
await ConsoleTestRunner.waitForConsoleMessagesPromise(2);
ConsoleTestRunner.dumpConsoleMessages();
ConsoleModel.consoleModel.requestClearMessages();
TestRunner.addResult('');
TestRunner.evaluateInPageAsync(`requestHelper('GET', 'http://localhost:8000/devtools/resources/xhr-exists.html')`);
await ConsoleTestRunner.waitForConsoleMessagesPromise(3);
ConsoleTestRunner.dumpConsoleMessages();
ConsoleModel.consoleModel.requestClearMessages();
TestRunner.addResult('');
Common.settingForTest('monitoringXHREnabled').set(false); Common.settingForTest('monitoringXHREnabled').set(false);
await TestRunner.evaluateInPagePromise('requestHelper(\'GET\', \'resources/xhr-exists.html\')');
await TestRunner.evaluateInPagePromise('requestHelper(\'GET\', \'resources/xhr-does-not-exist.html\')'); TestRunner.evaluateInPageAsync(`requestHelper('GET', 'resources/xhr-exists.html')`);
await TestRunner.evaluateInPagePromise('requestHelper(\'POST\', \'resources/post-target.cgi\')'); await ConsoleTestRunner.waitForConsoleMessagesPromise(1);
await TestRunner.evaluateInPagePromise( ConsoleTestRunner.dumpConsoleMessages();
'requestHelper(\'GET\', \'http://localhost:8000/devtools/resources/xhr-exists.html\')'); ConsoleModel.consoleModel.requestClearMessages();
TestRunner.addResult('');
TestRunner.evaluateInPageAsync(`requestHelper('GET', 'resources/xhr-does-not-exist.html')`);
await ConsoleTestRunner.waitForConsoleMessagesPromise(2);
ConsoleTestRunner.dumpConsoleMessages();
ConsoleModel.consoleModel.requestClearMessages();
TestRunner.addResult('');
TestRunner.evaluateInPageAsync(`requestHelper('POST', 'resources/post-target.cgi')`);
await ConsoleTestRunner.waitForConsoleMessagesPromise(1);
ConsoleTestRunner.dumpConsoleMessages();
ConsoleModel.consoleModel.requestClearMessages();
TestRunner.addResult('');
TestRunner.evaluateInPageAsync(`requestHelper('GET', 'http://localhost:8000/devtools/resources/xhr-exists.html')`);
await ConsoleTestRunner.waitForConsoleMessagesPromise(2);
ConsoleTestRunner.dumpConsoleMessages();
ConsoleModel.consoleModel.requestClearMessages();
TestRunner.addResult('');
TestRunner.deprecatedRunAfterPendingDispatches(() => { TestRunner.deprecatedRunAfterPendingDispatches(() => {
ConsoleTestRunner.dumpConsoleMessages(); ConsoleTestRunner.dumpConsoleMessages();
......
...@@ -161,7 +161,7 @@ TestRunner.deprecatedInitAsync(` ...@@ -161,7 +161,7 @@ TestRunner.deprecatedInitAsync(`
} }
function makeSimpleXHRWithPayload(method, url, async, payload, callback) { function makeSimpleXHRWithPayload(method, url, async, payload, callback) {
makeXHR(method, url, async, undefined, undefined, [], false, payload, callback); makeXHR(method, url, async, undefined, undefined, [], false, payload, undefined, callback);
} }
function makeXHR(method, url, async, user, password, headers, withCredentials, payload, type, callback) { function makeXHR(method, url, async, user, password, headers, withCredentials, payload, type, callback) {
...@@ -185,7 +185,7 @@ TestRunner.deprecatedInitAsync(` ...@@ -185,7 +185,7 @@ TestRunner.deprecatedInitAsync(`
for (var i = 0; i < headers.length; ++i) for (var i = 0; i < headers.length; ++i)
xhr.setRequestHeader(headers[i][0], headers[i][1]); xhr.setRequestHeader(headers[i][0], headers[i][1]);
xhr.send(payload); try { xhr.send(payload); } catch (e) {}
} }
function makeXHRForJSONArguments(jsonArgs) { function makeXHRForJSONArguments(jsonArgs) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment