diff options
Diffstat (limited to 'WebKit/chromium/src/js/Tests.js')
-rw-r--r-- | WebKit/chromium/src/js/Tests.js | 349 |
1 files changed, 0 insertions, 349 deletions
diff --git a/WebKit/chromium/src/js/Tests.js b/WebKit/chromium/src/js/Tests.js index 764f624..41574b4 100644 --- a/WebKit/chromium/src/js/Tests.js +++ b/WebKit/chromium/src/js/Tests.js @@ -1069,25 +1069,6 @@ TestSuite.prototype._checkSourceFrameWhenLoaded = function(expectations, callbac /** - * Performs sequence of steps. - * @param {Array.<Object|Function>} Array [expectations1,action1,expectations2, - * action2,...,actionN]. - */ -TestSuite.prototype._performSteps = function(actions) -{ - var test = this; - var i = 0; - function doNextAction() { - if (i > 0) - actions[i++](); - if (i < actions.length - 1) - test._waitForScriptPause(actions[i++], doNextAction); - } - doNextAction(); -}; - - -/** * Waits until all the scripts are parsed and asynchronously executes the code * in the inspected page. */ @@ -1128,131 +1109,6 @@ TestSuite.prototype._waitUntilScriptsAreParsed = function(expectedScripts, callb /** - * Waits until all debugger scripts are parsed and executes "a()" in the - * inspected page. - */ -TestSuite.prototype._executeFunctionForStepTest = function() -{ - this._executeCodeWhenScriptsAreParsed("a()", ["debugger_step.html", "debugger_step.js"]); -}; - - -/** - * Tests step over in the debugger. - */ -TestSuite.prototype.testStepOver = function() -{ - this.showPanel("scripts"); - var test = this; - - this._executeFunctionForStepTest(); - - this._performSteps([ - { - functionsOnStack: ["d","a",""], - lineNumber: 3, - lineText: " debugger;" - }, - function() { - document.getElementById("scripts-step-over").click(); - }, - { - functionsOnStack: ["d","a",""], - lineNumber: 5, - lineText: " var y = fact(10);" - }, - function() { - document.getElementById("scripts-step-over").click(); - }, - { - functionsOnStack: ["d","a",""], - lineNumber: 6, - lineText: " return y;" - }, - function() { - test.releaseControl(); - } - ]); - - test.takeControl(); -}; - - -/** - * Tests step out in the debugger. - */ -TestSuite.prototype.testStepOut = function() -{ - this.showPanel("scripts"); - var test = this; - - this._executeFunctionForStepTest(); - - this._performSteps([ - { - functionsOnStack: ["d","a",""], - lineNumber: 3, - lineText: " debugger;" - }, - function() { - document.getElementById("scripts-step-out").click(); - }, - { - functionsOnStack: ["a",""], - lineNumber: 8, - lineText: " printResult(result);" - }, - function() { - test.releaseControl(); - } - ]); - - test.takeControl(); -}; - - -/** - * Tests step in in the debugger. - */ -TestSuite.prototype.testStepIn = function() -{ - this.showPanel("scripts"); - var test = this; - - this._executeFunctionForStepTest(); - - this._performSteps([ - { - functionsOnStack: ["d","a",""], - lineNumber: 3, - lineText: " debugger;" - }, - function() { - document.getElementById("scripts-step-over").click(); - }, - { - functionsOnStack: ["d","a",""], - lineNumber: 5, - lineText: " var y = fact(10);" - }, - function() { - document.getElementById("scripts-step-into").click(); - }, - { - functionsOnStack: ["fact","d","a",""], - lineNumber: 10, - lineText: " var r = 1;" - }, - function() { - test.releaseControl(); - } - ]); - - test.takeControl(); -}; - - -/** * Gets a XPathResult matching given xpath. * @param {string} xpath * @param {number} resultType @@ -1503,116 +1359,6 @@ TestSuite.prototype._hookGetPropertiesCallback = function(hook, code) /** - * Tests that all elements in prototype chain of an object have expected - * intrinic proprties(__proto__, constructor, prototype). - */ -TestSuite.prototype.testDebugIntrinsicProperties = function() -{ - this.showPanel("scripts"); - var test = this; - - this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_intrinsic_properties.html"]); - - this._waitForScriptPause( - { - functionsOnStack: ["callDebugger", "handleClick", ""], - lineNumber: 29, - lineText: " debugger;" - }, - expandLocalScope); - - var localScopeSection = null; - function expandLocalScope() { - test._expandScopeSections(function(sections, i) { - if (i === 0) { - test.assertTrue(sections[i].object.isLocal, "Scope #0 is not Local."); - localScopeSection = sections[i]; - return true; - } - return false; - }, - examineLocalScope); - } - - function examineLocalScope() { - var scopeExpectations = [ - "a", "Child", [ - "__proto__", "Child", [ - "__proto__", "Parent", [ - "__proto__", "Object", null, - "constructor", "function Parent(n) {", [ - "name", '"Parent"', null, - "prototype", 'Parent', [ - "parentProtoField", "11", null, - ] - ], - "parentProtoField", "11", null, - ], - "constructor", "function Child(n) {", null, - "childProtoField", "21", null, - ], - - "parentField", "10", null, - "childField", "20", null, - ] - ]; - checkProperty(localScopeSection.propertiesTreeOutline, "<Local Scope>", scopeExpectations); - } - - var propQueue = []; - var index = 0; - var expectedFinalIndex = 5; - - function expandAndCheckNextProperty() { - if (index === propQueue.length) { - test.assertEquals(expectedFinalIndex, index, "Unexpected number of expanded objects."); - test.releaseControl(); - return; - } - - // Read next property data from the queue. - var treeElement = propQueue[index].treeElement; - var path = propQueue[index].path; - var expectations = propQueue[index].expectations; - index++; - - // Expand the property. - test._hookGetPropertiesCallback(function() { - checkProperty(treeElement, path, expectations); - }, - function() { - treeElement.expand(); - }); - } - - function checkProperty(treeElement, path, expectations) { - for (var i = 0; i < expectations.length; i += 3) { - var name = expectations[i]; - var description = expectations[i+1]; - var value = expectations[i+2]; - - var propertyPath = path + "." + name; - var propertyTreeElement = test._findChildProperty(treeElement, name, path); - test.assertTrue(propertyTreeElement, 'Property "' + propertyPath + '" not found.'); - test.assertEquals(description, propertyTreeElement.property.value.description, 'Unexpected "' + propertyPath + '" description.'); - if (value) { - // Schedule property content check. - propQueue.push({ - treeElement: propertyTreeElement, - path: propertyPath, - expectations: value, - }); - } - } - // Check next property in the queue. - expandAndCheckNextProperty(); - } - - test.takeControl(); -}; - - -/** * Tests "Pause" button will pause debugger when a snippet is evaluated. */ TestSuite.prototype.testPauseInEval = function() @@ -1647,101 +1393,6 @@ TestSuite.createKeyEvent = function(keyIdentifier) /** - * Tests console eval. - */ -TestSuite.prototype.testConsoleEval = function() -{ - var test = this; - this.evaluateInConsole_("123", - function(resultText) { - test.assertEquals("123", resultText); - test.releaseControl(); - }); - - this.takeControl(); -}; - - -/** - * Tests console log. - */ -TestSuite.prototype.testConsoleLog = function() -{ - WebInspector.showConsole(); - var messages = WebInspector.console.messages; - var index = 0; - - var test = this; - var assertNext = function(line, message, opt_class, opt_count, opt_substr) { - var elem = messages[index++].toMessageElement(); - var clazz = elem.getAttribute("class"); - var expectation = (opt_count || '') + 'console_test_page.html:' + line + message; - if (opt_substr) - test.assertContains(elem.textContent, expectation); - else - test.assertEquals(expectation, elem.textContent); - if (opt_class) - test.assertContains(clazz, "console-" + opt_class); - }; - - assertNext("5", "log", "log-level"); - assertNext("7", "debug", "log-level"); - assertNext("9", "info", "log-level"); - assertNext("11", "warn", "warning-level"); - assertNext("13", "error", "error-level"); - assertNext("15", "Message format number 1, 2 and 3.5"); - assertNext("17", "Message format for string"); - assertNext("19", "Object Object"); - assertNext("22", "repeated", "log-level", 5); - assertNext("26", "count: 1"); - assertNext("26", "count: 2"); - assertNext("29", "group", "group-title"); - index++; - assertNext("33", "timer:", "log-level", "", true); - assertNext("35", "1 2 3", "log-level"); - assertNext("37", "HTMLDocument", "log-level"); - assertNext("39", "<html>", "log-level", "", true); -}; - - -/** - * Tests eval of global objects. - */ -TestSuite.prototype.testEvalGlobal = function() -{ - WebInspector.showConsole(); - - var inputs = ["foo", "foobar"]; - var expectations = ["foo", "fooValue", "foobar", "ReferenceError: foobar is not defined"]; - - // Do not change code below - simply add inputs and expectations above. - var initEval = function(input) { - WebInspector.console.prompt.text = input; - WebInspector.console.promptElement.dispatchEvent( TestSuite.createKeyEvent("Enter")); - }; - var test = this; - var messagesCount = 0; - var inputIndex = 0; - this.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", - function(commandResult) { - messagesCount++; - if (messagesCount === expectations.length) { - var messages = WebInspector.console.messages; - for (var i = 0; i < expectations; ++i) { - var elem = messages[i++].toMessageElement(); - test.assertEquals(elem.textContent, expectations[i]); - } - test.releaseControl(); - } else if (messagesCount % 2 === 0) - initEval(inputs[inputIndex++]); - }, true); - - initEval(inputs[inputIndex++]); - this.takeControl(); -}; - - -/** * Tests the message loop re-entrancy. */ TestSuite.prototype.testMessageLoopReentrant = function() |