Skip to content

Commit

Permalink
[DevTools] Replace Common.settingForTest( global with import
Browse files Browse the repository at this point in the history
Some tests require a new baseline as they reference line
numbers of the test file itself and those moved due to the
import.

R=mathias@chromium.org

Bug: chromium:1442410
Change-Id: I3c5f1ed483a22a1cfdc454e43f8f35143b08b0b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4801339
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Auto-Submit: Simon Zünd <szuend@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1187083}
  • Loading branch information
szuend authored and Chromium LUCI CQ committed Aug 23, 2023
1 parent 3c4f3cd commit bcff654
Show file tree
Hide file tree
Showing 55 changed files with 280 additions and 217 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {TestRunner} from 'test_runner';
import {ConsoleTestRunner} from 'console_test_runner';

import * as SDK from 'devtools/core/sdk/sdk.js';
import * as Common from 'devtools/core/common/common.js';

(async function() {
await TestRunner.loadLegacyModule('console');
Expand All @@ -16,7 +17,7 @@ import * as SDK from 'devtools/core/sdk/sdk.js';

TestRunner.addSniffer(Bindings.IgnoreListManager.prototype, 'patternChangeFinishedForTests', step1);
var frameworkRegexString = '.*';
Common.settingForTest('skipStackFramesPattern').set('.*');
Common.Settings.settingForTest('skipStackFramesPattern').set('.*');

async function step1() {
TestRunner.addResult('Evaluating script with source map');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {TestRunner} from 'test_runner';
import {ConsoleTestRunner} from 'console_test_runner';
import {NetworkTestRunner} from 'network_test_runner';

import * as Common from 'devtools/core/common/common.js';

(async function() {
TestRunner.addResult(
`Tests that XMLHttpRequest Logging works when Enabled and doesn't show logs when Disabled for asynchronous XHRs.\n`);
Expand All @@ -18,7 +20,7 @@ import {NetworkTestRunner} from 'network_test_runner';
}

function step1() {
Common.settingForTest('monitoringXHREnabled').set(true);
Common.Settings.settingForTest('monitoringXHREnabled').set(true);
makeRequest(() => {
TestRunner.deprecatedRunAfterPendingDispatches(async () => {
TestRunner.addResult('XHR with logging enabled: ');
Expand All @@ -32,7 +34,7 @@ import {NetworkTestRunner} from 'network_test_runner';
}

function step2() {
Common.settingForTest('monitoringXHREnabled').set(false);
Common.Settings.settingForTest('monitoringXHREnabled').set(false);
makeRequest(() => {
TestRunner.deprecatedRunAfterPendingDispatches(async () => {
TestRunner.addResult('XHR with logging disabled: ');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,83 +5,83 @@ VM:37 XHR finished loading: GET "http://127.0.0.1:8000/devtools/resources/xhr-ex
makeXHR @ VM:37
makeSimpleXHRWithPayload @ VM:13
makeSimpleXHR @ VM:9
requestHelper @ console-xhr-logging.js:17
(anonymous) @ console-xhr-logging.js:23
console-xhr-logging.js:16 sending a GET request to resources/xhr-exists.html
requestHelper @ console-xhr-logging.js:19
(anonymous) @ console-xhr-logging.js:25
console-xhr-logging.js:18 sending a GET request to resources/xhr-exists.html

Message count: 3
VM:37 GET http://127.0.0.1:8000/devtools/resources/xhr-does-not-exist.html 404 (Not Found)
makeXHR @ VM:37
makeSimpleXHRWithPayload @ VM:13
makeSimpleXHR @ VM:9
requestHelper @ console-xhr-logging.js:17
(anonymous) @ console-xhr-logging.js:29
requestHelper @ console-xhr-logging.js:19
(anonymous) @ console-xhr-logging.js:31
VM:37 XHR failed loading: GET "http://127.0.0.1:8000/devtools/resources/xhr-does-not-exist.html".
makeXHR @ VM:37
makeSimpleXHRWithPayload @ VM:13
makeSimpleXHR @ VM:9
requestHelper @ console-xhr-logging.js:17
(anonymous) @ console-xhr-logging.js:29
console-xhr-logging.js:16 sending a GET request to resources/xhr-does-not-exist.html
requestHelper @ console-xhr-logging.js:19
(anonymous) @ console-xhr-logging.js:31
console-xhr-logging.js:18 sending a GET request to resources/xhr-does-not-exist.html

Message count: 2
VM:37 XHR finished loading: POST "http://127.0.0.1:8000/devtools/resources/post-target.cgi".
makeXHR @ VM:37
makeSimpleXHRWithPayload @ VM:13
makeSimpleXHR @ VM:9
requestHelper @ console-xhr-logging.js:17
requestHelper @ console-xhr-logging.js:19
(anonymous) @ VM:1
console-xhr-logging.js:16 sending a POST request to resources/post-target.cgi
console-xhr-logging.js:18 sending a POST request to resources/post-target.cgi

Message count: 4
VM:37 Access to XMLHttpRequest at 'http://localhost:8000/devtools/resources/cors-disabled/xhr-exists.html' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
makeXHR @ VM:37
makeSimpleXHRWithPayload @ VM:13
makeSimpleXHR @ VM:9
requestHelper @ console-xhr-logging.js:17
requestHelper @ console-xhr-logging.js:19
(anonymous) @ VM:1
VM:37 GET http://localhost:8000/devtools/resources/cors-disabled/xhr-exists.html net::ERR_FAILED 200 (OK)
makeXHR @ VM:37
makeSimpleXHRWithPayload @ VM:13
makeSimpleXHR @ VM:9
requestHelper @ console-xhr-logging.js:17
requestHelper @ console-xhr-logging.js:19
(anonymous) @ VM:1
VM:37 XHR failed loading: GET "http://localhost:8000/devtools/resources/cors-disabled/xhr-exists.html".
makeXHR @ VM:37
makeSimpleXHRWithPayload @ VM:13
makeSimpleXHR @ VM:9
requestHelper @ console-xhr-logging.js:17
requestHelper @ console-xhr-logging.js:19
(anonymous) @ VM:1
console-xhr-logging.js:16 sending a GET request to http://localhost:8000/devtools/resources/cors-disabled/xhr-exists.html
console-xhr-logging.js:18 sending a GET request to http://localhost:8000/devtools/resources/cors-disabled/xhr-exists.html

Message count: 1
console-xhr-logging.js:16 sending a GET request to resources/xhr-exists.html
console-xhr-logging.js:18 sending a GET request to resources/xhr-exists.html

Message count: 2
VM:37 GET http://127.0.0.1:8000/devtools/resources/xhr-does-not-exist.html 404 (Not Found)
makeXHR @ VM:37
makeSimpleXHRWithPayload @ VM:13
makeSimpleXHR @ VM:9
requestHelper @ console-xhr-logging.js:17
requestHelper @ console-xhr-logging.js:19
(anonymous) @ VM:1
console-xhr-logging.js:16 sending a GET request to resources/xhr-does-not-exist.html
console-xhr-logging.js:18 sending a GET request to resources/xhr-does-not-exist.html

Message count: 1
console-xhr-logging.js:16 sending a POST request to resources/post-target.cgi
console-xhr-logging.js:18 sending a POST request to resources/post-target.cgi

Message count: 3
VM:37 Access to XMLHttpRequest at 'http://localhost:8000/devtools/resources/cors-disabled/xhr-exists.html' from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
makeXHR @ VM:37
makeSimpleXHRWithPayload @ VM:13
makeSimpleXHR @ VM:9
requestHelper @ console-xhr-logging.js:17
requestHelper @ console-xhr-logging.js:19
(anonymous) @ VM:1
VM:37 GET http://localhost:8000/devtools/resources/cors-disabled/xhr-exists.html net::ERR_FAILED 200 (OK)
makeXHR @ VM:37
makeSimpleXHRWithPayload @ VM:13
makeSimpleXHR @ VM:9
requestHelper @ console-xhr-logging.js:17
requestHelper @ console-xhr-logging.js:19
(anonymous) @ VM:1
console-xhr-logging.js:16 sending a GET request to http://localhost:8000/devtools/resources/cors-disabled/xhr-exists.html
console-xhr-logging.js:18 sending a GET request to http://localhost:8000/devtools/resources/cors-disabled/xhr-exists.html


Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {TestRunner} from 'test_runner';
import {ConsoleTestRunner} from 'console_test_runner';
import {NetworkTestRunner} from 'network_test_runner';

import * as Common from 'devtools/core/common/common.js';

(async function() {
TestRunner.addResult(`Tests that XMLHttpRequest Logging works when Enabled and doesn't show logs when Disabled.\n`);
await TestRunner.loadLegacyModule('console');
Expand All @@ -17,8 +19,8 @@ import {NetworkTestRunner} from 'network_test_runner';
makeSimpleXHR(method, url, false);
}
`);
Common.settingForTest('consoleGroupSimilar').set(false);
Common.settingForTest('monitoringXHREnabled').set(true);
Common.Settings.settingForTest('consoleGroupSimilar').set(false);
Common.Settings.settingForTest('monitoringXHREnabled').set(true);

TestRunner.evaluateInPage(`requestHelper('GET', 'resources/xhr-exists.html')`);
await ConsoleTestRunner.waitForConsoleMessagesPromise(2);
Expand All @@ -44,7 +46,7 @@ import {NetworkTestRunner} from 'network_test_runner';
SDK.ConsoleModel.requestClearMessages();
TestRunner.addResult('');

Common.settingForTest('monitoringXHREnabled').set(false);
Common.Settings.settingForTest('monitoringXHREnabled').set(false);

TestRunner.evaluateInPageAsync(`requestHelper('GET', 'resources/xhr-exists.html')`);
await ConsoleTestRunner.waitForConsoleMessagesPromise(1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Test that console.log() would linkify its location in respect with ignore-listing.

foo.js:16
boo.js:23
console-linkify-message-location.js:28
foo.js:16
foo.js:18
boo.js:25
console-linkify-message-location.js:30
foo.js:18

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import {TestRunner} from 'test_runner';
import {ConsoleTestRunner} from 'console_test_runner';

import * as Common from 'devtools/core/common/common.js';

(async function() {
TestRunner.addResult(`Test that console.log() would linkify its location in respect with ignore-listing.\n`);

Expand Down Expand Up @@ -32,21 +34,21 @@ import {ConsoleTestRunner} from 'console_test_runner';

TestRunner.addSniffer(Bindings.IgnoreListManager.prototype, 'patternChangeFinishedForTests', step2);
var frameworkRegexString = 'foo\\.js';
Common.settingForTest('skipStackFramesPattern').set(frameworkRegexString);
Common.Settings.settingForTest('skipStackFramesPattern').set(frameworkRegexString);
}

async function step2() {
await dumpConsoleMessageURLs();
TestRunner.addSniffer(Bindings.IgnoreListManager.prototype, 'patternChangeFinishedForTests', step3);
var frameworkRegexString = 'foo\\.js|boo\\.js';
Common.settingForTest('skipStackFramesPattern').set(frameworkRegexString);
Common.Settings.settingForTest('skipStackFramesPattern').set(frameworkRegexString);
}

async function step3() {
await dumpConsoleMessageURLs();
TestRunner.addSniffer(Bindings.IgnoreListManager.prototype, 'patternChangeFinishedForTests', step4);
var frameworkRegexString = '';
Common.settingForTest('skipStackFramesPattern').set(frameworkRegexString);
Common.Settings.settingForTest('skipStackFramesPattern').set(frameworkRegexString);
}

async function step4() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Tests console.log() anchor location when the skip-stack-frames feature is enabled.

console-log-wrapped-in-framework.js:16 direct console.log()
console-log-wrapped-in-framework.js:17 framework log
console-log-wrapped-in-framework.js:18 direct console.log()
console-log-wrapped-in-framework.js:19 framework log

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import {TestRunner} from 'test_runner';
import {ConsoleTestRunner} from 'console_test_runner';

import * as Common from 'devtools/core/common/common.js';

(async function() {
TestRunner.addResult(`Tests console.log() anchor location when the skip-stack-frames feature is enabled.\n`);
await TestRunner.loadLegacyModule('console');
Expand All @@ -19,7 +21,7 @@ import {ConsoleTestRunner} from 'console_test_runner';
`);

var frameworkRegexString = '/framework\\.js$';
Common.settingForTest('skipStackFramesPattern').set(frameworkRegexString);
Common.Settings.settingForTest('skipStackFramesPattern').set(frameworkRegexString);

TestRunner.evaluateInPage('runLogs()');
TestRunner.deprecatedRunAfterPendingDispatches(callback);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
import {TestRunner} from 'test_runner';
import {ConsoleTestRunner} from 'console_test_runner';

import * as Common from 'devtools/core/common/common.js';

(async function() {
TestRunner.addResult(`Tests that the console can preserve log messages across cross-process navigations.`);
await TestRunner.loadLegacyModule('console');
await TestRunner.showPanel('console');
await TestRunner.navigatePromise('http://devtools.oopif.test:8000/devtools/console/resources/log-message.html')
Common.settingForTest('preserveConsoleLog').set(true);
Common.Settings.settingForTest('preserveConsoleLog').set(true);
await TestRunner.evaluateInPage(`logMessage('before navigation')`);
await TestRunner.navigatePromise('http://127.0.0.1:8000/devtools/console/resources/log-message.html')
await TestRunner.evaluateInPage(`logMessage('after navigation')`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {TestRunner} from 'test_runner';
import {ConsoleTestRunner} from 'console_test_runner';

import * as SDK from 'devtools/core/sdk/sdk.js';
import * as Common from 'devtools/core/common/common.js';

(async function() {
TestRunner.addResult(`Tests that the console can preserve log messages across navigations. Bug 53359\n`);
Expand All @@ -16,10 +17,10 @@ import * as SDK from 'devtools/core/sdk/sdk.js';
consoleModel.addMessage(new SDK.ConsoleModel.ConsoleMessage(
TestRunner.runtimeModel, Protocol.Log.LogEntrySource.Other,
Protocol.Log.LogEntryLevel.Info, 'PASS'));
Common.settingForTest('preserveConsoleLog').set(true);
Common.Settings.settingForTest('preserveConsoleLog').set(true);
TestRunner.reloadPage(async function() {
await ConsoleTestRunner.dumpConsoleMessages();
Common.settingForTest('preserveConsoleLog').set(false);
Common.Settings.settingForTest('preserveConsoleLog').set(false);
TestRunner.completeTest();
});
})();
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {TestRunner} from 'test_runner';
import {ConsoleTestRunner} from 'console_test_runner';

import * as SDK from 'devtools/core/sdk/sdk.js';
import * as Common from 'devtools/core/common/common.js';

(async function() {
TestRunner.addResult(`Tests the console timestamp setting.\n`);
Expand All @@ -18,7 +19,7 @@ import * as SDK from 'devtools/core/sdk/sdk.js';
var tzOffset = new Date(baseDate).getTimezoneOffset() * 60 * 1000;
var baseTimestamp = 1400000000000 + tzOffset;

Common.settingForTest('consoleGroupSimilar').set(false);
Common.Settings.settingForTest('consoleGroupSimilar').set(false);

function addMessageWithFixedTimestamp(messageText, timestamp, type) {
var message = new SDK.ConsoleModel.ConsoleMessage(
Expand Down Expand Up @@ -54,14 +55,14 @@ import * as SDK from 'devtools/core/sdk/sdk.js';
await ConsoleTestRunner.dumpConsoleMessages();

TestRunner.addResult('Console messages with timestamps enabled:');
Common.settingForTest('consoleTimestampsEnabled').set(true);
Common.Settings.settingForTest('consoleTimestampsEnabled').set(true);

addMessageWithFixedTimestamp('<After>', baseTimestamp + 1000);
addMessageWithFixedTimestamp('<After>', baseTimestamp + 1000);
addMessageWithFixedTimestamp('<After>', baseTimestamp + 1456);

Common.settingForTest('consoleTimestampsEnabled').set(false);
Common.settingForTest('consoleTimestampsEnabled').set(true);
Common.Settings.settingForTest('consoleTimestampsEnabled').set(false);
Common.Settings.settingForTest('consoleTimestampsEnabled').set(true);

await ConsoleTestRunner.dumpConsoleMessages();
TestRunner.completeTest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {TestRunner} from 'test_runner';
import {ConsoleTestRunner} from 'console_test_runner';
import {ElementsTestRunner} from 'elements_test_runner';

import * as Common from 'devtools/core/common/common.js';

(async function() {
TestRunner.addResult(`Tests that $0 works with shadow dom.\n`);
await TestRunner.loadLegacyModule('console');
Expand All @@ -20,7 +22,7 @@ import {ElementsTestRunner} from 'elements_test_runner';
sr.innerHTML = "<div><div><div id='shadow'><input id='user-agent-host' type='range'></div></div></div>";
`);

Common.settingForTest('showUAShadowDOM').set(true);
Common.Settings.settingForTest('showUAShadowDOM').set(true);
ElementsTestRunner.selectNodeWithId('shadow', step1);

function step1() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import {TestRunner} from 'test_runner';
import {ElementsTestRunner} from 'elements_test_runner';

import * as Common from 'devtools/core/common/common.js';

(async function() {
TestRunner.addResult(`Verifies show/hide HTML comments setting.\n`);
await TestRunner.loadLegacyModule('elements');
Expand Down Expand Up @@ -36,7 +38,7 @@ import {ElementsTestRunner} from 'elements_test_runner';
function onNodeSelected() {
TestRunner.addResult('HTML comments shown:');
ElementsTestRunner.dumpElementsTree();
Common.settingForTest('showHTMLComments').set(false);
Common.Settings.settingForTest('showHTMLComments').set(false);
TestRunner.addResult('\nHTML comments hidden:');
ElementsTestRunner.dumpElementsTree();
TestRunner.completeTest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tests framework event listeners output in the Elements sidebar panel.

======== click ========
== Framework
[expanded] button#inspectedNodeRemoveevent-listener-sidebar-custom-framework.js:34
[expanded] button#inspectedNodeRemoveevent-listener-sidebar-custom-framework.js:36
useCapture: false
passive: false
once: false
Expand All @@ -19,7 +19,7 @@ Tests framework event listeners output in the Elements sidebar panel.

======== customFirst ========
== FrameworkUser
[expanded] button#inspectedNodeevent-listener-sidebar-custom-framework.js:24
[expanded] button#inspectedNodeevent-listener-sidebar-custom-framework.js:26
useCapture: true
passive: false
once: false
Expand All @@ -30,7 +30,7 @@ Tests framework event listeners output in the Elements sidebar panel.

======== customSecond ========
== FrameworkUser
[expanded] button#inspectedNodeevent-listener-sidebar-custom-framework.js:29
[expanded] button#inspectedNodeevent-listener-sidebar-custom-framework.js:31
useCapture: false
passive: false
once: false
Expand All @@ -42,7 +42,7 @@ Tests framework event listeners output in the Elements sidebar panel.

======== click ========
== Raw
[expanded] button#inspectedNodeRemoveevent-listener-sidebar-custom-framework.js:34
[expanded] button#inspectedNodeRemoveevent-listener-sidebar-custom-framework.js:36
useCapture: false
passive: false
once: false
Expand Down

0 comments on commit bcff654

Please sign in to comment.