Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector/protocol-test.js

Issue 2600323002: DevTools: extract protocol module (Closed)
Patch Set: move inspector backend commands.js Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 var initialize_ProtocolTest = function() { 1 var initialize_ProtocolTest = function() {
2 2
3 InspectorTest.filterProps = function(object, nondeterministicProps) 3 InspectorTest.filterProps = function(object, nondeterministicProps)
4 { 4 {
5 if (object instanceof Object) 5 if (object instanceof Object)
6 for (var prop in object) 6 for (var prop in object)
7 if (prop in nondeterministicProps) 7 if (prop in nondeterministicProps)
8 object[prop] = "<" + typeof object[prop] + ">"; 8 object[prop] = "<" + typeof object[prop] + ">";
9 else 9 else
10 object[prop] = this.filterProps(object[prop], nondeterministicPr ops); 10 object[prop] = this.filterProps(object[prop], nondeterministicPr ops);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 InspectorTest.addObject(lastSentMessage, InspectorTest._customFormatters ); 72 InspectorTest.addObject(lastSentMessage, InspectorTest._customFormatters );
73 InspectorTest.addResult(""); 73 InspectorTest.addResult("");
74 74
75 if (agentName === this._agentName) 75 if (agentName === this._agentName)
76 this._agentCoverage[functionName] = "checked"; 76 this._agentCoverage[functionName] = "checked";
77 } 77 }
78 else { 78 else {
79 InspectorTest.addResult("=============================================== ============"); 79 InspectorTest.addResult("=============================================== ============");
80 InspectorTest.addResult("Coverage for " + this._agentName); 80 InspectorTest.addResult("Coverage for " + this._agentName);
81 InspectorTest.addObject(this._agentCoverage); 81 InspectorTest.addObject(this._agentCoverage);
82 InspectorBackend.dispatch = this._originalDispatch; 82 Protocol.inspectorBackend.dispatch = this._originalDispatch;
83 InspectorFrontendHost.sendMessageToBackend = this._originalSendMessageTo Backend; 83 InspectorFrontendHost.sendMessageToBackend = this._originalSendMessageTo Backend;
84 this.completeTest(); 84 this.completeTest();
85 } 85 }
86 }; 86 };
87 87
88 InspectorTest.runProtocolTestSuite = function(agentName, testSuite, nondetermini sticProps) 88 InspectorTest.runProtocolTestSuite = function(agentName, testSuite, nondetermini sticProps)
89 { 89 {
90 this._agentName = agentName; 90 this._agentName = agentName;
91 this._testSuite = testSuite; 91 this._testSuite = testSuite;
92 this._customFormatters = {}; 92 this._customFormatters = {};
93 for (var i = 0; i < nondeterministicProps.length; ++i) 93 for (var i = 0; i < nondeterministicProps.length; ++i)
94 this._customFormatters[nondeterministicProps[i]] = "formatAsTypeName"; 94 this._customFormatters[nondeterministicProps[i]] = "formatAsTypeName";
95 var agent = window[agentName]; 95 var agent = window[agentName];
96 96
97 this._agentCoverage = {}; 97 this._agentCoverage = {};
98 for (var key in agent) 98 for (var key in agent)
99 this._agentCoverage[key] = "not checked"; 99 this._agentCoverage[key] = "not checked";
100 100
101 var domain = agentName.replace(/Agent$/,""); 101 var domain = agentName.replace(/Agent$/,"");
102 var domainMessagesHandler = InspectorBackend._domainDispatchers[domain]; 102 var domainMessagesHandler = Protocol.inspectorBackend._domainDispatchers[dom ain];
103 for (var eventName in domainMessagesHandler) { 103 for (var eventName in domainMessagesHandler) {
104 if (typeof domainMessagesHandler[eventName] !== "function") 104 if (typeof domainMessagesHandler[eventName] !== "function")
105 continue; 105 continue;
106 this._agentCoverage[eventName] = "not checked"; 106 this._agentCoverage[eventName] = "not checked";
107 domainMessagesHandler[eventName] = InspectorTest._dumpEvent.bind(domainM essagesHandler, eventName, domainMessagesHandler[eventName]); 107 domainMessagesHandler[eventName] = InspectorTest._dumpEvent.bind(domainM essagesHandler, eventName, domainMessagesHandler[eventName]);
108 } 108 }
109 109
110 this._originalDispatch = InspectorBackend.dispatch; 110 this._originalDispatch = Protocol.inspectorBackend.dispatch;
111 InspectorBackend.dispatch = function(message) 111 Protocol.inspectorBackend.dispatch = function(message)
112 { 112 {
113 InspectorTest._lastReceivedMessage = (typeof message === "string") ? JSO N.parse(message) : message; 113 InspectorTest._lastReceivedMessage = (typeof message === "string") ? JSO N.parse(message) : message;
114 InspectorTest._originalDispatch.apply(InspectorBackend, [message]); 114 InspectorTest._originalDispatch.apply(Protocol.inspectorBackend, [messag e]);
115 } 115 }
116 116
117 this._originalSendMessageToBackend = InspectorFrontendHost.sendMessageToBack end; 117 this._originalSendMessageToBackend = InspectorFrontendHost.sendMessageToBack end;
118 InspectorFrontendHost.sendMessageToBackend = function(message) 118 InspectorFrontendHost.sendMessageToBackend = function(message)
119 { 119 {
120 InspectorTest._lastSentMessage = JSON.parse(message); 120 InspectorTest._lastSentMessage = JSON.parse(message);
121 InspectorTest._originalSendMessageToBackend.apply(InspectorFrontendHost, [message]); 121 InspectorTest._originalSendMessageToBackend.apply(InspectorFrontendHost, [message]);
122 } 122 }
123 123
124 this._step = -1; 124 this._step = -1;
125 125
126 this._runNextTest(); 126 this._runNextTest();
127 }; 127 };
128 128
129 }; 129 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698