Changeset 80419 in webkit
- Timestamp:
- Mar 5, 2011 3:20:27 AM (13 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r80417 r80419 1 2011-03-05 Ilya Tikhonovsky <loislo@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: introduce protocol test for ConsoleAgent. 6 https://bugs.webkit.org/show_bug.cgi?id=55819 7 8 * http/tests/inspector/protocol-test.js: 9 (initialize_ProtocolTest.InspectorTest._dumpEvent): 10 (initialize_ProtocolTest.InspectorTest._dumpCallArguments): 11 (initialize_ProtocolTest): 12 (initialize_ProtocolTest.): 13 * inspector/protocol/console-agent-expected.txt: Added. 14 * inspector/protocol/console-agent.html: Added. 15 * inspector/protocol/runtime-agent.html: 16 1 17 2011-03-05 Andrey Kosyakov <caseq@chromium.org> 2 18 -
trunk/LayoutTests/http/tests/inspector/protocol-test.js
r80341 r80419 17 17 }; 18 18 19 InspectorTest._dump TestResult = function(callArguments)19 InspectorTest._dumpEvent = function() 20 20 { 21 var functionName = callArguments.shift(); 22 this.filterProps(callArguments, this._nondeterministicProps); 23 var expression = JSON.stringify(callArguments); 24 expression = expression.slice(1, expression.length - 1).replace(/\"<number>\"/g, "<number>");; 25 var sentObject = JSON.parse(this._lastSentTestMessage); 26 var receivedObject = (typeof this._lastReceivedMessage === "string") ? JSON.parse(this._lastReceivedMessage) : this._lastReceivedMessage; 21 var args = Array.prototype.slice.call(arguments); 22 var eventName = args.shift(); 23 InspectorTest._agentCoverage[eventName] = "checked"; 24 InspectorTest.addResult("event " + InspectorTest._agentName + "." + eventName); 25 InspectorTest.addObject(InspectorTest._lastReceivedMessage, InspectorTest._nondeterministicProps); 26 InspectorTest.addResult(""); 27 28 var originalEventHandler = args.shift(); 29 originalEventHandler.apply(this, args); 30 }; 31 32 33 InspectorTest._dumpCallArguments = function(callArguments) 34 { 35 var callArgumentsCopy = JSON.parse(JSON.stringify(callArguments)); 36 var agentName = callArgumentsCopy.shift(); 37 var functionName = callArgumentsCopy.shift(); 38 this.filterProps(callArgumentsCopy, this._nondeterministicProps); 39 var expression = JSON.stringify(callArgumentsCopy); 40 expression = expression.slice(1, expression.length - 1).replace(/\"<number>\"/g, "<number>"); 27 41 28 42 InspectorTest.addResult("-----------------------------------------------------------"); 29 InspectorTest.addResult(this._agentName + "." + functionName + "(" + expression + ")"); 30 InspectorTest.addResult(""); 31 InspectorTest.addResult("request:"); 32 InspectorTest.addObject(sentObject, this._nondeterministicProps); 33 InspectorTest.addResult(""); 34 InspectorTest.addResult("response:"); 35 InspectorTest.addObject(receivedObject, this._nondeterministicProps); 43 InspectorTest.addResult(agentName + "." + functionName + "(" + expression + ")"); 36 44 InspectorTest.addResult(""); 37 45 }; 38 46 39 InspectorTest._callback = function( callArguments,result)47 InspectorTest._callback = function(result) 40 48 { 41 this._dumpTestResult(callArguments); 42 this._runNextStep(result); 49 InspectorTest.addResult("response:"); 50 InspectorTest.addObject(InspectorTest._lastReceivedMessage, InspectorTest._nondeterministicProps); 51 InspectorTest.addResult(""); 52 InspectorTest._runNextTest(); 43 53 }; 44 54 45 InspectorTest._runNext Step = function(result)55 InspectorTest._runNextTest = function() 46 56 { 47 57 var step = ++this._step; 48 58 var nextTest = this._testSuite[step]; 49 59 if (nextTest) { 50 var nextTestCopy = JSON.parse(JSON.stringify(nextTest)); 51 nextTest.push(this._callback.bind(this, nextTestCopy)); 60 InspectorTest._dumpCallArguments(nextTest); 61 62 nextTest.push(this._callback.bind(this)); 63 64 var agentName = nextTest.shift(); 52 65 var functionName = nextTest.shift(); 53 this._agentCoverage[functionName] = "checked"; 54 this._agent[functionName].apply(this._agent, nextTest); 55 this._lastSentTestMessage = this._lastSentMessage; 66 window[agentName][functionName].apply(window[agentName], nextTest); 67 68 var lastSentMessage = InspectorTest._lastSentMessage; // This is because the next call will override _lastSentMessage. 69 InspectorTest.addResult("request:"); 70 InspectorTest.addObject(lastSentMessage, InspectorTest._nondeterministicProps); 71 InspectorTest.addResult(""); 72 73 if (agentName === this._agentName) 74 this._agentCoverage[functionName] = "checked"; 56 75 } 57 76 else { … … 72 91 for (var i = 0; i < nondeterministicProps.length; ++i) 73 92 this._nondeterministicProps[nondeterministicProps[i]] = true; 74 this._agent = window[agentName]; 93 var agent = window[agentName]; 94 75 95 this._agentCoverage = {}; 76 for (var key in this._agent)96 for (var key in agent) 77 97 this._agentCoverage[key] = "not checked"; 98 99 var domain = agentName.replace(/Agent$/,""); 100 var domainMessagesHandler = InspectorBackend._domainDispatchers[domain]; 101 for (var eventName in domainMessagesHandler) { 102 this._agentCoverage[eventName] = "not checked"; 103 domainMessagesHandler[eventName] = InspectorTest._dumpEvent.bind(domainMessagesHandler, eventName, domainMessagesHandler[eventName]); 104 } 105 106 this._originalDispatch = InspectorBackend.dispatch; 107 InspectorBackend.dispatch = function(message) 108 { 109 InspectorTest._lastReceivedMessage = (typeof message === "string") ? JSON.parse(message) : message; 110 InspectorTest._originalDispatch.apply(InspectorBackend, [message]); 111 } 112 113 this._originalSendMessageToBackend = InspectorFrontendHost.sendMessageToBackend; 114 InspectorFrontendHost.sendMessageToBackend = function(message) 115 { 116 InspectorTest._lastSentMessage = JSON.parse(message); 117 InspectorTest._originalSendMessageToBackend.apply(InspectorFrontendHost, [message]); 118 } 119 78 120 this._step = -1; 79 121 80 this._originalDispatch = InspectorBackend.dispatch; 81 InspectorBackend.dispatch = function(message) { InspectorTest._lastReceivedMessage = message; InspectorTest._originalDispatch.apply(InspectorBackend, [message]); } 82 83 this._originalSendMessageToBackend = InspectorFrontendHost.sendMessageToBackend; 84 InspectorFrontendHost.sendMessageToBackend = function(message) { InspectorTest._lastSentMessage = message; InspectorTest._originalSendMessageToBackend.apply(InspectorFrontendHost, [message]); } 85 86 this._runNextStep(); 122 this._runNextTest(); 87 123 }; 88 124 -
trunk/LayoutTests/inspector/protocol/runtime-agent.html
r80349 r80419 18 18 { 19 19 var testSuite = [ 20 [" evaluate", 'testObject', 'test', false],21 [" evaluateOn", result.objectId, 'this.assignedByEvaluateOn = "evaluateOn function works fine";'],22 [" setPropertyValue", result.objectId, 'assignedBySetPropertyValue', 'true'],23 [" setPropertyValue", result.objectId, 'removedBySetPropertyValue', ''],24 [" getProperties", result.objectId, false, false],25 [" releaseObject", result.objectId],26 [" releaseObjectGroup", result.objectId.injectedScriptId, 'test']];20 ["RuntimeAgent", "evaluate", 'testObject', 'test', false], 21 ["RuntimeAgent", "evaluateOn", result.objectId, 'this.assignedByEvaluateOn = "evaluateOn function works fine";'], 22 ["RuntimeAgent", "setPropertyValue", result.objectId, 'assignedBySetPropertyValue', 'true'], 23 ["RuntimeAgent", "setPropertyValue", result.objectId, 'removedBySetPropertyValue', ''], 24 ["RuntimeAgent", "getProperties", result.objectId, false, false], 25 ["RuntimeAgent", "releaseObject", result.objectId], 26 ["RuntimeAgent", "releaseObjectGroup", result.objectId.injectedScriptId, 'test']]; 27 27 28 28 InspectorTest.runProtocolTestSuite("RuntimeAgent", testSuite, ['seq', 'id', 'injectedScriptId']);
Note: See TracChangeset
for help on using the changeset viewer.