| Index: third_party/WebKit/LayoutTests/http/tests/inspector-unit/inspector-unit-test.js
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector-unit/inspector-unit-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector-unit/inspector-unit-test.js
|
| deleted file mode 100644
|
| index bb1ca19ec5297f1f2e8ea5a0e52e668b39523f21..0000000000000000000000000000000000000000
|
| --- a/third_party/WebKit/LayoutTests/http/tests/inspector-unit/inspector-unit-test.js
|
| +++ /dev/null
|
| @@ -1,157 +0,0 @@
|
| -var UnitTest = {};
|
| -(function()
|
| -{
|
| - var lazyModules = [];
|
| - var oldLoadResourcePromise = Runtime.loadResourcePromise;
|
| - Runtime.loadResourcePromise = function(url)
|
| - {
|
| - if (url.startsWith("/"))
|
| - return oldLoadResourcePromise(url);
|
| -
|
| - if (!url.startsWith("http://"))
|
| - return oldLoadResourcePromise("/inspector-debug/" + url);
|
| -
|
| - var parsedURL = new URL(url, location.href);
|
| - var parsedLocation = new URL(location.href);
|
| -
|
| - // hosted devtools is confused.
|
| - parsedURL.pathname = parsedURL.pathname.replace('/inspector-unit/', '/inspector-debug/');
|
| - return oldLoadResourcePromise(parsedURL.toString());
|
| - }
|
| -
|
| - if (window.testRunner) {
|
| - testRunner.dumpAsText();
|
| - testRunner.waitUntilDone();
|
| - }
|
| -
|
| - var results = [];
|
| - UnitTest.completeTest = function()
|
| - {
|
| - if (!window.testRunner) {
|
| - console.log("Test Done");
|
| - return;
|
| - }
|
| -
|
| - document.documentElement.childNodes.forEach(x => x.remove());
|
| - var outputElement = document.createElement("div");
|
| - // Support for svg - add to document, not body, check for style.
|
| - if (outputElement.style) {
|
| - outputElement.style.whiteSpace = "pre";
|
| - outputElement.style.height = "10px";
|
| - outputElement.style.overflow = "hidden";
|
| - }
|
| - document.documentElement.appendChild(outputElement);
|
| - for (var i = 0; i < results.length; i++) {
|
| - outputElement.appendChild(document.createTextNode(results[i]));
|
| - outputElement.appendChild(document.createElement("br"));
|
| - }
|
| - results = [];
|
| - testRunner.notifyDone();
|
| - };
|
| -
|
| - UnitTest.addResult = function(text)
|
| - {
|
| - if (window.testRunner)
|
| - results.push(String(text));
|
| - else
|
| - console.log(text);
|
| - };
|
| -
|
| - UnitTest.runTests = function(tests)
|
| - {
|
| - nextTest();
|
| -
|
| - function nextTest()
|
| - {
|
| - var test = tests.shift();
|
| - if (!test) {
|
| - UnitTest.completeTest();
|
| - return;
|
| - }
|
| - UnitTest.addResult("\ntest: " + test.name);
|
| - var testPromise = test();
|
| - if (!(testPromise instanceof Promise))
|
| - testPromise = Promise.resolve();
|
| - testPromise.then(nextTest);
|
| - }
|
| - };
|
| -
|
| - UnitTest.addSniffer = function(receiver, methodName)
|
| - {
|
| - return new Promise(function(resolve, reject)
|
| - {
|
| - var original = receiver[methodName];
|
| - if (typeof original !== "function") {
|
| - reject("Cannot find method to override: " + methodName);
|
| - return;
|
| - }
|
| -
|
| - receiver[methodName] = function(var_args)
|
| - {
|
| - try {
|
| - var result = original.apply(this, arguments);
|
| - } finally {
|
| - receiver[methodName] = original;
|
| - }
|
| - // In case of exception the override won't be called.
|
| - try {
|
| - Array.prototype.push.call(arguments, result);
|
| - resolve.apply(this, arguments);
|
| - } catch (e) {
|
| - reject("Exception in overriden method '" + methodName + "': " + e);
|
| - UnitTest.completeTest();
|
| - }
|
| - return result;
|
| - };
|
| - });
|
| - };
|
| -
|
| - UnitTest.addDependency = function(lazyModule)
|
| - {
|
| - lazyModules.push(lazyModule);
|
| - };
|
| -
|
| - UnitTest.createKeyEvent = function(key, ctrlKey, altKey, shiftKey, metaKey)
|
| - {
|
| - return new KeyboardEvent("keydown", { key: key, bubbles: true, cancelable: true, ctrlKey: ctrlKey, altKey: altKey, shiftKey: shiftKey, metaKey: metaKey });
|
| - };
|
| -
|
| - function completeTestOnError(message, source, lineno, colno, error)
|
| - {
|
| - UnitTest.addResult("TEST ENDED IN ERROR: " + error.stack);
|
| - UnitTest.completeTest();
|
| - }
|
| - window.onerror = completeTestOnError;
|
| -
|
| - Runtime.startApplication("/inspector-unit/inspector-unit-test").then(runTest);
|
| -
|
| - function runTest()
|
| - {
|
| - var description = document.body.textContent.trim();
|
| - if (description)
|
| - UnitTest.addResult(description);
|
| -
|
| - Common.settings = new Common.Settings(new Common.SettingsStorage(
|
| - {},
|
| - InspectorFrontendHost.setPreference,
|
| - InspectorFrontendHost.removePreference,
|
| - InspectorFrontendHost.clearPreferences));
|
| -
|
| -
|
| - UI.viewManager = new UI.ViewManager();
|
| - UI.initializeUIUtils(document, Common.settings.createSetting("uiTheme", "default"));
|
| - UI.installComponentRootStyles(document.body);
|
| -
|
| - UI.zoomManager = new UI.ZoomManager(window, InspectorFrontendHost);
|
| - UI.inspectorView = UI.InspectorView.instance();
|
| - UI.ContextMenu.initialize();
|
| - UI.ContextMenu.installHandler(document);
|
| - UI.Tooltip.installHandler(document);
|
| -
|
| - var rootView = new UI.RootView();
|
| - UI.inspectorView.show(rootView.element);
|
| - rootView.attachToDocument(document);
|
| - Promise.all(lazyModules.map(lazyModule => window.runtime.loadModulePromise(lazyModule))).then(test);
|
| - }
|
| -})();
|
| -
|
|
|