Web Inspector: use different namespaces in test fixtures for protocol tests and front...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Aug 2015 18:28:31 +0000 (18:28 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Aug 2015 18:28:31 +0000 (18:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=147787

Patch by Brian Burg <bburg@apple.com> on 2015-08-11
Reviewed by Timothy Hatcher.

Refactor test methods to use three distinct namespaces to reflect their implementation:

- InspectorProtocol contains commands that are only used from within protocol tests.
This includes sending and receiving protocol messages and checking message errors.

- InspectorTest contains test methods for full inspector frontend tests.

- ProtocolTest contains test methods for protocol tests.

In a subsequent patch, most methods in InspectorTest and ProtocolTest namespaces
will be unified so that implementations of log, assert, etc. are no longer duplicated.
For now, at least make it obvious at each callsite what code is being invoked.

* http/tests/inspector/console/access-inspected-object.html:
* http/tests/inspector/dom/resources/InspectorDOMListener.js:
* http/tests/inspector/page/loading-iframe-document-node.html:
* http/tests/inspector/resources/ProtocolTestStub.js:
* http/tests/inspector/resources/console-test.js:
* http/tests/inspector/resources/probe-test.js:
* inspector/console/console-message.html:
* inspector/console/css-source-locations.html:
* inspector/console/js-source-locations.html:
* inspector/console/x-frame-options-message.html:
* inspector/css/getSupportedCSSProperties.html:
* inspector/debugger/breakpoint-action-detach.html:
* inspector/debugger/breakpoint-action-with-exception.html:
* inspector/debugger/breakpoint-condition-detach.html:
* inspector/debugger/breakpoint-condition-with-bad-script.html:
* inspector/debugger/breakpoint-condition-with-exception.html:
* inspector/debugger/breakpoint-eval-with-exception.html:
* inspector/debugger/breakpoint-inside-conditons-and-actions.html:
* inspector/debugger/call-frame-function-name.html:
* inspector/debugger/call-frame-this-host.html:
* inspector/debugger/call-frame-this-nonstrict.html:
* inspector/debugger/call-frame-this-strict.html:
* inspector/debugger/debugger-statement.html:
* inspector/debugger/didSampleProbe-multiple-probes.html:
* inspector/debugger/hit-breakpoint-from-console.html:
* inspector/debugger/nested-inspectors.html:
* inspector/debugger/pause-dedicated-worker.html:
* inspector/debugger/pause-on-assert.html:
* inspector/debugger/regress-133182.html:
* inspector/debugger/removeBreakpoint.html:
* inspector/debugger/searchInContent-linebreaks.html:
* inspector/debugger/setBreakpoint-actions.html:
* inspector/debugger/setBreakpoint-autoContinue.html:
* inspector/debugger/setBreakpoint-column.html:
* inspector/debugger/setBreakpoint-condition.html:
* inspector/debugger/setBreakpoint-dfg-and-modify-local.html:
* inspector/debugger/setBreakpoint-dfg-callee-and-examine-dfg-local.html:
* inspector/debugger/setBreakpoint-dfg.html:
* inspector/debugger/setBreakpoint-options-exception.html:
* inspector/debugger/setBreakpoint.html:
* inspector/debugger/setBreakpointByUrl-sourceURL.html:
* inspector/debugger/setPauseOnExceptions-all.html:
* inspector/debugger/setPauseOnExceptions-none.html:
* inspector/debugger/setPauseOnExceptions-uncaught.html:
* inspector/debugger/setVariableValue.html:
* inspector/debugger/terminate-dedicated-worker-while-paused.html:
* inspector/dom-debugger/node-removed.html:
* inspector/dom/dom-remove-events.html:
* inspector/dom/dom-search-crash.html:
* inspector/dom/dom-search-with-context.html:
* inspector/dom/dom-search.html:
* inspector/dom/focus.html:
* inspector/dom/getAccessibilityPropertiesForNode.html:
* inspector/dom/getAccessibilityPropertiesForNode_liveRegion.html:
* inspector/dom/getAccessibilityPropertiesForNode_mouseEventNodeId.html:
* inspector/dom/highlight-flow-with-no-region.html:
* inspector/dom/remove-multiple-nodes.html:
* inspector/dom/request-child-nodes-depth.html:
* inspector/layers/layers-anonymous.html:
* inspector/layers/layers-blending-compositing-reasons.html:
* inspector/layers/layers-compositing-reasons.html:
* inspector/layers/layers-for-node.html:
* inspector/layers/layers-generated-content.html:
* inspector/layers/layers-reflected-content.html:
* inspector/page/archive.html:
* inspector/page/frameScheduledNavigation.html:
* inspector/page/frameStartedLoading.html:
* inspector/page/javascriptDialogEvents.html:
* inspector/page/setEmulatedMedia.html:
* inspector/runtime/getProperties.html:
* inspector/unit-tests/async-test-suite.html:
* inspector/unit-tests/sync-test-suite.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188267 268f45cc-cd09-0410-ab3c-d52691b4dbfc

73 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/console/access-inspected-object.html
LayoutTests/http/tests/inspector/dom/resources/InspectorDOMListener.js
LayoutTests/http/tests/inspector/page/loading-iframe-document-node.html
LayoutTests/http/tests/inspector/resources/ProtocolTestStub.js
LayoutTests/http/tests/inspector/resources/console-test.js
LayoutTests/http/tests/inspector/resources/probe-test.js
LayoutTests/inspector/console/console-message.html
LayoutTests/inspector/console/css-source-locations.html
LayoutTests/inspector/console/js-source-locations.html
LayoutTests/inspector/console/x-frame-options-message.html
LayoutTests/inspector/css/getSupportedCSSProperties.html
LayoutTests/inspector/debugger/breakpoint-action-detach.html
LayoutTests/inspector/debugger/breakpoint-action-with-exception.html
LayoutTests/inspector/debugger/breakpoint-condition-detach.html
LayoutTests/inspector/debugger/breakpoint-condition-with-bad-script.html
LayoutTests/inspector/debugger/breakpoint-condition-with-exception.html
LayoutTests/inspector/debugger/breakpoint-eval-with-exception.html
LayoutTests/inspector/debugger/breakpoint-inside-conditons-and-actions.html
LayoutTests/inspector/debugger/call-frame-function-name.html
LayoutTests/inspector/debugger/call-frame-this-host.html
LayoutTests/inspector/debugger/call-frame-this-nonstrict.html
LayoutTests/inspector/debugger/call-frame-this-strict.html
LayoutTests/inspector/debugger/debugger-statement.html
LayoutTests/inspector/debugger/didSampleProbe-multiple-probes.html
LayoutTests/inspector/debugger/hit-breakpoint-from-console.html
LayoutTests/inspector/debugger/nested-inspectors.html
LayoutTests/inspector/debugger/pause-dedicated-worker.html
LayoutTests/inspector/debugger/pause-on-assert.html
LayoutTests/inspector/debugger/regress-133182.html
LayoutTests/inspector/debugger/removeBreakpoint.html
LayoutTests/inspector/debugger/searchInContent-linebreaks.html
LayoutTests/inspector/debugger/setBreakpoint-actions.html
LayoutTests/inspector/debugger/setBreakpoint-autoContinue.html
LayoutTests/inspector/debugger/setBreakpoint-column.html
LayoutTests/inspector/debugger/setBreakpoint-condition.html
LayoutTests/inspector/debugger/setBreakpoint-dfg-and-modify-local.html
LayoutTests/inspector/debugger/setBreakpoint-dfg-callee-and-examine-dfg-local.html
LayoutTests/inspector/debugger/setBreakpoint-dfg.html
LayoutTests/inspector/debugger/setBreakpoint-options-exception.html
LayoutTests/inspector/debugger/setBreakpoint.html
LayoutTests/inspector/debugger/setBreakpointByUrl-sourceURL.html
LayoutTests/inspector/debugger/setPauseOnExceptions-all.html
LayoutTests/inspector/debugger/setPauseOnExceptions-none.html
LayoutTests/inspector/debugger/setPauseOnExceptions-uncaught.html
LayoutTests/inspector/debugger/setVariableValue.html
LayoutTests/inspector/debugger/terminate-dedicated-worker-while-paused.html
LayoutTests/inspector/dom-debugger/node-removed.html
LayoutTests/inspector/dom/dom-remove-events.html
LayoutTests/inspector/dom/dom-search-crash.html
LayoutTests/inspector/dom/dom-search-with-context.html
LayoutTests/inspector/dom/dom-search.html
LayoutTests/inspector/dom/focus.html
LayoutTests/inspector/dom/getAccessibilityPropertiesForNode.html
LayoutTests/inspector/dom/getAccessibilityPropertiesForNode_liveRegion.html
LayoutTests/inspector/dom/getAccessibilityPropertiesForNode_mouseEventNodeId.html
LayoutTests/inspector/dom/highlight-flow-with-no-region.html
LayoutTests/inspector/dom/remove-multiple-nodes.html
LayoutTests/inspector/dom/request-child-nodes-depth.html
LayoutTests/inspector/layers/layers-anonymous.html
LayoutTests/inspector/layers/layers-blending-compositing-reasons.html
LayoutTests/inspector/layers/layers-compositing-reasons.html
LayoutTests/inspector/layers/layers-for-node.html
LayoutTests/inspector/layers/layers-generated-content.html
LayoutTests/inspector/layers/layers-reflected-content.html
LayoutTests/inspector/page/archive.html
LayoutTests/inspector/page/frameScheduledNavigation.html
LayoutTests/inspector/page/frameStartedLoading.html
LayoutTests/inspector/page/javascriptDialogEvents.html
LayoutTests/inspector/page/setEmulatedMedia.html
LayoutTests/inspector/runtime/getProperties.html
LayoutTests/inspector/unit-tests/async-test-suite.html
LayoutTests/inspector/unit-tests/sync-test-suite.html

index d120916..6fc1169 100644 (file)
@@ -1,3 +1,96 @@
+2015-08-11  Brian Burg  <bburg@apple.com>
+
+        Web Inspector: use different namespaces in test fixtures for protocol tests and frontend tests
+        https://bugs.webkit.org/show_bug.cgi?id=147787
+
+        Reviewed by Timothy Hatcher.
+
+        Refactor test methods to use three distinct namespaces to reflect their implementation:
+
+        - InspectorProtocol contains commands that are only used from within protocol tests.
+        This includes sending and receiving protocol messages and checking message errors.
+
+        - InspectorTest contains test methods for full inspector frontend tests.
+
+        - ProtocolTest contains test methods for protocol tests.
+
+        In a subsequent patch, most methods in InspectorTest and ProtocolTest namespaces
+        will be unified so that implementations of log, assert, etc. are no longer duplicated.
+        For now, at least make it obvious at each callsite what code is being invoked.
+
+        * http/tests/inspector/console/access-inspected-object.html:
+        * http/tests/inspector/dom/resources/InspectorDOMListener.js:
+        * http/tests/inspector/page/loading-iframe-document-node.html:
+        * http/tests/inspector/resources/ProtocolTestStub.js:
+        * http/tests/inspector/resources/console-test.js:
+        * http/tests/inspector/resources/probe-test.js:
+        * inspector/console/console-message.html:
+        * inspector/console/css-source-locations.html:
+        * inspector/console/js-source-locations.html:
+        * inspector/console/x-frame-options-message.html:
+        * inspector/css/getSupportedCSSProperties.html:
+        * inspector/debugger/breakpoint-action-detach.html:
+        * inspector/debugger/breakpoint-action-with-exception.html:
+        * inspector/debugger/breakpoint-condition-detach.html:
+        * inspector/debugger/breakpoint-condition-with-bad-script.html:
+        * inspector/debugger/breakpoint-condition-with-exception.html:
+        * inspector/debugger/breakpoint-eval-with-exception.html:
+        * inspector/debugger/breakpoint-inside-conditons-and-actions.html:
+        * inspector/debugger/call-frame-function-name.html:
+        * inspector/debugger/call-frame-this-host.html:
+        * inspector/debugger/call-frame-this-nonstrict.html:
+        * inspector/debugger/call-frame-this-strict.html:
+        * inspector/debugger/debugger-statement.html:
+        * inspector/debugger/didSampleProbe-multiple-probes.html:
+        * inspector/debugger/hit-breakpoint-from-console.html:
+        * inspector/debugger/nested-inspectors.html:
+        * inspector/debugger/pause-dedicated-worker.html:
+        * inspector/debugger/pause-on-assert.html:
+        * inspector/debugger/regress-133182.html:
+        * inspector/debugger/removeBreakpoint.html:
+        * inspector/debugger/searchInContent-linebreaks.html:
+        * inspector/debugger/setBreakpoint-actions.html:
+        * inspector/debugger/setBreakpoint-autoContinue.html:
+        * inspector/debugger/setBreakpoint-column.html:
+        * inspector/debugger/setBreakpoint-condition.html:
+        * inspector/debugger/setBreakpoint-dfg-and-modify-local.html:
+        * inspector/debugger/setBreakpoint-dfg-callee-and-examine-dfg-local.html:
+        * inspector/debugger/setBreakpoint-dfg.html:
+        * inspector/debugger/setBreakpoint-options-exception.html:
+        * inspector/debugger/setBreakpoint.html:
+        * inspector/debugger/setBreakpointByUrl-sourceURL.html:
+        * inspector/debugger/setPauseOnExceptions-all.html:
+        * inspector/debugger/setPauseOnExceptions-none.html:
+        * inspector/debugger/setPauseOnExceptions-uncaught.html:
+        * inspector/debugger/setVariableValue.html:
+        * inspector/debugger/terminate-dedicated-worker-while-paused.html:
+        * inspector/dom-debugger/node-removed.html:
+        * inspector/dom/dom-remove-events.html:
+        * inspector/dom/dom-search-crash.html:
+        * inspector/dom/dom-search-with-context.html:
+        * inspector/dom/dom-search.html:
+        * inspector/dom/focus.html:
+        * inspector/dom/getAccessibilityPropertiesForNode.html:
+        * inspector/dom/getAccessibilityPropertiesForNode_liveRegion.html:
+        * inspector/dom/getAccessibilityPropertiesForNode_mouseEventNodeId.html:
+        * inspector/dom/highlight-flow-with-no-region.html:
+        * inspector/dom/remove-multiple-nodes.html:
+        * inspector/dom/request-child-nodes-depth.html:
+        * inspector/layers/layers-anonymous.html:
+        * inspector/layers/layers-blending-compositing-reasons.html:
+        * inspector/layers/layers-compositing-reasons.html:
+        * inspector/layers/layers-for-node.html:
+        * inspector/layers/layers-generated-content.html:
+        * inspector/layers/layers-reflected-content.html:
+        * inspector/page/archive.html:
+        * inspector/page/frameScheduledNavigation.html:
+        * inspector/page/frameStartedLoading.html:
+        * inspector/page/javascriptDialogEvents.html:
+        * inspector/page/setEmulatedMedia.html:
+        * inspector/runtime/getProperties.html:
+        * inspector/unit-tests/async-test-suite.html:
+        * inspector/unit-tests/sync-test-suite.html:
+
 2015-08-11  Myles C. Maxfield  <mmaxfield@apple.com>
 
         [iOS] Arabic letter Yeh is drawn in LastResort
index ceebd9a..e537ddd 100644 (file)
@@ -9,22 +9,22 @@ if (window.testRunner) {
 
 function test()
 {
-    InspectorTest.sendCommand("DOM.getDocument", {}, didGetDocument);
+    InspectorProtocol.sendCommand("DOM.getDocument", {}, didGetDocument);
 
     function didGetDocument(messageObject)
     {
-        InspectorTest.sendCommand("DOM.querySelector", {
+        InspectorProtocol.sendCommand("DOM.querySelector", {
                 "nodeId": messageObject.result.root.nodeId,
                 "selector": "iframe#myframe"
             }, didFindIframe);
-        InspectorTest.eventHandler["DOM.setChildNodes"] = iframeRequestHandler;
+        InspectorProtocol.eventHandler["DOM.setChildNodes"] = iframeRequestHandler;
     }
 
     function didFindIframe(messageObject)
     {
         if (messageObject.error) {
-            InspectorTest.log("FAIL: " + messageObject.error);
-            InspectorTest.completeTest();
+            ProtocolTest.log("FAIL: " + messageObject.error);
+            ProtocolTest.completeTest();
         }
     }
 
@@ -33,8 +33,8 @@ function test()
         var node = messageObject.params.nodes[0];
         if (!node || node.nodeName !== "IFRAME")
             return;
-        InspectorTest.eventHandler["DOM.setChildNodes"] = null;
-        InspectorTest.sendCommand("DOM.querySelector", {
+        InspectorProtocol.eventHandler["DOM.setChildNodes"] = null;
+        InspectorProtocol.sendCommand("DOM.querySelector", {
                 "nodeId": node.contentDocument.nodeId,
                 "selector": "div#rootDiv"
             }, didFindDiv);
@@ -42,15 +42,15 @@ function test()
 
     function didFindDiv(messageObject)
     {
-        InspectorTest.sendCommand("Console.enable", {});
-        InspectorTest.sendCommand("Console.addInspectedNode", {
+        InspectorProtocol.sendCommand("Console.enable", {});
+        InspectorProtocol.sendCommand("Console.addInspectedNode", {
                 "nodeId": messageObject.result.nodeId
             }, didAddInspectedNode);
     }
 
     function didAddInspectedNode(messageObject)
     {
-        InspectorTest.sendCommand("Runtime.evaluate", {
+        InspectorProtocol.sendCommand("Runtime.evaluate", {
                 "expression": "$0",
                 "includeCommandLineAPI": true
             }, didEvaluate);
@@ -59,10 +59,10 @@ function test()
     function didEvaluate(messageObject)
     {
         if (messageObject.result.wasThrown)
-            InspectorTest.log("FAIL: unexpected exception: " + JSON.stringify(messageObject, null, 2));
+            ProtocolTest.log("FAIL: unexpected exception: " + JSON.stringify(messageObject, null, 2));
         if (messageObject.result.result.value !== null)
-            InspectorTest.log("FAIL: unexpected value: " + JSON.stringify(messageObject, null, 2));
-        InspectorTest.completeTest();
+            ProtocolTest.log("FAIL: unexpected value: " + JSON.stringify(messageObject, null, 2));
+        ProtocolTest.completeTest();
     }
 }
 
index 44eb219..5d19fa1 100644 (file)
@@ -31,9 +31,9 @@ function createDOMListener()
 {
     var nodesById = {};
 
-    InspectorTest.addEventListener("DOM.setChildNodes", onSetChildNodes);
-    InspectorTest.addEventListener("DOM.childNodeRemoved", onChildNodeRemoved);
-    InspectorTest.addEventListener("DOM.childNodeInserted", onChildNodeInserted);
+    InspectorProtocol.addEventListener("DOM.setChildNodes", onSetChildNodes);
+    InspectorProtocol.addEventListener("DOM.childNodeRemoved", onChildNodeRemoved);
+    InspectorProtocol.addEventListener("DOM.childNodeInserted", onChildNodeInserted);
 
     function createNodeAttributesMap(attributes)
     {
index 94a3ee2..9598519 100644 (file)
@@ -27,24 +27,24 @@ function test()
     4. Use the JS object to retrieve the DOM agent nodeid for the document node.
     */
 
-    InspectorTest.eventHandler["Page.frameStartedLoading"] = step2_onFrameStartedLoading;
-    InspectorTest.eventHandler["Runtime.executionContextCreated"] = step3_onExecutionContextCreated;
-    InspectorTest.eventHandler["Page.loadEventFired"] = onLoadEventFired;
+    InspectorProtocol.eventHandler["Page.frameStartedLoading"] = step2_onFrameStartedLoading;
+    InspectorProtocol.eventHandler["Runtime.executionContextCreated"] = step3_onExecutionContextCreated;
+    InspectorProtocol.eventHandler["Page.loadEventFired"] = onLoadEventFired;
     
     var targetFrameId = null;
 
     function step1_bootstrap() {
-        InspectorTest.log("step1_bootstrap");
+        ProtocolTest.log("step1_bootstrap");
         // Enable the frame events.
-        InspectorTest.sendCommand("Page.enable", {}, function() {
+        InspectorProtocol.sendCommand("Page.enable", {}, function() {
             // Enable the Runtime.executionContextCreated event.
-            InspectorTest.sendCommand("Runtime.enable", {}, function() {
+            InspectorProtocol.sendCommand("Runtime.enable", {}, function() {
                 // Initialize the DOM agent.
-                InspectorTest.sendCommand("DOM.getDocument", {}, function() {
-                    InspectorTest.log("Main document loaded");
+                InspectorProtocol.sendCommand("DOM.getDocument", {}, function() {
+                    ProtocolTest.log("Main document loaded");
                     
                     // Add the iframe to the DOM.
-                    InspectorTest.sendCommand("Runtime.evaluate", { "expression": "appendIframe()" });
+                    InspectorProtocol.sendCommand("Runtime.evaluate", { "expression": "appendIframe()" });
                 });
             });
         });
@@ -52,7 +52,7 @@ function test()
 
     function step2_onFrameStartedLoading(response)
     {
-        InspectorTest.log("step2_onFrameStartedLoading");
+        ProtocolTest.log("step2_onFrameStartedLoading");
         targetFrameId = response.params.frameId;
     }
 
@@ -62,9 +62,9 @@ function test()
         if (frameId !== targetFrameId)
             return;
 
-        InspectorTest.log("step3_onExecutionContextCreated: Requesting document from iframe's context.");
+        ProtocolTest.log("step3_onExecutionContextCreated: Requesting document from iframe's context.");
 
-        InspectorTest.sendCommand("Runtime.evaluate", {
+        InspectorProtocol.sendCommand("Runtime.evaluate", {
             "expression": "document",
             "objectGroup": "console",
             "includeCommandLineAPI": false,
@@ -77,7 +77,7 @@ function test()
         function callback(response)
         {
             var objectId = response.result.result.objectId;
-            InspectorTest.log("Received script object for iframe's document node");
+            ProtocolTest.log("Received script object for iframe's document node");
             step4_requestNode(frameId, objectId);
         }
     }
@@ -86,27 +86,27 @@ function test()
     {
         function callback(response)
         {
-            InspectorTest.log(response.result.nodeId ? "PASS: Received node for iframe's document node" : "FAIL: Iframe's document node is not available");
+            ProtocolTest.log(response.result.nodeId ? "PASS: Received node for iframe's document node" : "FAIL: Iframe's document node is not available");
             completeTest();
         }
 
-        InspectorTest.log("step4_requestNode: Requesting DOM node for iframe's document node");
-        InspectorTest.sendCommand("DOM.requestNode", { objectId: objectId }, callback);
+        ProtocolTest.log("step4_requestNode: Requesting DOM node for iframe's document node");
+        InspectorProtocol.sendCommand("DOM.requestNode", { objectId: objectId }, callback);
     }
 
     function completeTest()
     {
-        InspectorTest.log("Test finished");
+        ProtocolTest.log("Test finished");
         // Stop loading the iframe to avoid timing out the test.
-        InspectorTest.sendCommand("Runtime.evaluate", { "expression": "removeIframe()" });
-        InspectorTest.completeTest();
+        InspectorProtocol.sendCommand("Runtime.evaluate", { "expression": "removeIframe()" });
+        ProtocolTest.completeTest();
     }
 
     function onLoadEventFired()
     {
         // We should finish the test before this event is triggered.
         // If you see this in the output, then the slow-image is not loaded correctly in the iframe.
-        InspectorTest.log("FAIL: Iframe load event fired before the test finished.");
+        ProtocolTest.log("FAIL: Iframe load event fired before the test finished.");
     }
 
     step1_bootstrap()
index 7653da3..4c199cb 100644 (file)
  */
 InspectorFrontendAPI = {};
 
-InspectorTest = {};
-InspectorTest._dispatchTable = [];
-InspectorTest._requestId = -1;
-InspectorTest.eventHandler = {};
-InspectorTest.logCount = 0;
+InspectorProtocol = {};
+InspectorProtocol._dispatchTable = [];
+InspectorProtocol._requestId = -1;
+InspectorProtocol.eventHandler = {};
 
-InspectorTest.dumpInspectorProtocolMessages = false;
-InspectorTest.forceSyncDebugLogging = false;
+ProtocolTest = {};
+ProtocolTest.logCount = 0;
 
-InspectorTest.sendCommand = function(methodOrObject, params, handler)
+ProtocolTest.forceSyncDebugLogging = false;
+InspectorProtocol.dumpInspectorProtocolMessages = false;
+
+InspectorProtocol.sendCommand = function(methodOrObject, params, handler)
 {
     // Allow new-style arguments object, as in awaitCommand.
     var method = methodOrObject;
@@ -48,7 +50,7 @@ InspectorTest.sendCommand = function(methodOrObject, params, handler)
     return this._requestId;
 }
 
-InspectorTest.awaitCommand = function(args)
+InspectorProtocol.awaitCommand = function(args)
 {
     var {method, params} = args;
     return new Promise(function(resolve, reject) {
@@ -58,21 +60,21 @@ InspectorTest.awaitCommand = function(args)
     }.bind(this));
 }
 
-InspectorTest.awaitEvent = function(args)
+InspectorProtocol.awaitEvent = function(args)
 {
     var {event} = args;
     if (typeof event !== "string")
         throw new Error("Event must be a string.");
 
     return new Promise(function(resolve, reject) {
-        InspectorTest.eventHandler[event] = function(message) {
-            InspectorTest.eventHandler[event] = undefined;
+        InspectorProtocol.eventHandler[event] = function(message) {
+            InspectorProtocol.eventHandler[event] = undefined;
             resolve(message);
         }
     });
 }
 
-InspectorTest.addEventListener = function(eventTypeOrObject, listener)
+InspectorProtocol.addEventListener = function(eventTypeOrObject, listener)
 {
     var event = eventTypeOrObject;
     if (typeof eventTypeOrObject === "object")
@@ -85,11 +87,11 @@ InspectorTest.addEventListener = function(eventTypeOrObject, listener)
         throw new Error("Event listener must be callable.");
 
     // Convert to an array of listeners.
-    var listeners = InspectorTest.eventHandler[event];
+    var listeners = InspectorProtocol.eventHandler[event];
     if (!listeners)
-        listeners = InspectorTest.eventHandler[event] = [];
+        listeners = InspectorProtocol.eventHandler[event] = [];
     else if (typeof listeners === "function")
-        listeners = InspectorTest.eventHandler[event] = [listeners];
+        listeners = InspectorProtocol.eventHandler[event] = [listeners];
 
     // Prevent registering multiple times.
     if (listeners.includes(listener))
@@ -98,22 +100,31 @@ InspectorTest.addEventListener = function(eventTypeOrObject, listener)
     listeners.push(listener);
 }
 
-InspectorTest.sendMessage = function(messageObject)
+InspectorProtocol.sendMessage = function(messageObject)
 {
     // This matches the debug dumping in InspectorBackend, which is bypassed
-    // by InspectorTest. Return messages should be dumped by InspectorBackend.
+    // by InspectorProtocol. Return messages should be dumped by InspectorBackend.
     if (this.dumpInspectorProtocolMessages)
         console.log("frontend: " + JSON.stringify(messageObject));
 
     InspectorFrontendHost.sendMessageToBackend(JSON.stringify(messageObject));
 }
 
+InspectorProtocol.checkForError = function(responseObject)
+{
+    if (responseObject.error) {
+        ProtocolTest.log("PROTOCOL ERROR: " + JSON.stringify(responseObject.error));
+        ProtocolTest.completeTest();
+        throw "PROTOCOL ERROR";
+    }
+}
+
 InspectorFrontendAPI.dispatchMessageAsync = function(messageObject)
 {
     // If the message has an id, then it is a reply to a command.
     var messageId = messageObject["id"];
     if (typeof messageId === "number") {
-        var handler = InspectorTest._dispatchTable[messageId];
+        var handler = InspectorProtocol._dispatchTable[messageId];
         if (!handler)
             return;
 
@@ -129,7 +140,7 @@ InspectorFrontendAPI.dispatchMessageAsync = function(messageObject)
     // Otherwise, it is an event.
     } else {
         var eventName = messageObject["method"];
-        var handler = InspectorTest.eventHandler[eventName];
+        var handler = InspectorProtocol.eventHandler[eventName];
         if (!handler)
             return;
 
@@ -149,7 +160,20 @@ InspectorFrontendAPI.dispatchMessageAsync = function(messageObject)
     }
 }
 
-InspectorTest.AsyncTestSuite = class AsyncTestSuite {
+window.addEventListener("message", function(event) {
+    try {
+        eval(event.data);
+    } catch (e) {
+        alert(e.stack);
+        ProtocolTest.completeTest();
+        throw e;
+    }
+});
+
+// FIXME: Everything below here should be extracted to a file containing shared test utilities
+// between the two harnesses.
+
+ProtocolTest.AsyncTestSuite = class AsyncTestSuite {
     constructor(name) {
         if (!name || typeof name !== "string")
             throw new Error("Tried to create AsyncTestSuite without string suite name.");
@@ -193,7 +217,7 @@ InspectorTest.AsyncTestSuite = class AsyncTestSuite {
     runTestCasesAndFinish()
     {
         function finish() {
-            InspectorTest.completeTest();
+            ProtocolTest.completeTest();
         }
 
         this.runTestCases()
@@ -210,19 +234,19 @@ InspectorTest.AsyncTestSuite = class AsyncTestSuite {
 
         this._startedRunning = true;
 
-        InspectorTest.log("");
-        InspectorTest.log("== Running test suite: " + this.name);
+        ProtocolTest.log("");
+        ProtocolTest.log("== Running test suite: " + this.name);
 
         // Avoid adding newlines if nothing was logged.
-        var priorLogCount = InspectorTest.logCount;
+        var priorLogCount = ProtocolTest.logCount;
         var suite = this;
         var result = this.testcases.reduce(function(chain, testcase, i) {
             return chain.then(function() {
-                if (i > 0 && priorLogCount + 1 < InspectorTest.logCount)
-                    InspectorTest.log("");
+                if (i > 0 && priorLogCount + 1 < ProtocolTest.logCount)
+                    ProtocolTest.log("");
 
-                priorLogCount = InspectorTest.logCount;
-                InspectorTest.log("-- Running test case: " + testcase.name);
+                priorLogCount = ProtocolTest.logCount;
+                ProtocolTest.log("-- Running test case: " + testcase.name);
                 suite.runCount++;
                 return new Promise(testcase.test);
             });
@@ -237,13 +261,13 @@ InspectorTest.AsyncTestSuite = class AsyncTestSuite {
             if (typeof message !== "string")
                 message = JSON.stringify(message);
 
-            InspectorTest.log("!! EXCEPTION: " + message);
+            ProtocolTest.log("!! EXCEPTION: " + message);
             throw e; // Reject this promise by re-throwing the error.
         });
     }
 }
 
-InspectorTest.SyncTestSuite = class SyncTestSuite {
+ProtocolTest.SyncTestSuite = class SyncTestSuite {
     constructor(name) {
         if (!name || typeof name !== "string")
             throw new Error("Tried to create SyncTestSuite without string suite name.");
@@ -286,7 +310,7 @@ InspectorTest.SyncTestSuite = class SyncTestSuite {
     runTestCasesAndFinish()
     {
         this.runTestCases();
-        InspectorTest.completeTest();
+        ProtocolTest.completeTest();
     }
 
     runTestCases()
@@ -298,19 +322,19 @@ InspectorTest.SyncTestSuite = class SyncTestSuite {
 
         this._startedRunning = true;
 
-        InspectorTest.log("");
-        InspectorTest.log("== Running test suite: " + this.name);
+        ProtocolTest.log("");
+        ProtocolTest.log("== Running test suite: " + this.name);
 
-        var priorLogCount = InspectorTest.logCount;
+        var priorLogCount = ProtocolTest.logCount;
         var suite = this;
         for (var i = 0; i < this.testcases.length; i++) {
             var testcase = this.testcases[i];
-            if (i > 0 && priorLogCount + 1 < InspectorTest.logCount)
-                InspectorTest.log("");
+            if (i > 0 && priorLogCount + 1 < ProtocolTest.logCount)
+                ProtocolTest.log("");
 
-            priorLogCount = InspectorTest.logCount;
+            priorLogCount = ProtocolTest.logCount;
 
-            InspectorTest.log("-- Running test case: " + testcase.name);
+            ProtocolTest.log("-- Running test case: " + testcase.name);
             suite.runCount++;
             try {
                 var result = testcase.test.call(null);
@@ -329,7 +353,7 @@ InspectorTest.SyncTestSuite = class SyncTestSuite {
                 if (typeof message !== "string")
                     message = JSON.stringify(message);
 
-                InspectorTest.log("!! EXCEPTION: " + message);
+                ProtocolTest.log("!! EXCEPTION: " + message);
                 return false;
             }
         }
@@ -339,18 +363,18 @@ InspectorTest.SyncTestSuite = class SyncTestSuite {
 }
 
 // Logs a message to test document.
-InspectorTest.log = function(message)
+ProtocolTest.log = function(message)
 {
-    ++InspectorTest.logCount;
+    ++ProtocolTest.logCount;
 
     if (this.forceSyncDebugLogging)
         this.debugLog(message);
     else
-        this.sendCommand("Runtime.evaluate", { "expression": "log(" + JSON.stringify(message) + ")" } );
+        InspectorProtocol.sendCommand("Runtime.evaluate", { "expression": "log(" + JSON.stringify(message) + ")" } );
 }
 
 // Logs an assertion result to the test document.
-InspectorTest.assert = function(condition, message)
+ProtocolTest.assert = function(condition, message)
 {
     var status = condition ? "PASS" : "FAIL";
     var message = typeof message !== "string" ? JSON.stringify(message) : message;
@@ -360,26 +384,17 @@ InspectorTest.assert = function(condition, message)
 
 // Logs message a directly to stdout of the test process via alert function.
 // This message should survive process crash or kill by timeout.
-InspectorTest.debugLog = function(message)
-{
-    this.sendCommand("Runtime.evaluate", { "expression": "debugLog(" + JSON.stringify(message) + ")" } );
-}
-
-InspectorTest.completeTest = function()
+ProtocolTest.debugLog = function(message)
 {
-    this.sendCommand("Runtime.evaluate", { "expression": "closeTest();"} );
+    InspectorProtocol.sendCommand("Runtime.evaluate", { "expression": "debugLog(" + JSON.stringify(message) + ")" } );
 }
 
-InspectorTest.checkForError = function(responseObject)
+ProtocolTest.completeTest = function()
 {
-    if (responseObject.error) {
-        InspectorTest.log("PROTOCOL ERROR: " + JSON.stringify(responseObject.error));
-        InspectorTest.completeTest();
-        throw "PROTOCOL ERROR";
-    }
+    InspectorProtocol.sendCommand("Runtime.evaluate", { "expression": "closeTest();"} );
 }
 
-InspectorTest.importScript = function(scriptName)
+ProtocolTest.importScript = function(scriptName)
 {
     var xhr = new XMLHttpRequest();
     var isAsyncRequest = false;
@@ -390,13 +405,3 @@ InspectorTest.importScript = function(scriptName)
     var script = "try { " + xhr.responseText + "} catch (e) { alert(" + JSON.stringify("Error in: " + scriptName) + "); throw e; }";
     window.eval(script);
 }
-
-window.addEventListener("message", function(event) {
-    try {
-        eval(event.data);
-    } catch (e) {
-        alert(e.stack);
-        InspectorTest.completeTest();
-        throw e;
-    }
-});
index 1464e01..ab5906b 100644 (file)
@@ -1,6 +1,6 @@
-InspectorTest.Console = {};
+ProtocolTest.Console = {};
 
-InspectorTest.Console.sanitizeConsoleMessage = function(messageObject)
+ProtocolTest.Console.sanitizeConsoleMessage = function(messageObject)
 {
     function basename(url)
     {
@@ -30,9 +30,9 @@ InspectorTest.Console.sanitizeConsoleMessage = function(messageObject)
     return obj;
 }
 
-InspectorTest.Console.addTestCase = function(suite, args)
+ProtocolTest.Console.addTestCase = function(suite, args)
 {
-    if (!(suite instanceof InspectorTest.AsyncTestSuite))
+    if (!(suite instanceof ProtocolTest.AsyncTestSuite))
         throw new Error("Console test cases must be added to an async test suite.");
 
     var {name, description, expression, expected} = args;
@@ -40,23 +40,23 @@ InspectorTest.Console.addTestCase = function(suite, args)
         name,
         description,
         test: function(resolve, reject) {
-            InspectorTest.awaitEvent({
+            InspectorProtocol.awaitEvent({
                 event: "Console.messageAdded",
             })
             .then(function(messageObject) {
                 var consoleMessage = messageObject.params.message;
                 var {source, level, text, parameters} = consoleMessage;
-                InspectorTest.assert(source === expected.source, "ConsoleMessage type should be '" + expected.source + "'.");
-                InspectorTest.assert(level === expected.level, "ConsoleMessage level should be '" + expected.level + "'.");
+                ProtocolTest.assert(source === expected.source, "ConsoleMessage type should be '" + expected.source + "'.");
+                ProtocolTest.assert(level === expected.level, "ConsoleMessage level should be '" + expected.level + "'.");
 
                 if (expected.text)
-                    InspectorTest.assert(text === expected.text, "ConsoleMessage text should be '" + expected.text + "'.");
+                    ProtocolTest.assert(text === expected.text, "ConsoleMessage text should be '" + expected.text + "'.");
 
                 if (expected.parameters) {
-                    InspectorTest.assert(parameters.length === expected.parameters.length, "ConsoleMessage parameters.length === " + expected.parameters.length);
+                    ProtocolTest.assert(parameters.length === expected.parameters.length, "ConsoleMessage parameters.length === " + expected.parameters.length);
                     for (var i = 0; i < parameters.length; ++i) {
                         var expectedType = expected.parameters[i];
-                        InspectorTest.assert(parameters[i].type === expectedType, "ConsoleMessage parameter " + i + " should have type '" + expectedType + "'.");
+                        ProtocolTest.assert(parameters[i].type === expectedType, "ConsoleMessage parameter " + i + " should have type '" + expectedType + "'.");
                     }
                 }
 
@@ -65,8 +65,8 @@ InspectorTest.Console.addTestCase = function(suite, args)
             .catch(reject);
 
             // Cause a messageAdded event to be generated.
-            InspectorTest.log("Evaluating expression: " + expression);
-            InspectorTest.sendCommand({
+            ProtocolTest.log("Evaluating expression: " + expression);
+            InspectorProtocol.sendCommand({
                 method: "Runtime.evaluate",
                 params: {expression}
             });
index 0e6d1c8..053f9f9 100644 (file)
@@ -1,6 +1,6 @@
-window.ProbeHelper = {};
+ProtocolTest.Probe = {};
 
-ProbeHelper.simplifiedProbeSample = function(messageObject)
+ProtocolTest.Probe.sanitizeProbeSample = function(messageObject)
 {
     var data = messageObject.params.sample;
     return {
@@ -11,7 +11,7 @@ ProbeHelper.simplifiedProbeSample = function(messageObject)
     };
 }
 
-ProbeHelper.stringifyProbeSample = function(ProbeSample)
+ProtocolTest.Probe.stringifyProbeSample = function(ProbeSample)
 {
     console.assert(ProbeSample instanceof WebInspector.ProbeSample, "Unexpected object type!");
     return JSON.stringify({
@@ -20,7 +20,7 @@ ProbeHelper.stringifyProbeSample = function(ProbeSample)
     });
 }
 
-ProbeHelper.installTracingListeners = function()
+ProtocolTest.Probe.installTracingListeners = function()
 {
     if (!WebInspector.debuggerManager || !WebInspector.probeManager)
         return;
index 31ae524..d9b2fe6 100644 (file)
@@ -14,11 +14,11 @@ function generateSimpleConsoleMessages()
 
 function test()
 {
-    InspectorTest.importScript("console-test.js");
+    ProtocolTest.importScript("console-test.js");
 
-    var suite = new InspectorTest.AsyncTestSuite("Console.MessagesFromCommandLineAPI");
+    var suite = new ProtocolTest.AsyncTestSuite("Console.MessagesFromCommandLineAPI");
 
-    InspectorTest.Console.addTestCase(suite, {
+    ProtocolTest.Console.addTestCase(suite, {
         name: "ConsoleLogString",
         description: "Test `console.log(\"log\")`",
         expression: 'console.log("log");',
@@ -30,7 +30,7 @@ function test()
         }
     });
 
-    InspectorTest.Console.addTestCase(suite, {
+    ProtocolTest.Console.addTestCase(suite, {
         name: "ConsoleInfoString",
         description: "Test `console.info(\"info\")`",
         expression: 'console.info("info");',
@@ -42,7 +42,7 @@ function test()
         }
     });
 
-    InspectorTest.Console.addTestCase(suite, {
+    ProtocolTest.Console.addTestCase(suite, {
         name: "ConsoleWarnString",
         description: "Test `console.warn(\"warn\")`",
         expression: 'console.warn("warn");',
@@ -54,7 +54,7 @@ function test()
         }
     });
 
-    InspectorTest.Console.addTestCase(suite, {
+    ProtocolTest.Console.addTestCase(suite, {
         name: "ConsoleErrorString",
         description: "Test `console.error(\"error\")`",
         expression: 'console.error("error");',
@@ -66,7 +66,7 @@ function test()
         }
     });
 
-    InspectorTest.Console.addTestCase(suite, {
+    ProtocolTest.Console.addTestCase(suite, {
         name: "ConsoleDebugString",
         description: "Test `console.debug(\"debug\")`",
         expression: 'console.debug("debug");',
@@ -78,7 +78,7 @@ function test()
         }
     });
 
-    InspectorTest.awaitCommand({
+    InspectorProtocol.awaitCommand({
         method: "Console.enable",
         params: {}
     })
@@ -88,8 +88,8 @@ function test()
     .catch(fatalError);
 
     function fatalError(e) {
-        InspectorTest.log("Test failed with fatal error: " + JSON.stringify(e));
-        InspectorTest.completeTest();
+        ProtocolTest.log("Test failed with fatal error: " + JSON.stringify(e));
+        ProtocolTest.completeTest();
     }
 }
 </script>
index 9163985..daaa0da 100644 (file)
@@ -15,34 +15,34 @@ div { * color: red; }
 <script>
 function test()
 {
-    InspectorTest.importScript("console-test.js");
+    ProtocolTest.importScript("console-test.js");
 
     var consoleMessageCount = 0;
     const expectedConsoleMessageCount = 7;
 
     // Due to the difficulty of testing inline style tags in a test case, this test
     // is a reference test that contains serialized Console.messageAdded event data.
-    InspectorTest.addEventListener({
+    InspectorProtocol.addEventListener({
         event: "Console.messageAdded",
         listener: function(messageObject) {
-            var message = InspectorTest.Console.sanitizeConsoleMessage(messageObject);
-            InspectorTest.log(JSON.stringify(message));
+            var message = ProtocolTest.Console.sanitizeConsoleMessage(messageObject);
+            ProtocolTest.log(JSON.stringify(message));
 
             if (++consoleMessageCount !== expectedConsoleMessageCount)
                 return;
 
-            InspectorTest.awaitCommand({
+            InspectorProtocol.awaitCommand({
                 method: "Console.disable",
                 params: {}
             })
             .then(function() {
-                InspectorTest.completeTest();
+                ProtocolTest.completeTest();
             });
         }
     });
 
     // Start the test.
-    InspectorTest.sendCommand({
+    InspectorProtocol.sendCommand({
         method: "Console.enable",
         params: {}
     });
index 4f714ff..630fd8c 100644 (file)
@@ -11,25 +11,25 @@ console.warn("warn 1"); console.error("error 1");
 <script>
 function test()
 {
-    InspectorTest.importScript("console-test.js");
+    ProtocolTest.importScript("console-test.js");
 
     var consoleMessageCount = 0;
     const expectedConsoleMessageCount = 8;
 
     // Due to the difficulty of testing inline script tags in a test case, this test
     // is a reference test that contains serialized Console.messageAdded event data.
-    InspectorTest.addEventListener({
+    InspectorProtocol.addEventListener({
         event: "Console.messageAdded",
         listener: function(messageObject) {
-            var message = InspectorTest.Console.sanitizeConsoleMessage(messageObject);
-            InspectorTest.log(JSON.stringify(message));
+            var message = ProtocolTest.Console.sanitizeConsoleMessage(messageObject);
+            ProtocolTest.log(JSON.stringify(message));
 
             if (++consoleMessageCount === expectedConsoleMessageCount)
-                InspectorTest.completeTest();
+                ProtocolTest.completeTest();
         }
     });
 
-    InspectorTest.sendCommand({
+    InspectorProtocol.sendCommand({
         method: "Console.enable",
         params: {}
     });
index 08845b6..f8be31a 100644 (file)
@@ -5,18 +5,18 @@
 <script>
 function test()
 {
-    InspectorTest.importScript("console-test.js");
+    ProtocolTest.importScript("console-test.js");
 
-    let suite = new InspectorTest.AsyncTestSuite("Console.XFrameOptionsMessages");
+    let suite = new ProtocolTest.AsyncTestSuite("Console.XFrameOptionsMessages");
 
-    InspectorTest.Console.addTestCase(suite, {
+    ProtocolTest.Console.addTestCase(suite, {
         name: "XFrameOptionsDeny",
         description: "Ensure that a console message is logged when enforcing an X-Frame-Options policy. In this case, setting X-Frame-Options: 'deny' means the iframe does not want to be embedded in the test page.",
         expression: "triggerXFrameOptionDeny();",
         expected: {source: 'security', level: 'error'}
     });
 
-    InspectorTest.awaitCommand({
+    InspectorProtocol.awaitCommand({
         method: "Console.enable",
         params: {}
     })
@@ -26,8 +26,8 @@ function test()
     .catch(fatalError);
 
     function fatalError(e) {
-        InspectorTest.log("Test failed with fatal error: " + JSON.stringify(e));
-        InspectorTest.completeTest();
+        ProtocolTest.log("Test failed with fatal error: " + JSON.stringify(e));
+        ProtocolTest.completeTest();
     }
 }
 </script>
index faaecf9..ae09c86 100644 (file)
@@ -4,25 +4,25 @@
 <script>
 function test()
 {
-    InspectorTest.sendCommand("CSS.getSupportedCSSProperties", {}, function(messageObject) {
+    InspectorProtocol.sendCommand("CSS.getSupportedCSSProperties", {}, function(messageObject) {
         if ("error" in messageObject)
-            InspectorTest.log(messageObject.error.message);
+            ProtocolTest.log(messageObject.error.message);
         else {
             var cssProperty = "box-shadow";
             var entries = messageObject["result"]["cssProperties"];
 
             for (var i = 0; i < entries.length; ++i) {
                 if (entries[i].name === cssProperty) {
-                    InspectorTest.log(entries[i].name + " is supported");
+                    ProtocolTest.log(entries[i].name + " is supported");
                     break;
                 }
             }
 
             if (i === entries.length)
-                InspectorTest.log(cssProperty + " is NOT supported");
+                ProtocolTest.log(cssProperty + " is NOT supported");
         }
 
-        InspectorTest.completeTest();
+        ProtocolTest.completeTest();
     });
 }
 </script>
index 8f0f091..5cde3d9 100644 (file)
@@ -21,10 +21,10 @@ function disconnect()
 
 function test()
 {
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
-            InspectorTest.log("Found breakpoint.js");
+            ProtocolTest.log("Found breakpoint.js");
             var breakpoint = {
                 location: {
                     scriptId: messageObject.params.scriptId,
@@ -38,18 +38,18 @@ function test()
                     ]
                 }
             };
-            InspectorTest.sendCommand("Debugger.setBreakpoint", breakpoint, InspectorTest.checkForError);
-            InspectorTest.sendCommand("Runtime.evaluate", {expression: "runBreakpointWithCondition()"});
+            InspectorProtocol.sendCommand("Debugger.setBreakpoint", breakpoint, InspectorProtocol.checkForError);
+            InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "runBreakpointWithCondition()"});
         }
     }
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
-        InspectorTest.log("FAIL: Paused in debugger: reason = \"" + messageObject.params.reason + "\"");
-        InspectorTest.completeTest();
+        ProtocolTest.log("FAIL: Paused in debugger: reason = \"" + messageObject.params.reason + "\"");
+        ProtocolTest.completeTest();
     }
 
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 }
 </script>
 </head>
index 810b416..6832108 100644 (file)
@@ -5,10 +5,10 @@
 <script>
 function test()
 {
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
-            InspectorTest.log("Found breakpoint.js");
+            ProtocolTest.log("Found breakpoint.js");
 
             var breakpoint = {
                 location: {
@@ -23,30 +23,30 @@ function test()
                     ]
                 }
             };
-            InspectorTest.sendCommand("Debugger.setBreakpoint", breakpoint, InspectorTest.checkForError);
-            InspectorTest.sendCommand("Debugger.setPauseOnExceptions", {state: "all"}, InspectorTest.checkForError);
-            InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(1,2)"}, function(messageObject) {
-                InspectorTest.checkForError(messageObject);
-                InspectorTest.log("PASS: Breakpoint action executed, but the exception did not cause the debugger to pause.")
+            InspectorProtocol.sendCommand("Debugger.setBreakpoint", breakpoint, InspectorProtocol.checkForError);
+            InspectorProtocol.sendCommand("Debugger.setPauseOnExceptions", {state: "all"}, InspectorProtocol.checkForError);
+            InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(1,2)"}, function(messageObject) {
+                InspectorProtocol.checkForError(messageObject);
+                ProtocolTest.log("PASS: Breakpoint action executed, but the exception did not cause the debugger to pause.")
                 completeTest();
             });
         }
     }
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
-        InspectorTest.log("FAIL: Paused in debugger: reason = \"" + messageObject.params.reason + "\"");
+        ProtocolTest.log("FAIL: Paused in debugger: reason = \"" + messageObject.params.reason + "\"");
         completeTest();
     }
 
     function completeTest()
     {
         // Reset the pauseOnException state before ending the test.
-        InspectorTest.sendCommand("Debugger.setPauseOnExceptions", {state: "none"});
-        InspectorTest.completeTest();
+        InspectorProtocol.sendCommand("Debugger.setPauseOnExceptions", {state: "none"});
+        ProtocolTest.completeTest();
     }
 
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 }
 </script>
 </head>
index 1a98403..8e395b5 100644 (file)
@@ -24,10 +24,10 @@ function disconnect()
 
 function test()
 {
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
-            InspectorTest.log("Found breakpoint.js");
+            ProtocolTest.log("Found breakpoint.js");
             var breakpoint = {
                 location: {
                     scriptId: messageObject.params.scriptId,
@@ -38,18 +38,18 @@ function test()
                     condition: "disconnect()"
                 }
             };
-            InspectorTest.sendCommand("Debugger.setBreakpoint", breakpoint, InspectorTest.checkForError);
-            InspectorTest.sendCommand("Runtime.evaluate", {expression: "runBreakpointWithCondition()"});
+            InspectorProtocol.sendCommand("Debugger.setBreakpoint", breakpoint, InspectorProtocol.checkForError);
+            InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "runBreakpointWithCondition()"});
         }
     }
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
-        InspectorTest.log("FAIL: Paused in debugger: reason = \"" + messageObject.params.reason + "\"");
-        InspectorTest.completeTest();
+        ProtocolTest.log("FAIL: Paused in debugger: reason = \"" + messageObject.params.reason + "\"");
+        ProtocolTest.completeTest();
     }
 
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 }
 </script>
 </head>
index 760d5ae..60a4d17 100644 (file)
@@ -5,10 +5,10 @@
 <script>
 function test()
 {
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
-            InspectorTest.log("Found breakpoint.js");
+            ProtocolTest.log("Found breakpoint.js");
             var breakpoint = {
                 location: {
                     scriptId: messageObject.params.scriptId,
@@ -23,27 +23,27 @@ function test()
                     ]
                 }
             };
-            InspectorTest.sendCommand("Debugger.setBreakpoint", breakpoint, InspectorTest.checkForError);
-            InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(1,2)"}, function() {
-                InspectorTest.log("PASS: The VM should not crash.");
+            InspectorProtocol.sendCommand("Debugger.setBreakpoint", breakpoint, InspectorProtocol.checkForError);
+            InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(1,2)"}, function() {
+                ProtocolTest.log("PASS: The VM should not crash.");
                 completeTest();
             });
         }
     }
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
-        InspectorTest.log("FAIL: Paused in debugger: reason = \"" + messageObject.params.reason + "\"");
+        ProtocolTest.log("FAIL: Paused in debugger: reason = \"" + messageObject.params.reason + "\"");
         completeTest();
     }
 
     function completeTest()
     {
         // Reset the pauseOnException state before ending the test.
-        InspectorTest.completeTest();
+        ProtocolTest.completeTest();
     }
 
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 }
 </script>
 </head>
index cf98546..1d9dad0 100644 (file)
@@ -5,10 +5,10 @@
 <script>
 function test()
 {
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
-            InspectorTest.log("Found breakpoint.js");
+            ProtocolTest.log("Found breakpoint.js");
             var breakpoint = {
                 location: {
                     scriptId: messageObject.params.scriptId,
@@ -23,29 +23,29 @@ function test()
                     ]
                 }
             };
-            InspectorTest.sendCommand("Debugger.setBreakpoint", breakpoint, InspectorTest.checkForError);
-            InspectorTest.sendCommand("Debugger.setPauseOnExceptions", {state: "all"}, InspectorTest.checkForError);
-            InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(1,2)"}, function() {
-                InspectorTest.log("PASS: The debugger should not pause on the exception inside the condition.");
+            InspectorProtocol.sendCommand("Debugger.setBreakpoint", breakpoint, InspectorProtocol.checkForError);
+            InspectorProtocol.sendCommand("Debugger.setPauseOnExceptions", {state: "all"}, InspectorProtocol.checkForError);
+            InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(1,2)"}, function() {
+                ProtocolTest.log("PASS: The debugger should not pause on the exception inside the condition.");
                 completeTest();
             });
         }
     }
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
-        InspectorTest.log("FAIL: Paused in debugger: reason = \"" + messageObject.params.reason + "\"");
+        ProtocolTest.log("FAIL: Paused in debugger: reason = \"" + messageObject.params.reason + "\"");
         completeTest();
     }
 
     function completeTest()
     {
         // Reset the pauseOnException state before ending the test.
-        InspectorTest.sendCommand("Debugger.setPauseOnExceptions", {state: "none"});
-        InspectorTest.completeTest();
+        InspectorProtocol.sendCommand("Debugger.setPauseOnExceptions", {state: "none"});
+        ProtocolTest.completeTest();
     }
 
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 }
 </script>
 </head>
index 77ce380..401bd50 100644 (file)
@@ -5,10 +5,10 @@
 <script>
 function test()
 {
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
-            InspectorTest.log("Found breakpoint.js");
+            ProtocolTest.log("Found breakpoint.js");
             var breakpoint = {
                 location: {
                     scriptId: messageObject.params.scriptId,
@@ -16,46 +16,46 @@ function test()
                     columnNumber: 0
                 }
             };
-            InspectorTest.sendCommand("Debugger.setBreakpoint", breakpoint, InspectorTest.checkForError);
-            InspectorTest.sendCommand("Debugger.setPauseOnExceptions", {state: "all"}, InspectorTest.checkForError);
-            InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointBasic()"}, function() {
+            InspectorProtocol.sendCommand("Debugger.setBreakpoint", breakpoint, InspectorProtocol.checkForError);
+            InspectorProtocol.sendCommand("Debugger.setPauseOnExceptions", {state: "all"}, InspectorProtocol.checkForError);
+            InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointBasic()"}, function() {
                 completeTest();
             });
         }
     }
 
-    InspectorTest.eventHandler["Debugger.paused"] = onBreakpointHit;
+    InspectorProtocol.eventHandler["Debugger.paused"] = onBreakpointHit;
 
     function onBreakpointHit(messageObject)
     {
-        InspectorTest.log("PASS: Paused in debugger: reason = \"" + messageObject.params.reason + "\"");
+        ProtocolTest.log("PASS: Paused in debugger: reason = \"" + messageObject.params.reason + "\"");
 
         // Make sure we do not pause again in the debugger.
-        InspectorTest.eventHandler["Debugger.paused"] = onPausedOnException;
+        InspectorProtocol.eventHandler["Debugger.paused"] = onPausedOnException;
 
-        InspectorTest.sendCommand("Runtime.evaluate", {expression: "this.should.trigger.an.exception"}, function(messageObject) {
-            InspectorTest.checkForError(messageObject);
-            InspectorTest.log("PASS: The debugger should not stop on the exception thrown by a console command while paused on a breakpoint.");
-            InspectorTest.sendCommand("Debugger.resume");
+        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "this.should.trigger.an.exception"}, function(messageObject) {
+            InspectorProtocol.checkForError(messageObject);
+            ProtocolTest.log("PASS: The debugger should not stop on the exception thrown by a console command while paused on a breakpoint.");
+            InspectorProtocol.sendCommand("Debugger.resume");
         });
     }
 
     function onPausedOnException(messageObject)
     {
-        InspectorTest.log("FAIL: Should not break on exceptions while paused on a breakpoint.");
+        ProtocolTest.log("FAIL: Should not break on exceptions while paused on a breakpoint.");
         completeTest();
     }
 
     function completeTest()
     {
-        // InspectorTest.sendCommand("Debugger.resume", {});
+        // InspectorProtocol.sendCommand("Debugger.resume", {});
         // Reset the pauseOnException state before ending the test.
-        InspectorTest.sendCommand("Debugger.setPauseOnExceptions", {state: "none"});
-        InspectorTest.sendCommand("Debugger.disable");
-        InspectorTest.completeTest();
+        InspectorProtocol.sendCommand("Debugger.setPauseOnExceptions", {state: "none"});
+        InspectorProtocol.sendCommand("Debugger.disable");
+        ProtocolTest.completeTest();
     }
 
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 }
 </script>
 </head>
index e844db2..c7d6262 100644 (file)
@@ -5,10 +5,10 @@
 <script>
 function test()
 {
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
-            InspectorTest.log("Found breakpoint.js");
+            ProtocolTest.log("Found breakpoint.js");
 
             var breakpoint = {
                 location: {
@@ -35,31 +35,31 @@ function test()
                 }
             };
 
-            InspectorTest.sendCommand("Debugger.setBreakpoint", breakpoint, InspectorTest.checkForError);
-            InspectorTest.sendCommand("Debugger.setBreakpoint", breakpointInsideConditonAndAction, InspectorTest.checkForError);
-            InspectorTest.sendCommand("Debugger.setPauseOnExceptions", {state: "all"}, InspectorTest.checkForError);
-            InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(1,2)"}, function(messageObject) {
-                InspectorTest.checkForError(messageObject);
-                InspectorTest.log("PASS: Breakpoint condition and action executed, but the exception did not cause the debugger to pause.")
+            InspectorProtocol.sendCommand("Debugger.setBreakpoint", breakpoint, InspectorProtocol.checkForError);
+            InspectorProtocol.sendCommand("Debugger.setBreakpoint", breakpointInsideConditonAndAction, InspectorProtocol.checkForError);
+            InspectorProtocol.sendCommand("Debugger.setPauseOnExceptions", {state: "all"}, InspectorProtocol.checkForError);
+            InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(1,2)"}, function(messageObject) {
+                InspectorProtocol.checkForError(messageObject);
+                ProtocolTest.log("PASS: Breakpoint condition and action executed, but the exception did not cause the debugger to pause.")
                 completeTest();
             });
         }
     }
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
-        InspectorTest.log("FAIL: Paused in debugger: reason = \"" + messageObject.params.reason + "\"");
+        ProtocolTest.log("FAIL: Paused in debugger: reason = \"" + messageObject.params.reason + "\"");
         completeTest();
     }
 
     function completeTest()
     {
         // Reset the pauseOnException state before ending the test.
-        InspectorTest.sendCommand("Debugger.setPauseOnExceptions", {state: "none"});
-        InspectorTest.completeTest();
+        InspectorProtocol.sendCommand("Debugger.setPauseOnExceptions", {state: "none"});
+        ProtocolTest.completeTest();
     }
 
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 }
 </script>
 </head>
index 3dc4eab..dc96b5b 100644 (file)
@@ -11,26 +11,26 @@ function test()
     // We set a breakpoint before evaluating 'sum += ...', and verify that
     // call frame functionNames are what we expect.
 
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/call-frame-function-name\.html$/.test(messageObject.params.url) && messageObject.params.startLine > 10) {
-            InspectorTest.log("Found <script>");
+            ProtocolTest.log("Found <script>");
             var scriptIdentifier = messageObject.params.scriptId;
             var lineNumber = messageObject.params.startLine + 6;
             var columnNumber = 12;
             var location = {scriptId: scriptIdentifier, lineNumber: lineNumber, columnNumber: columnNumber};
-            InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location}, function() {
-                InspectorTest.log("Running testFunction");
-                InspectorTest.sendCommand("Runtime.evaluate", {expression: "testFunction()"});
+            InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location}, function() {
+                ProtocolTest.log("Running testFunction");
+                InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "testFunction()"});
             });
         }
     }
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
-        InspectorTest.log("Hit Breakpoint!");
+        ProtocolTest.log("Hit Breakpoint!");
         var functionNames = [ ];
         var i;
         for (i = 0; i < 3; i++)
@@ -38,9 +38,9 @@ function test()
         
         function assertFunctionName(index, actual, expected) {
             if (actual == expected)
-                InspectorTest.log('PASS: frame[' + index + '] "' + actual + '"');
+                ProtocolTest.log('PASS: frame[' + index + '] "' + actual + '"');
             else
-                InspectorTest.log('FAIL: frame[' + index + '] expect "' + expected + '", actual "' + actual + '"');
+                ProtocolTest.log('FAIL: frame[' + index + '] expect "' + expected + '", actual "' + actual + '"');
         }
 
         // frame 0 should be the anonymous inner function.
@@ -52,7 +52,7 @@ function test()
         // frame 2 should be "testFunction".
         assertFunctionName(2, functionNames[2], "testFunction");
 
-        InspectorTest.completeTest();
+        ProtocolTest.completeTest();
     }
 }
 </script>
index 590854c..5aff054 100644 (file)
@@ -11,26 +11,26 @@ function test()
     // We set a breakpoint before evaluating 'sum += ...', and verify that
     // call frame this values are what we expect.
 
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/call-frame-this-host\.html$/.test(messageObject.params.url) && messageObject.params.startLine > 10) {
-            InspectorTest.log("Found <script>");
+            ProtocolTest.log("Found <script>");
             var scriptIdentifier = messageObject.params.scriptId;
             var lineNumber = messageObject.params.startLine + 6;
             var columnNumber = 12;
             var location = {scriptId: scriptIdentifier, lineNumber: lineNumber, columnNumber: columnNumber};
-            InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location}, function() {
-                InspectorTest.log("Running testFunction");
-                InspectorTest.sendCommand("Runtime.evaluate", {expression: "testFunction()"});
+            InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location}, function() {
+                ProtocolTest.log("Running testFunction");
+                InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "testFunction()"});
             });
         }
     }
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
-        InspectorTest.log("Hit Breakpoint!");
+        ProtocolTest.log("Hit Breakpoint!");
         var thisValues = [ ];
         var i;
         for (i = 0; i < 3; i++)
@@ -39,17 +39,17 @@ function test()
         function assertThisValue(index, actual, expected) {
             var success = true;
             if (actual.type != expected.type) {
-                InspectorTest.log('FAIL: frame[' + index + '] expect type "' + expected.type + '", actual "' + actual.type + '"');
+                ProtocolTest.log('FAIL: frame[' + index + '] expect type "' + expected.type + '", actual "' + actual.type + '"');
                 success = false;
             }
 
             if (actual.className != expected.className) {
-                InspectorTest.log('FAIL: frame[' + index + '] expect className "' + expected.className + '", actual "' + actual.className + '"');
+                ProtocolTest.log('FAIL: frame[' + index + '] expect className "' + expected.className + '", actual "' + actual.className + '"');
                 success = false;
             }
 
             if (success)
-                InspectorTest.log('PASS: frame[' + index + '] type "' + actual.type + '" className "' + actual.className + '"');
+                ProtocolTest.log('PASS: frame[' + index + '] type "' + actual.type + '" className "' + actual.className + '"');
         }
 
         // frame 0 should be the anonymous inner function.
@@ -69,7 +69,7 @@ function test()
             "type": "object",
             "className": "Window"
         });
-        InspectorTest.completeTest();
+        ProtocolTest.completeTest();
     }
 }
 </script>
index cc15824..1df0340 100644 (file)
@@ -11,42 +11,42 @@ function test()
     // We set a breakpoint before evaluating 'sum += ...', and verify that
     // call frame this values are what we expect.
 
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/call-frame-this-nonstrict\.html$/.test(messageObject.params.url) && messageObject.params.startLine > 10) {
-            InspectorTest.log("Found <script>");
+            ProtocolTest.log("Found <script>");
             var scriptIdentifier = messageObject.params.scriptId;
             var lineNumber = messageObject.params.startLine + 3;
             var columnNumber = 4;
             var location = {scriptId: scriptIdentifier, lineNumber: lineNumber, columnNumber: columnNumber};
-            InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location}, function() {
-                InspectorTest.log("Running testFunction");
-                InspectorTest.sendCommand("Runtime.evaluate", {expression: "testFunction()"});
+            InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location}, function() {
+                ProtocolTest.log("Running testFunction");
+                InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "testFunction()"});
             });
         }
     }
 
     var step = 0;
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
         function assertThisValue(step, actual, expected) {
             var success = true;
             if (actual.type != expected.type) {
-                InspectorTest.log('FAIL: step ' + step + ': expect type "' + expected.type + '", actual "' + actual.type + '"');
+                ProtocolTest.log('FAIL: step ' + step + ': expect type "' + expected.type + '", actual "' + actual.type + '"');
                 success = false;
             }
 
             if (actual.className != expected.className) {
                 var actualResult
-                InspectorTest.log('FAIL: step ' + step + ': expect className "' + expected.className + '", actual "' + actual.className + '"');
+                ProtocolTest.log('FAIL: step ' + step + ': expect className "' + expected.className + '", actual "' + actual.className + '"');
                 success = false;
             }
 
             if (success)
-                InspectorTest.log('PASS: step ' + step + ': type "' + actual.type + '" className "' + actual.className + '"');
+                ProtocolTest.log('PASS: step ' + step + ': type "' + actual.type + '" className "' + actual.className + '"');
         }
 
         switch (step) {
@@ -92,9 +92,9 @@ function test()
             });
             break;
         }
-        InspectorTest.sendCommand("Debugger.resume", {});
+        InspectorProtocol.sendCommand("Debugger.resume", {});
         if (step == 5)
-            InspectorTest.completeTest();
+            ProtocolTest.completeTest();
         step++;
     }
 }
index f5b7eb1..bcb2c54 100644 (file)
@@ -11,49 +11,49 @@ function test()
     // We set a breakpoint before evaluating 'sum += ...', and verify that
     // call frame this values are what we expect.
 
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/call-frame-this-strict\.html$/.test(messageObject.params.url) && messageObject.params.startLine > 10) {
-            InspectorTest.log("Found <script>");
+            ProtocolTest.log("Found <script>");
             var scriptIdentifier = messageObject.params.scriptId;
             var lineNumber = messageObject.params.startLine + 3;
             var columnNumber = 4;
             var location = {scriptId: scriptIdentifier, lineNumber: lineNumber, columnNumber: columnNumber};
-            InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location}, function() {
-                InspectorTest.log("Running testFunction");
-                InspectorTest.sendCommand("Runtime.evaluate", {expression: "testFunction()"});
+            InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location}, function() {
+                ProtocolTest.log("Running testFunction");
+                InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "testFunction()"});
             });
         }
     }
 
     var step = 0;
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
         function assertThisValue(step, actual, expected) {
             var success = true;
             if (actual.type != expected.type) {
-                InspectorTest.log('FAIL: step ' + step + ': expect type "' + expected.type + '", actual "' + actual.type + '"');
+                ProtocolTest.log('FAIL: step ' + step + ': expect type "' + expected.type + '", actual "' + actual.type + '"');
                 success = false;
             }
 
             if (actual.type != "undefined") {
                 if (typeof actual.value != typeof expected.value) {
-                    InspectorTest.log('FAIL: step ' + step + ': expect value type "' + typeof expected.value + '", actual "' + typeof actual.value + '"');
+                    ProtocolTest.log('FAIL: step ' + step + ': expect value type "' + typeof expected.value + '", actual "' + typeof actual.value + '"');
                     success = false;
                 }
 
                 if (actual.value != expected.value) {
                     var actualResult
-                    InspectorTest.log('FAIL: step ' + step + ': expect value "' + expected.value + '", actual "' + actual.value + '"');
+                    ProtocolTest.log('FAIL: step ' + step + ': expect value "' + expected.value + '", actual "' + actual.value + '"');
                     success = false;
                 }
             }
 
             if (success)
-                InspectorTest.log('PASS: step ' + step + ': type "' + actual.type + '" value "' + actual.value + '"');
+                ProtocolTest.log('PASS: step ' + step + ': type "' + actual.type + '" value "' + actual.value + '"');
         }
 
         switch (step) {
@@ -97,9 +97,9 @@ function test()
             });
             break;
         }
-        InspectorTest.sendCommand("Debugger.resume", {});
+        InspectorProtocol.sendCommand("Debugger.resume", {});
         if (step == 5)
-            InspectorTest.completeTest();
+            ProtocolTest.completeTest();
         step++;
     }
 }
index 2430242..16c4fd6 100644 (file)
@@ -12,30 +12,30 @@ function test()
     // This test setting 2 breakpoints in DFG compiled functions: one inlined,
     // and one not inlined.
 
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 
     var breakpointFound = false;
 
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
-            InspectorTest.log("Found breakpoint.js");
+            ProtocolTest.log("Found breakpoint.js");
 
-            InspectorTest.sendCommand("Runtime.evaluate", {
+            InspectorProtocol.sendCommand("Runtime.evaluate", {
                 expression: "debuggerStatement();"
             }, function(responseObject) {
                 if (breakpointFound)
-                    InspectorTest.log("PASS");
-                InspectorTest.completeTest();
+                    ProtocolTest.log("PASS");
+                ProtocolTest.completeTest();
             });
         }
     }
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
-        InspectorTest.log("Broke at debugger statement\n");
+        ProtocolTest.log("Broke at debugger statement\n");
         breakpointFound = true;
-        InspectorTest.sendCommand("Debugger.resume", {});
+        InspectorProtocol.sendCommand("Debugger.resume", {});
     }
 }
 </script>
index 022ac02..b3bf1d1 100644 (file)
@@ -5,9 +5,9 @@
 <script>
 function test()
 {
-    InspectorTest.importScript("probe-test.js");
+    ProtocolTest.importScript("probe-test.js");
 
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 
     var samples = [];
     const expectedSampleCount = 4;
@@ -18,7 +18,7 @@ function test()
 
     function dumpSamples() {
         for (var i = 0; i < samples.length; i++)
-            InspectorTest.log("Sample " + (i + 1) + ": " + JSON.stringify(samples[i]));
+            ProtocolTest.log("Sample " + (i + 1) + ": " + JSON.stringify(samples[i]));
     }
 
     var tests = [
@@ -45,10 +45,10 @@ function test()
         },
     ];
 
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
-            InspectorTest.log("Found breakpoint.js");
+            ProtocolTest.log("Found breakpoint.js");
             var scriptIdentifier = messageObject.params.scriptId;
             var location = {scriptId: scriptIdentifier, lineNumber: 18, columnNumber: 0};
             var options = {
@@ -59,30 +59,30 @@ function test()
                 ]
             };
 
-            InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location, options: options}, function(responseObject) {
-                InspectorTest.checkForError(responseObject);
+            InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location, options: options}, function(responseObject) {
+                InspectorProtocol.checkForError(responseObject);
 
-                InspectorTest.log("Running breakpointActions to trigger probe samples.");
-                InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointActions(12, {x:1,y:2})"});
-                InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointActions(12, {x:1,y:2})"});
+                ProtocolTest.log("Running breakpointActions to trigger probe samples.");
+                InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointActions(12, {x:1,y:2})"});
+                InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointActions(12, {x:1,y:2})"});
             });
         }
     }
 
-    InspectorTest.eventHandler["Debugger.didSampleProbe"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.didSampleProbe"] = function(messageObject)
     {
-        var sample = ProbeHelper.simplifiedProbeSample(messageObject);
+        var sample = ProtocolTest.Probe.sanitizeProbeSample(messageObject);
         samples.push(sample);
-        InspectorTest.log("Received probe sample payload: " + JSON.stringify(sample.payload));
+        ProtocolTest.log("Received probe sample payload: " + JSON.stringify(sample.payload));
 
         if (receivedAllExpectedSamples()) {
             tests.forEach(function(test) {
                 var result = test.predicate();
-                InspectorTest.assert(result, test.message);
+                ProtocolTest.assert(result, test.message);
                 if (!result)
                     test.error();
             });
-            InspectorTest.completeTest();
+            ProtocolTest.completeTest();
         }
     }
 }
index d2d55c4..4a86c58 100644 (file)
@@ -5,32 +5,32 @@
 <script>
 function test()
 {
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
-            InspectorTest.log("Found breakpoint.js");
+            ProtocolTest.log("Found breakpoint.js");
             var scriptIdentifier = messageObject.params.scriptId;
             var location = {scriptId: scriptIdentifier, lineNumber: 18, columnNumber: 0};
             var options = {
                 condition: "a > 10",
             };
-            InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location, options: options}, function(responseObject) {
-                InspectorTest.checkForError(responseObject);
+            InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location, options: options}, function(responseObject) {
+                InspectorProtocol.checkForError(responseObject);
                 // Should NOT hit breakpoint (a < 10).
-                InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointActions(2, {x:1,y:2})"});
+                InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointActions(2, {x:1,y:2})"});
                 // Should hit breakpoint (a > 10).
-                InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointActions(12, {x:1,y:2})"});
+                InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointActions(12, {x:1,y:2})"});
             });
         }
     }
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
-        InspectorTest.log("Hit Breakpoint!");
-        InspectorTest.log("PASS");
-        InspectorTest.completeTest();
+        ProtocolTest.log("Hit Breakpoint!");
+        ProtocolTest.log("PASS");
+        ProtocolTest.completeTest();
     }
 
 }
index 6f18bdc..7788250 100644 (file)
@@ -8,40 +8,40 @@ function test()
     function testFunction() {
         // This function runs in the second inspector window. We can use this one to debug the first inspector.
 
-        InspectorTest.sendCommand("Debugger.enable", {});
-        InspectorTest.sendCommand("Debugger.setPauseOnExceptions", {state: "all"}, function(responseObject) {
-            InspectorTest.checkForError(responseObject);
-            InspectorTest.log("Debugger.setPauseOnExceptions - all");
+        InspectorProtocol.sendCommand("Debugger.enable", {});
+        InspectorProtocol.sendCommand("Debugger.setPauseOnExceptions", {state: "all"}, function(responseObject) {
+            InspectorProtocol.checkForError(responseObject);
+            ProtocolTest.log("Debugger.setPauseOnExceptions - all");
 
             // Trigger an exception in the main inspector.
-            InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { throw new Error('PASS: Expected exception') }, 0);"});
+            InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { throw new Error('PASS: Expected exception') }, 0);"});
         });
 
-        InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+        InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
         {
-            InspectorTest.log("PASS: Paused!");
-            InspectorTest.sendCommand("Debugger.resume", {});
+            ProtocolTest.log("PASS: Paused!");
+            InspectorProtocol.sendCommand("Debugger.resume", {});
         }
 
-        InspectorTest.eventHandler["Debugger.resumed"] = function(messageObject)
+        InspectorProtocol.eventHandler["Debugger.resumed"] = function(messageObject)
         {
-            InspectorTest.log("PASS: Resumed!");
+            ProtocolTest.log("PASS: Resumed!");
 
             // Revert Debugger.setPauseOnExceptions as it can have an impact on the following tests.
-            InspectorTest.sendCommand("Debugger.setPauseOnExceptions", {state: "none"}, function(responseObject) {
-                InspectorTest.completeTest();
+            InspectorProtocol.sendCommand("Debugger.setPauseOnExceptions", {state: "none"}, function(responseObject) {
+                ProtocolTest.completeTest();
             });
         }
     };
 
-    window.log = InspectorTest.log.bind(InspectorTest);
+    window.log = ProtocolTest.log.bind(InspectorProtocol);
     window.closeTest = function()
     {
         window.internals.closeDummyInspectorFrontend();
-        InspectorTest.completeTest();
+        ProtocolTest.completeTest();
     }
 
-    var secondInspectorFrontend = window.internals.openDummyInspectorFrontend("ProtocolTestStub.html");
+    var secondInspectorFrontend = window.internals.openDummyInspectorFrontend("InspectorProtocolStub.html");
     secondInspectorFrontend.addEventListener("load", function(event) {
         secondInspectorFrontend.postMessage("(" + testFunction.toString() +")();", "*");
     });
index 96fbda8..dde9f0f 100644 (file)
@@ -18,7 +18,7 @@ function test()
     var workerRequestId = 1;
     function sendCommandToWorker(method, params)
     {
-        InspectorTest.sendCommand("Worker.sendMessageToWorker", {
+        InspectorProtocol.sendCommand("Worker.sendMessageToWorker", {
             "workerId": workerId,
             "message": {
                 "method": method,
@@ -28,31 +28,31 @@ function test()
         });
     }
 
-    InspectorTest.sendCommand("Worker.enable", {}, function(messageObject) {
+    InspectorProtocol.sendCommand("Worker.enable", {}, function(messageObject) {
         if ("error" in messageObject) {
-            InspectorTest.log("FAIL: Couldn't enable worker debugger: " + messageObject.error.message);
-            InspectorTest.completeTest();
+            ProtocolTest.log("FAIL: Couldn't enable worker debugger: " + messageObject.error.message);
+            ProtocolTest.completeTest();
         }
     });
 
-    InspectorTest.eventHandler["Worker.workerCreated"] = function(messageObject)
+    InspectorProtocol.eventHandler["Worker.workerCreated"] = function(messageObject)
     {
         workerId = messageObject["params"]["workerId"];
-        InspectorTest.log("Worker created");
-        InspectorTest.sendCommand("Worker.connectToWorker", { "workerId": workerId }, function(messageObject) {
-            InspectorTest.log("didConnectToWorker");
+        ProtocolTest.log("Worker created");
+        InspectorProtocol.sendCommand("Worker.connectToWorker", { "workerId": workerId }, function(messageObject) {
+            ProtocolTest.log("didConnectToWorker");
             sendCommandToWorker("Debugger.enable", {});
             sendCommandToWorker("Debugger.pause", {});
         });
     }
 
-    InspectorTest.eventHandler["Worker.dispatchMessageFromWorker"] = function(messageObject)
+    InspectorProtocol.eventHandler["Worker.dispatchMessageFromWorker"] = function(messageObject)
     {
         var message = messageObject["params"]["message"];
         if (message["method"] === "Debugger.paused") {
-            InspectorTest.log("SUCCESS: Worker paused");
+            ProtocolTest.log("SUCCESS: Worker paused");
             sendCommandToWorker("Debugger.disable", {});
-            InspectorTest.completeTest();
+            ProtocolTest.completeTest();
         }
     }
 }
index 9a8a4ce..412abb1 100644 (file)
@@ -5,8 +5,8 @@
 <script>
 function test()
 {
-    InspectorTest.sendCommand("Debugger.enable", {});
-    InspectorTest.sendCommand("Debugger.setPauseOnExceptions", {state: "all"}, InspectorTest.checkForError);
+    InspectorProtocol.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.setPauseOnExceptions", {state: "all"}, InspectorProtocol.checkForError);
 
     var step = null;
     var steps = [
@@ -42,29 +42,29 @@ function test()
         },
     ];
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
         if (step.pause)
-            InspectorTest.log("PASS: Paused!");
+            ProtocolTest.log("PASS: Paused!");
         else
-            InspectorTest.log("FAIL: Paused when unexpected");
+            ProtocolTest.log("FAIL: Paused when unexpected");
 
-        InspectorTest.sendCommand("Debugger.resume", {}, runNextStep);
+        InspectorProtocol.sendCommand("Debugger.resume", {}, runNextStep);
     }
 
     function runNextStep() {
         step = steps.shift();
         if (!step) {
-            InspectorTest.completeTest();
+            ProtocolTest.completeTest();
             return;
         }
 
         // Evalute the command inside a setTimeout so that we can hit exceptions and break.
         // Otherwise, evaluating through RuntimeAgent will not trigger a pause.
         // Likewise, if no pause is expected wait for a bit before continuing.
-        InspectorTest.log(step.message);
-        InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function(){" + step.evaluate + "}, 0)"}, function(responseObject) {
-            InspectorTest.checkForError(responseObject);
+        ProtocolTest.log(step.message);
+        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function(){" + step.evaluate + "}, 0)"}, function(responseObject) {
+            InspectorProtocol.checkForError(responseObject);
             if (!step.pause)
                 setTimeout(runNextStep, 20);
         });
index e9120e0..7b008eb 100644 (file)
@@ -24,27 +24,27 @@ function test()
         // Evaluate statement and expect to pause.
         if (testIndex < statementsWithUncaughtExceptions.length) {
             var statement = statementsWithUncaughtExceptions[testIndex++];
-            InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { " + statement + " }, 0);"});
+            InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { " + statement + " }, 0);"});
             return;
         }
 
         // Done evaluating statements to pause. Evaluate some more we do not expect to pause.
-        InspectorTest.log("PASS - paused for each uncaught exception");
-        InspectorTest.completeTest();
+        ProtocolTest.log("PASS - paused for each uncaught exception");
+        ProtocolTest.completeTest();
     }
 
-    InspectorTest.sendCommand("Debugger.enable", {});
-    InspectorTest.sendCommand("Debugger.setPauseOnExceptions", {state: "uncaught"}, function(responseObject) {
-        InspectorTest.checkForError(responseObject);
+    InspectorProtocol.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.setPauseOnExceptions", {state: "uncaught"}, function(responseObject) {
+        InspectorProtocol.checkForError(responseObject);
         expectPause = true;
         triggerNextUncaughtException();
     });
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
         if (!expectPause) {
-            InspectorTest.log("FAIL - debugger paused when we did not expect to");
-            InspectorTest.completeTest();
+            ProtocolTest.log("FAIL - debugger paused when we did not expect to");
+            ProtocolTest.completeTest();
             return;
         }
 
@@ -52,15 +52,15 @@ function test()
             console.log("[" + testIndex + "] Testing statement '" + statementsWithUncaughtExceptions[testIndex - 1] + "'");
             console.log("[" + testIndex + "] Paused and about to step");
             isStepping = true;
-            InspectorTest.sendCommand("Debugger.stepOver", {});
+            InspectorProtocol.sendCommand("Debugger.stepOver", {});
         } else {
             console.log("[" + testIndex + "] Paused after stepping");
             isStepping = false;
-            InspectorTest.sendCommand("Debugger.resume", {});
+            InspectorProtocol.sendCommand("Debugger.resume", {});
         }
     }
 
-    InspectorTest.eventHandler["Debugger.resumed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.resumed"] = function(messageObject)
     {
         console.log("[" + testIndex + "] Resumed");
         if (!isStepping)
index 73c860d..1dd10c7 100644 (file)
@@ -5,48 +5,48 @@
 <script>
 function test()
 {
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 
     var breakpointTriggered = 0;
 
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
-            InspectorTest.log("Found breakpoint.js");
+            ProtocolTest.log("Found breakpoint.js");
             var scriptIdentifier = messageObject.params.scriptId;
             var location = {scriptId: scriptIdentifier, lineNumber: 3, columnNumber: 0};
-            InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location}, function(responseObject) {
-                InspectorTest.checkForError(responseObject);
-                InspectorTest.log("Set Breakpoint, Triggering it");
+            InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location}, function(responseObject) {
+                InspectorProtocol.checkForError(responseObject);
+                ProtocolTest.log("Set Breakpoint, Triggering it");
                 breakpointIdentifier = responseObject.result.breakpointId;
-                InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointBasic()"});
+                InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointBasic()"});
             });
         }
     }
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
-        InspectorTest.log("Hit Breakpoint!");
+        ProtocolTest.log("Hit Breakpoint!");
         ++breakpointTriggered;
 
         if (breakpointTriggered === 1)
-            InspectorTest.sendCommand("Debugger.resume", {});
+            InspectorProtocol.sendCommand("Debugger.resume", {});
         else {
-            InspectorTest.log("FAIL: should not have hit breakpoint after it was removed.");
-            InspectorTest.completeTest();
+            ProtocolTest.log("FAIL: should not have hit breakpoint after it was removed.");
+            ProtocolTest.completeTest();
         }
     }
 
-    InspectorTest.eventHandler["Debugger.resumed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.resumed"] = function(messageObject)
     {
-        InspectorTest.log("Resumed, Removing Breakpoint and trying to trigger it again");
-        InspectorTest.sendCommand("Debugger.removeBreakpoint", {"breakpointId": breakpointIdentifier}, function(responseObject) {
-            InspectorTest.checkForError(responseObject);
-            InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointBasic()"}, function(responseObject) {
-                InspectorTest.checkForError(responseObject);
+        ProtocolTest.log("Resumed, Removing Breakpoint and trying to trigger it again");
+        InspectorProtocol.sendCommand("Debugger.removeBreakpoint", {"breakpointId": breakpointIdentifier}, function(responseObject) {
+            InspectorProtocol.checkForError(responseObject);
+            InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointBasic()"}, function(responseObject) {
+                InspectorProtocol.checkForError(responseObject);
                 setTimeout(function() {
-                    InspectorTest.log("PASS: did not hit breakpoint after removing it.");
-                    InspectorTest.completeTest();
+                    ProtocolTest.log("PASS: did not hit breakpoint after removing it.");
+                    ProtocolTest.completeTest();
                 }, 50);
             });
         });
index d995dfc..3f726c8 100644 (file)
@@ -13,12 +13,12 @@ function test()
 
     var testResults = [];
 
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/-linebreaks\.js$/.test(messageObject.params.url)) {
-            InspectorTest.sendCommand("Debugger.searchInContent", {"scriptId": messageObject.params.scriptId, "query": "test"}, function(url, messageObject) {
+            InspectorProtocol.sendCommand("Debugger.searchInContent", {"scriptId": messageObject.params.scriptId, "query": "test"}, function(url, messageObject) {
                 var results = messageObject.result.result;
 
                 var testResult = {url: url, count: results.length, matches: []};
@@ -42,21 +42,21 @@ function test()
 
         var sortedTestResults = testResults.sort(compareResultURLs);
 
-        InspectorTest.log("Scripts searched: " + sortedTestResults.length);
-        InspectorTest.log("");
+        ProtocolTest.log("Scripts searched: " + sortedTestResults.length);
+        ProtocolTest.log("");
 
         for (var testResult of sortedTestResults) {
             var fileName = /([\w-]+\.js)$/.exec(testResult.url)[1];
-            InspectorTest.log("Script: " + fileName);
-            InspectorTest.log("Results found: " + testResult.count);
+            ProtocolTest.log("Script: " + fileName);
+            ProtocolTest.log("Results found: " + testResult.count);
     
             for (var match of testResult.matches)
-                InspectorTest.log("Line " + match.lineNumber + ": " + JSON.stringify(match.lineContent));    
+                ProtocolTest.log("Line " + match.lineNumber + ": " + JSON.stringify(match.lineContent));    
 
-            InspectorTest.log("");
+            ProtocolTest.log("");
         }
 
-        InspectorTest.completeTest();
+        ProtocolTest.completeTest();
     }
 }
 </script>
index 7fa2c43..4ad4bf3 100644 (file)
@@ -5,11 +5,11 @@
 <script>
 function test()
 {
-    InspectorTest.importScript("console-test.js");
-    InspectorTest.importScript("probe-test.js");
+    ProtocolTest.importScript("console-test.js");
+    ProtocolTest.importScript("probe-test.js");
 
-    InspectorTest.sendCommand("Console.enable", {});
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Console.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 
     var isExpectingLogs = false;
     var isExpectingSounds = false;
@@ -25,10 +25,10 @@ function test()
         return logCount === expectedLogCount && sampleCount === expectedSampleCount && soundCount === expectedSoundCount;
     }
 
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
-            InspectorTest.log("Found breakpoint.js");
+            ProtocolTest.log("Found breakpoint.js");
             var scriptIdentifier = messageObject.params.scriptId;
             var location = {scriptId: scriptIdentifier, lineNumber: 18, columnNumber: 0};
             var options = {
@@ -43,81 +43,81 @@ function test()
                 ]
             };
 
-            InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location, options: options}, function(responseObject) {
-                InspectorTest.checkForError(responseObject);
+            InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location, options: options}, function(responseObject) {
+                InspectorProtocol.checkForError(responseObject);
                 breakpointIdentifier = responseObject.result.breakpointId;
-                InspectorTest.log("Running breakpointActions a few times that should not trigger");
-                InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointActions(1)"});
-                InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointActions(2, 12)"});
-                InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointActions(2, {x:1,y:2})"}, function() {
+                ProtocolTest.log("Running breakpointActions a few times that should not trigger");
+                InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointActions(1)"});
+                InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointActions(2, 12)"});
+                InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointActions(2, {x:1,y:2})"}, function() {
                     isExpectingLogs = true;
                     isExpectingSounds = true;
                     isExpectingSamples = true;
-                    InspectorTest.log("Running breakpointActions to triggering the breakpoint actions");
-                    InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointActions(12, {x:1,y:2})"}, function() {
-                        InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointActions(100, document.body)"});
+                    ProtocolTest.log("Running breakpointActions to triggering the breakpoint actions");
+                    InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointActions(12, {x:1,y:2})"}, function() {
+                        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointActions(100, document.body)"});
                     });
                 });
             });
         }
     }
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
-        InspectorTest.log("Hit Breakpoint!");
+        ProtocolTest.log("Hit Breakpoint!");
 
-        InspectorTest.log("FAIL: should not have hit breakpoint, autoContinue was true");
-        InspectorTest.completeTest();
+        ProtocolTest.log("FAIL: should not have hit breakpoint, autoContinue was true");
+        ProtocolTest.completeTest();
     }
 
-    InspectorTest.eventHandler["Debugger.playBreakpointActionSound"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.playBreakpointActionSound"] = function(messageObject)
     {
         if (!isExpectingSounds) {
-            InspectorTest.log("FAIL: unexpected breakpoint sound.");
-            InspectorTest.completeTest();
+            ProtocolTest.log("FAIL: unexpected breakpoint sound.");
+            ProtocolTest.completeTest();
             return;
         }
 
-        InspectorTest.log("PASS: Breakpoint Sound");
+        ProtocolTest.log("PASS: Breakpoint Sound");
 
         ++soundCount;
 
         if (receivedAllExpectedOutput())
-            InspectorTest.completeTest();
+            ProtocolTest.completeTest();
     }
 
-    InspectorTest.eventHandler["Debugger.didSampleProbe"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.didSampleProbe"] = function(messageObject)
     {
         if (!isExpectingSamples) {
-            InspectorTest.log("FAIL: unexpected probe sample, probe samples should only have come from breakpoint actions.");
-            InspectorTest.completeTest();
+            ProtocolTest.log("FAIL: unexpected probe sample, probe samples should only have come from breakpoint actions.");
+            ProtocolTest.completeTest();
             return;
         }
 
-        var simplifiedSample = ProbeHelper.simplifiedProbeSample(messageObject);
-        InspectorTest.log("PASS: Probe sample payload: " + JSON.stringify(simplifiedSample.payload));
+        var simplifiedSample = ProtocolTest.Probe.sanitizeProbeSample(messageObject);
+        ProtocolTest.log("PASS: Probe sample payload: " + JSON.stringify(simplifiedSample.payload));
 
         ++sampleCount;
 
         if (receivedAllExpectedOutput())
-            InspectorTest.completeTest();
+            ProtocolTest.completeTest();
     }
 
-    InspectorTest.eventHandler["Console.messageAdded"] = function(messageObject)
+    InspectorProtocol.eventHandler["Console.messageAdded"] = function(messageObject)
     {
         if (!isExpectingLogs) {
-            InspectorTest.log("FAIL: unexpected log, logs should only have come from breakpoint actions.");
-            InspectorTest.completeTest();
+            ProtocolTest.log("FAIL: unexpected log, logs should only have come from breakpoint actions.");
+            ProtocolTest.completeTest();
             return;
         }
 
-        var message = InspectorTest.Console.sanitizeConsoleMessage(messageObject);
-        InspectorTest.log("PASS: Console Message: " + JSON.stringify(message));
+        var message = ProtocolTest.Console.sanitizeConsoleMessage(messageObject);
+        ProtocolTest.log("PASS: Console Message: " + JSON.stringify(message));
 
         ++logCount;
 
         if (receivedAllExpectedOutput())
-            InspectorTest.completeTest();
+            ProtocolTest.completeTest();
     }
 }
 </script>
index 10f9c5c..a040fbc 100644 (file)
@@ -5,34 +5,34 @@
 <script>
 function test()
 {
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 
     var allowedToHitBreakpoint = false;
     var breakpointIdentifier = null;
 
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
-            InspectorTest.log("Found breakpoint.js");
+            ProtocolTest.log("Found breakpoint.js");
             var scriptIdentifier = messageObject.params.scriptId;
             var location = {scriptId: scriptIdentifier, lineNumber: 13, columnNumber: 0};
             var options = {autoContinue: true};
-            InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location, options: options}, function(responseObject) {
-                InspectorTest.checkForError(responseObject);
+            InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location, options: options}, function(responseObject) {
+                InspectorProtocol.checkForError(responseObject);
                 breakpointIdentifier = responseObject.result.breakpointId;
-                InspectorTest.log("Running breakpointAutomaticallyContinue multiple times with automatically continue");
-                InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointAutomaticallyContinue()"});
-                InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointAutomaticallyContinue()"});
-                InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointAutomaticallyContinue()"}, function() {
-                    InspectorTest.log("Removing breakpoint");
-                    InspectorTest.sendCommand("Debugger.removeBreakpoint", {"breakpointId": breakpointIdentifier}, function(responseObject) {
-                        InspectorTest.checkForError(responseObject);
+                ProtocolTest.log("Running breakpointAutomaticallyContinue multiple times with automatically continue");
+                InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointAutomaticallyContinue()"});
+                InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointAutomaticallyContinue()"});
+                InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointAutomaticallyContinue()"}, function() {
+                    ProtocolTest.log("Removing breakpoint");
+                    InspectorProtocol.sendCommand("Debugger.removeBreakpoint", {"breakpointId": breakpointIdentifier}, function(responseObject) {
+                        InspectorProtocol.checkForError(responseObject);
                         allowedToHitBreakpoint = true;
                         options = {autoContinue: false};
-                        InspectorTest.log("Setting new breakpoint without autoContinue that should trigger");
-                        InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location, options: options}, function(responseObject) {
-                            InspectorTest.checkForError(responseObject);
-                            InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointAutomaticallyContinue()"});
+                        ProtocolTest.log("Setting new breakpoint without autoContinue that should trigger");
+                        InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location, options: options}, function(responseObject) {
+                            InspectorProtocol.checkForError(responseObject);
+                            InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointAutomaticallyContinue()"});
                         });
                     });
                 });
@@ -40,16 +40,16 @@ function test()
         }
     }
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
-        InspectorTest.log("Hit Breakpoint!");
+        ProtocolTest.log("Hit Breakpoint!");
 
         if (!allowedToHitBreakpoint) {
-            InspectorTest.log("FAIL: should not have hit breakpoint.");
-            InspectorTest.completeTest();
+            ProtocolTest.log("FAIL: should not have hit breakpoint.");
+            ProtocolTest.completeTest();
         } else {
-            InspectorTest.log("PASS: hit breakpoint when allowed.");
-            InspectorTest.completeTest();
+            ProtocolTest.log("PASS: hit breakpoint when allowed.");
+            ProtocolTest.completeTest();
         }
     }
 }
index 3483930..f5dafa5 100644 (file)
@@ -11,32 +11,32 @@ function test()
     // We set a breakpoint before evaluating `var b = ...`, and verify that
     // by running some expressions at that call frame.
 
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/setBreakpoint-column\.html$/.test(messageObject.params.url) && messageObject.params.startLine > 10) {
-            InspectorTest.log("Found <script>");
+            ProtocolTest.log("Found <script>");
             var scriptIdentifier = messageObject.params.scriptId;
             var lineNumber = messageObject.params.startLine + 2;
             var columnNumber = 10;
             var location = {scriptId: scriptIdentifier, lineNumber: lineNumber, columnNumber: columnNumber};
-            InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location}, function() {
-                InspectorTest.log("Running testFunction");
-                InspectorTest.sendCommand("Runtime.evaluate", {expression: "testFunction()"});
+            InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location}, function() {
+                ProtocolTest.log("Running testFunction");
+                InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "testFunction()"});
             });
         }
     }
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
-        InspectorTest.log("Hit Breakpoint!");
+        ProtocolTest.log("Hit Breakpoint!");
         var callFrameIdentifier = messageObject.params.callFrames[0].callFrameId;
-        InspectorTest.sendCommand("Debugger.evaluateOnCallFrame", {callFrameId: callFrameIdentifier, expression: "a"}, function(messageObject) {
-            InspectorTest.log("Evaluted value of `a` (expecting number 1) was: " + JSON.stringify(messageObject.result.result));
-            InspectorTest.sendCommand("Debugger.evaluateOnCallFrame", {callFrameId: callFrameIdentifier, expression: "b"}, function(messageObject) {
-                InspectorTest.log("Evaluted value of `b` (expecting undefined) was: " + JSON.stringify(messageObject.result.result));
-                InspectorTest.completeTest();
+        InspectorProtocol.sendCommand("Debugger.evaluateOnCallFrame", {callFrameId: callFrameIdentifier, expression: "a"}, function(messageObject) {
+            ProtocolTest.log("Evaluted value of `a` (expecting number 1) was: " + JSON.stringify(messageObject.result.result));
+            InspectorProtocol.sendCommand("Debugger.evaluateOnCallFrame", {callFrameId: callFrameIdentifier, expression: "b"}, function(messageObject) {
+                ProtocolTest.log("Evaluted value of `b` (expecting undefined) was: " + JSON.stringify(messageObject.result.result));
+                ProtocolTest.completeTest();
             });
         });
     }
index 682b650..72d2d21 100644 (file)
@@ -5,70 +5,70 @@
 <script>
 function test()
 {
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 
     var inBreakpoint = false;
     var breakpointTriggered = 0;
 
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
-            InspectorTest.log("Found breakpoint.js");
+            ProtocolTest.log("Found breakpoint.js");
             var scriptIdentifier = messageObject.params.scriptId;
             var location = {scriptId: scriptIdentifier, lineNumber: 8, columnNumber: 0};
             var options = {condition: "(a + b) > 10"};
-            InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location, options: options}, function(responseObject) {
-                InspectorTest.checkForError(responseObject);
-                InspectorTest.log("Running breakpointWithCondition multiple times");
-                InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(1, 2)"});
-                InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(5, 5)"});
-                InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(7, 4)"});
+            InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location, options: options}, function(responseObject) {
+                InspectorProtocol.checkForError(responseObject);
+                ProtocolTest.log("Running breakpointWithCondition multiple times");
+                InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(1, 2)"});
+                InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(5, 5)"});
+                InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(7, 4)"});
             });
         }
     }
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
-        InspectorTest.log("Hit Breakpoint!");
+        ProtocolTest.log("Hit Breakpoint!");
         inBreakpoint = true;
         ++breakpointTriggered;
 
         var callFrameIdentifier = messageObject.params.callFrames[0].callFrameId;
         if (breakpointTriggered === 1) {
-            InspectorTest.sendCommand("Debugger.evaluateOnCallFrame", {callFrameId: callFrameIdentifier, expression: "a"}, function(messageObject) {
-                InspectorTest.log("Evaluted value of `a` (expecting number 7) was: " + JSON.stringify(messageObject.result.result));
-                InspectorTest.sendCommand("Debugger.evaluateOnCallFrame", {callFrameId: callFrameIdentifier, expression: "b"}, function(messageObject) {
-                    InspectorTest.log("Evaluted value of `b` (expecting number 4) was: " + JSON.stringify(messageObject.result.result));
-                    InspectorTest.sendCommand("Debugger.resume", {});
+            InspectorProtocol.sendCommand("Debugger.evaluateOnCallFrame", {callFrameId: callFrameIdentifier, expression: "a"}, function(messageObject) {
+                ProtocolTest.log("Evaluted value of `a` (expecting number 7) was: " + JSON.stringify(messageObject.result.result));
+                InspectorProtocol.sendCommand("Debugger.evaluateOnCallFrame", {callFrameId: callFrameIdentifier, expression: "b"}, function(messageObject) {
+                    ProtocolTest.log("Evaluted value of `b` (expecting number 4) was: " + JSON.stringify(messageObject.result.result));
+                    InspectorProtocol.sendCommand("Debugger.resume", {});
                 });
             });
         } else if (breakpointTriggered === 2) {
-            InspectorTest.sendCommand("Debugger.evaluateOnCallFrame", {callFrameId: callFrameIdentifier, expression: "a"}, function(messageObject) {
-                InspectorTest.log("Evaluted value of `a` (expecting number 4) was: " + JSON.stringify(messageObject.result.result));
-                InspectorTest.sendCommand("Debugger.evaluateOnCallFrame", {callFrameId: callFrameIdentifier, expression: "b"}, function(messageObject) {
-                    InspectorTest.log("Evaluted value of `b` (expecting number 7) was: " + JSON.stringify(messageObject.result.result));
-                    InspectorTest.log("PASS: hit breakpoints with expected values");
-                    InspectorTest.completeTest();
+            InspectorProtocol.sendCommand("Debugger.evaluateOnCallFrame", {callFrameId: callFrameIdentifier, expression: "a"}, function(messageObject) {
+                ProtocolTest.log("Evaluted value of `a` (expecting number 4) was: " + JSON.stringify(messageObject.result.result));
+                InspectorProtocol.sendCommand("Debugger.evaluateOnCallFrame", {callFrameId: callFrameIdentifier, expression: "b"}, function(messageObject) {
+                    ProtocolTest.log("Evaluted value of `b` (expecting number 7) was: " + JSON.stringify(messageObject.result.result));
+                    ProtocolTest.log("PASS: hit breakpoints with expected values");
+                    ProtocolTest.completeTest();
                 });
             });
         } else {
-            InspectorTest.log("FAIL: hit too many breakpoints.");
-            InspectorTest.completeTest();
+            ProtocolTest.log("FAIL: hit too many breakpoints.");
+            ProtocolTest.completeTest();
         }
     }
 
-    InspectorTest.eventHandler["Debugger.resumed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.resumed"] = function(messageObject)
     {
-        InspectorTest.log("Resumed, running breakpointWithCondition multiple times again");
+        ProtocolTest.log("Resumed, running breakpointWithCondition multiple times again");
         inBreakpoint = false;
 
-        InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(9, 0)"});
-        InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(12, -4)"});
-        InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(4, 7)"}, function() {
+        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(9, 0)"});
+        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(12, -4)"});
+        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(4, 7)"}, function() {
             setTimeout(function() {
                 if (!inBreakpoint) {
-                    InspectorTest.log("FAIL: Did not hit conditional breakpoint the second time");
-                    InspectorTest.completeTest();
+                    ProtocolTest.log("FAIL: Did not hit conditional breakpoint the second time");
+                    ProtocolTest.completeTest();
                 }
             }, 100);
         });
index 6285285..352ece5 100644 (file)
@@ -12,54 +12,54 @@ function test()
     // This test setting 2 breakpoints in DFG compiled functions: one inlined,
     // and one not inlined.
 
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 
     var breakpointId = null;
     var scriptId = 0;
     var startLine = 0;
 
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
-            InspectorTest.log("Found breakpoint.js");
+            ProtocolTest.log("Found breakpoint.js");
             scriptId = messageObject.params.scriptId;
             startLine = messageObject.params.startLine;
 
-            InspectorTest.sendCommand("Runtime.evaluate", {
+            InspectorProtocol.sendCommand("Runtime.evaluate", {
                 expression: "dfgWithoutInline2();"
             }, function(responseObject) {
-                InspectorTest.log("dfg function warmed up\n");
+                ProtocolTest.log("dfg function warmed up\n");
 
                 var location1 = {scriptId: scriptId, lineNumber: 2, columnNumber: 0};
 
-                InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location1}, function(responseObject) {
-                    InspectorTest.checkForError(responseObject);
-                    InspectorTest.log("Breakpoint set in breakpointBasic()");
+                InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location1}, function(responseObject) {
+                    InspectorProtocol.checkForError(responseObject);
+                    ProtocolTest.log("Breakpoint set in breakpointBasic()");
 
                     breakpointId = responseObject.result.breakpointId;
-                    InspectorTest.sendCommand("Runtime.evaluate", {
+                    InspectorProtocol.sendCommand("Runtime.evaluate", {
                         expression: "callNotInlineable2();"
                     }, function(responseObject) {
-                        InspectorTest.log("Test complete");
-                        InspectorTest.completeTest();
+                        ProtocolTest.log("Test complete");
+                        ProtocolTest.completeTest();
                     });
                 });
             });
         }
     }
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
-        InspectorTest.log("Hit Breakpoint!");
+        ProtocolTest.log("Hit Breakpoint!");
         var callFrames = messageObject.params.callFrames;
         if (callFrames.length < 3)
-            InspectorTest.log("FAIL: too few frames in stack trace");
+            ProtocolTest.log("FAIL: too few frames in stack trace");
 
         var callFrameId = callFrames[1].callFrameId;
-        InspectorTest.log("Evaluating in DFG frame at frame[1]: 'x = 20000;'");
-        InspectorTest.sendCommand("Debugger.evaluateOnCallFrame", { callFrameId: callFrameId, expression: "x = 20000;" }, function(responseObject) {
-            InspectorTest.sendCommand("Debugger.resume", {}, function(responseObject) {
-                InspectorTest.log("Resumed from breakpoint");
+        ProtocolTest.log("Evaluating in DFG frame at frame[1]: 'x = 20000;'");
+        InspectorProtocol.sendCommand("Debugger.evaluateOnCallFrame", { callFrameId: callFrameId, expression: "x = 20000;" }, function(responseObject) {
+            InspectorProtocol.sendCommand("Debugger.resume", {}, function(responseObject) {
+                ProtocolTest.log("Resumed from breakpoint");
             });
         });
     }
index 23e932e..032bd21 100644 (file)
@@ -12,52 +12,52 @@ function test()
     // This test setting a breakpoints in DFG compiled functions callee and then modify
     // and examine a global and local via the DFG frame.
 
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 
     var breakpointId = null;
     var scriptId = 0;
     var startLine = 0;
 
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
-            InspectorTest.log("Found breakpoint.js");
+            ProtocolTest.log("Found breakpoint.js");
             scriptId = messageObject.params.scriptId;
             startLine = messageObject.params.startLine;
 
-            InspectorTest.sendCommand("Runtime.evaluate", {
+            InspectorProtocol.sendCommand("Runtime.evaluate", {
                 expression: "dfgWithoutInline3();"
             }, function(responseObject) {
-                InspectorTest.log("dfg function warmed up\n");
+                ProtocolTest.log("dfg function warmed up\n");
 
                 var location1 = {scriptId: scriptId, lineNumber: 2, columnNumber: 0};
 
-                InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location1}, function(responseObject) {
-                    InspectorTest.checkForError(responseObject);
-                    InspectorTest.log("Breakpoint set in breakpointBasic()");
+                InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location1}, function(responseObject) {
+                    InspectorProtocol.checkForError(responseObject);
+                    ProtocolTest.log("Breakpoint set in breakpointBasic()");
 
                     breakpointId = responseObject.result.breakpointId;
-                    InspectorTest.sendCommand("Runtime.evaluate", {
+                    InspectorProtocol.sendCommand("Runtime.evaluate", {
                         expression: "dfgWithoutInline3();"
                     }, function(responseObject) {
-                        InspectorTest.log("Test complete");
-                        InspectorTest.completeTest();
+                        ProtocolTest.log("Test complete");
+                        ProtocolTest.completeTest();
                     });
                 });
             });
         }
     }
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
         function dumpResponse(response)
         {
             try {
                 if (response.result.wasThrown) {
-                    InspectorTest.log("Exception thrown processing request");
+                    ProtocolTest.log("Exception thrown processing request");
                     return false;
                 }
-                InspectorTest.log("Response value is " + response.result.result.value);
+                ProtocolTest.log("Response value is " + response.result.result.value);
                 return true;
             } catch (e) {
                 return false;
@@ -66,39 +66,39 @@ function test()
 
         function resumeFromBreakpoint()
         {
-            InspectorTest.sendCommand("Debugger.resume", {}, function(responseObject) {
-                InspectorTest.log("Resumed from breakpoint");
+            InspectorProtocol.sendCommand("Debugger.resume", {}, function(responseObject) {
+                ProtocolTest.log("Resumed from breakpoint");
             });
         }
 
-        InspectorTest.log("Hit Breakpoint!");
+        ProtocolTest.log("Hit Breakpoint!");
         var callFrames = messageObject.params.callFrames;
         if (callFrames.length < 3) {
-            InspectorTest.log("FAIL: too few frames in stack trace");
+            ProtocolTest.log("FAIL: too few frames in stack trace");
             resumeFromBreakpoint();
             return;
         }
         var callFrameId = callFrames[2].callFrameId;
-        InspectorTest.log("Evaluating in DFG frame at frame[2]: 'globalVal3 = 30;'");
-        InspectorTest.sendCommand("Debugger.evaluateOnCallFrame", { callFrameId: callFrameId, expression: "globalVal3 = 30;" }, function(responseObject) {
+        ProtocolTest.log("Evaluating in DFG frame at frame[2]: 'globalVal3 = 30;'");
+        InspectorProtocol.sendCommand("Debugger.evaluateOnCallFrame", { callFrameId: callFrameId, expression: "globalVal3 = 30;" }, function(responseObject) {
             if (!dumpResponse(responseObject)) {
                 resumeFromBreakpoint();
                 return;
             }
-            InspectorTest.log("Evaluating in DFG frame at frame[2]: 'localVal3 = 12;'");
-            InspectorTest.sendCommand("Debugger.evaluateOnCallFrame", { callFrameId: callFrameId, expression: "localVal3 = 12;" }, function(responseObject) {
+            ProtocolTest.log("Evaluating in DFG frame at frame[2]: 'localVal3 = 12;'");
+            InspectorProtocol.sendCommand("Debugger.evaluateOnCallFrame", { callFrameId: callFrameId, expression: "localVal3 = 12;" }, function(responseObject) {
                 if (!dumpResponse(responseObject)) {
                     resumeFromBreakpoint();
                     return;
                 }
-                InspectorTest.log("Evaluating in DFG frame at frame[2]: 'localVal3'");
-                InspectorTest.sendCommand("Debugger.evaluateOnCallFrame", { callFrameId: callFrameId, expression: "localVal3" }, function(responseObject) {
+                ProtocolTest.log("Evaluating in DFG frame at frame[2]: 'localVal3'");
+                InspectorProtocol.sendCommand("Debugger.evaluateOnCallFrame", { callFrameId: callFrameId, expression: "localVal3" }, function(responseObject) {
                     if (!dumpResponse(responseObject)) {
                         resumeFromBreakpoint();
                         return;
                     }
-                    InspectorTest.sendCommand("Debugger.resume", {}, function(responseObject) {
-                        InspectorTest.log("Resumed from breakpoint");
+                    InspectorProtocol.sendCommand("Debugger.resume", {}, function(responseObject) {
+                        ProtocolTest.log("Resumed from breakpoint");
                     });
                 });
             });
index f3f0724..0307a42 100644 (file)
@@ -12,39 +12,39 @@ function test()
     // This test setting 2 breakpoints in DFG compiled functions: one inlined,
     // and one not inlined.
 
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 
     var dfgNonInlinedBreakpointId = null;
     var dfgInlinedBreakpointId = null;
     var scriptIdentifier = 0;
     var startLine = 0;
 
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
-            InspectorTest.log("Found breakpoint.js");
+            ProtocolTest.log("Found breakpoint.js");
             scriptIdentifier = messageObject.params.scriptId;
             startLine = messageObject.params.startLine;
 
-            InspectorTest.sendCommand("Runtime.evaluate", {
+            InspectorProtocol.sendCommand("Runtime.evaluate", {
                 expression: "dfgWithoutInline(); dfgWithInline();"
             }, function(responseObject) {
-                InspectorTest.log("dfg functions warmed up\n");
+                ProtocolTest.log("dfg functions warmed up\n");
 
                 var location1 = {scriptId: scriptIdentifier, lineNumber: 22, columnNumber: 0};
 
-                InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location1}, function(responseObject) {
-                    InspectorTest.checkForError(responseObject);
-                    InspectorTest.log("Breakpoint set in notInlineable()");
+                InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location1}, function(responseObject) {
+                    InspectorProtocol.checkForError(responseObject);
+                    ProtocolTest.log("Breakpoint set in notInlineable()");
 
                     dfgNonInlinedBreakpointId = responseObject.result.breakpointId;
                     var location2 = {scriptId: scriptIdentifier, lineNumber: 28, columnNumber: 0};
-                    InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location2}, function(responseObject) {
-                        InspectorTest.checkForError(responseObject);
-                        InspectorTest.log("Breakpoint set in inlineable()\n");
+                    InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location2}, function(responseObject) {
+                        InspectorProtocol.checkForError(responseObject);
+                        ProtocolTest.log("Breakpoint set in inlineable()\n");
 
                         dfgInlinedBreakpointId = responseObject.result.breakpointId;
-                        InspectorTest.sendCommand("Runtime.evaluate", {
+                        InspectorProtocol.sendCommand("Runtime.evaluate", {
                             expression: "dfgWithoutInline(); dfgWithInline();"
                         });
                     });
@@ -54,24 +54,24 @@ function test()
     }
 
     var breakpointsHit = 0;
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
         var breakpointId = null;
         breakpointsHit++;
-        InspectorTest.log("Hit Breakpoint " + breakpointsHit + "!");
+        ProtocolTest.log("Hit Breakpoint " + breakpointsHit + "!");
         if (breakpointsHit == 1)
             breakpointId = dfgNonInlinedBreakpointId;
         else if (breakpointsHit == 2)
             breakpointId = dfgInlinedBreakpointId;
         else
-            InspectorTest.log("Unexpected breakpoint");
+            ProtocolTest.log("Unexpected breakpoint");
 
-        InspectorTest.sendCommand("Debugger.removeBreakpoint", {"breakpointId": breakpointId}, function(responseObject) {
-            InspectorTest.log("Removed Breakpoint " + breakpointsHit + "!");
-            InspectorTest.sendCommand("Debugger.resume", {}, function(responseObject) {
+        InspectorProtocol.sendCommand("Debugger.removeBreakpoint", {"breakpointId": breakpointId}, function(responseObject) {
+            ProtocolTest.log("Removed Breakpoint " + breakpointsHit + "!");
+            InspectorProtocol.sendCommand("Debugger.resume", {}, function(responseObject) {
                 if (breakpointsHit == 2) {
-                    InspectorTest.log("PASS");
-                    InspectorTest.completeTest();
+                    ProtocolTest.log("PASS");
+                    ProtocolTest.completeTest();
                 }
             });
         });
index 44c6893..cf91e24 100644 (file)
@@ -5,51 +5,51 @@
 <script>
 function test()
 {
-    InspectorTest.importScript("console-test.js");
+    ProtocolTest.importScript("console-test.js");
 
-    InspectorTest.sendCommand("Console.enable", {});
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Console.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 
     var logsSeen = 0;
     const expectedLogs = 2;
 
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
-            InspectorTest.log("Found breakpoint.js");
+            ProtocolTest.log("Found breakpoint.js");
             var scriptIdentifier = messageObject.params.scriptId;
             var location = {scriptId: scriptIdentifier, lineNumber: 8, columnNumber: 0};
             var options = {condition: "this.will.cause.exception", autoContinue: true};
-            InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location, options: options}, function(responseObject) {
-                InspectorTest.checkForError(responseObject);
-                InspectorTest.log("Running breakpointWithCondition to trigger condition exception.");
-                InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(1,2)"}, function() {
+            InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location, options: options}, function(responseObject) {
+                InspectorProtocol.checkForError(responseObject);
+                ProtocolTest.log("Running breakpointWithCondition to trigger condition exception.");
+                InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(1,2)"}, function() {
                     location = {scriptId: scriptIdentifier, lineNumber: 18, columnNumber: 0};
                     options = {actions: [{"type": "evaluate", "data": "this.will.cause.exception"}], autoContinue: true};
-                    InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location, options: options}, function(responseObject) {
-                        InspectorTest.log("Running breakpointActions to trigger actions exception.");
-                        InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointActions(1,2)"});
+                    InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location, options: options}, function(responseObject) {
+                        ProtocolTest.log("Running breakpointActions to trigger actions exception.");
+                        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointActions(1,2)"});
                     });
                 });
             });
         }
     }
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
-        InspectorTest.log("Hit Breakpoint!");
+        ProtocolTest.log("Hit Breakpoint!");
 
-        InspectorTest.log("FAIL: should not have hit breakpoint, autoContinue was true");
-        InspectorTest.completeTest();
+        ProtocolTest.log("FAIL: should not have hit breakpoint, autoContinue was true");
+        ProtocolTest.completeTest();
     }
 
-    InspectorTest.eventHandler["Console.messageAdded"] = function(messageObject)
+    InspectorProtocol.eventHandler["Console.messageAdded"] = function(messageObject)
     {
-        var message = InspectorTest.Console.sanitizeConsoleMessage(messageObject);
-        InspectorTest.log("PASS: Console Message: " + JSON.stringify(message));
+        var message = ProtocolTest.Console.sanitizeConsoleMessage(messageObject);
+        ProtocolTest.log("PASS: Console Message: " + JSON.stringify(message));
 
         if (++logsSeen === expectedLogs)
-            InspectorTest.completeTest();
+            ProtocolTest.completeTest();
     }
 }
 </script>
index 143a23c..8a86726 100644 (file)
@@ -5,35 +5,35 @@
 <script>
 function test()
 {
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
-            InspectorTest.log("Found breakpoint.js");
+            ProtocolTest.log("Found breakpoint.js");
             var scriptIdentifier = messageObject.params.scriptId;
             var location = {scriptId: scriptIdentifier, lineNumber: 3, columnNumber: 0};
-            InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location}, function(responseObject) {
-                InspectorTest.checkForError(responseObject);
-                InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location}, function(responseObject) {
+            InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location}, function(responseObject) {
+                InspectorProtocol.checkForError(responseObject);
+                InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location}, function(responseObject) {
                     if (!responseObject.error) {
-                        InspectorTest.log("FAIL: Expected error setting duplicate breakpoint");
-                        InspectorTest.completeTest();
+                        ProtocolTest.log("FAIL: Expected error setting duplicate breakpoint");
+                        ProtocolTest.completeTest();
                     } else {
-                        InspectorTest.log("PASS: Received error setting duplicate breakpoint: " + responseObject.error.message);
-                        InspectorTest.log("Running breakpointBasic");
-                        InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointBasic()"});
+                        ProtocolTest.log("PASS: Received error setting duplicate breakpoint: " + responseObject.error.message);
+                        ProtocolTest.log("Running breakpointBasic");
+                        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "breakpointBasic()"});
                     }
                 });
             });
         }
     }
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
-        InspectorTest.log("Hit Breakpoint!");
-        InspectorTest.log("PASS");
-        InspectorTest.completeTest();
+        ProtocolTest.log("Hit Breakpoint!");
+        ProtocolTest.log("PASS");
+        ProtocolTest.completeTest();
     }
 }
 </script>
index 0ef0f24..dae4f91 100644 (file)
@@ -8,30 +8,30 @@ eval("function sourceURLFunction() {\n    var a = 1;\n    var b = 2;\n    var c
 
 function test()
 {
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
     {
         if (/sourceURL-test\.js$/.test(messageObject.params.url)) {
-            InspectorTest.log("Found sourceURL-test.js");
+            ProtocolTest.log("Found sourceURL-test.js");
             var params = {url: messageObject.params.url, lineNumber: 3, columnNumber: 0};
-            InspectorTest.sendCommand("Debugger.setBreakpointByUrl", params, function(responseObject) {
-                InspectorTest.checkForError(responseObject);
-                InspectorTest.log("Running sourceURLFunction");
-                InspectorTest.sendCommand("Runtime.evaluate", {expression: "sourceURLFunction()"});
+            InspectorProtocol.sendCommand("Debugger.setBreakpointByUrl", params, function(responseObject) {
+                InspectorProtocol.checkForError(responseObject);
+                ProtocolTest.log("Running sourceURLFunction");
+                InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "sourceURLFunction()"});
             });
         }
     }
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
-        InspectorTest.log("Hit Breakpoint!");
+        ProtocolTest.log("Hit Breakpoint!");
         var callFrameIdentifier = messageObject.params.callFrames[0].callFrameId;
-        InspectorTest.sendCommand("Debugger.evaluateOnCallFrame", {callFrameId: callFrameIdentifier, expression: "a"}, function(messageObject) {
-            InspectorTest.log("Evaluted value of `a` (expecting number 1) was: " + JSON.stringify(messageObject.result.result));
-            InspectorTest.sendCommand("Debugger.evaluateOnCallFrame", {callFrameId: callFrameIdentifier, expression: "c"}, function(messageObject) {
-                InspectorTest.log("Evaluted value of `c` (expecting undefined) was: " + JSON.stringify(messageObject.result.result));
-                InspectorTest.completeTest();
+        InspectorProtocol.sendCommand("Debugger.evaluateOnCallFrame", {callFrameId: callFrameIdentifier, expression: "a"}, function(messageObject) {
+            ProtocolTest.log("Evaluted value of `a` (expecting number 1) was: " + JSON.stringify(messageObject.result.result));
+            InspectorProtocol.sendCommand("Debugger.evaluateOnCallFrame", {callFrameId: callFrameIdentifier, expression: "c"}, function(messageObject) {
+                ProtocolTest.log("Evaluted value of `c` (expecting undefined) was: " + JSON.stringify(messageObject.result.result));
+                ProtocolTest.completeTest();
             });
         });
     }
index b2c03f1..9e6f2dc 100644 (file)
@@ -43,7 +43,7 @@ function test()
             var statement = list[i];
             var last = i === list.length - 1;
             var responseCallback = last ? function() { setTimeout(callback, 10); } : function(){};
-            InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { " + statement + " }, 0);"}, responseCallback);
+            InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { " + statement + " }, 0);"}, responseCallback);
         }
     }
 
@@ -51,7 +51,7 @@ function test()
     {
         var statements = statementsWithoutExceptions;
         evaluateStatements(statements, function() {
-            InspectorTest.log("PASS - did not pause on non-exception statements");
+            ProtocolTest.log("PASS - did not pause on non-exception statements");
             callback();
         });
     }
@@ -64,7 +64,7 @@ function test()
         // Evaluate statement and expect to pause.
         if (currentCaughtExceptionStatement < statementsWithCaughtExceptions.length) {
             var statement = statementsWithCaughtExceptions[currentCaughtExceptionStatement++];
-            InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { " + statement + " }, 0);"});
+            InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { " + statement + " }, 0);"});
             return;
         }
 
@@ -73,7 +73,7 @@ function test()
             return;
 
         // Done evaluating caught exceptions statements. Move on to uncaught exceptions.
-        InspectorTest.log("PASS - paused for each caught exception");
+        ProtocolTest.log("PASS - paused for each caught exception");
         triggerNext = triggerNextUncaughtException;
         triggerNext();
     }
@@ -83,7 +83,7 @@ function test()
         // Evaluate statement and expect to pause.
         if (currentUncaughtExceptionStatement < statementsWithUncaughtExceptions.length) {
             var statement = statementsWithUncaughtExceptions[currentUncaughtExceptionStatement++];
-            InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { " + statement + " }, 0);"});
+            InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { " + statement + " }, 0);"});
             return;
         }
 
@@ -92,40 +92,40 @@ function test()
             return;
 
         // Done evaluating statements to pause. Evaluate some more we do not expect to pause.
-        InspectorTest.log("PASS - paused for each uncaught exception");
+        ProtocolTest.log("PASS - paused for each uncaught exception");
         expectPause = false;
         evaluateExpectedNoPauses(function() {
-            InspectorTest.completeTest();
+            ProtocolTest.completeTest();
         });
     }
 
 
-    InspectorTest.sendCommand("Debugger.enable", {});
-    InspectorTest.sendCommand("Debugger.setPauseOnExceptions", {state: "all"}, function(responseObject) {
-        InspectorTest.checkForError(responseObject);
-        InspectorTest.log("Debugger.setPauseOnExceptions - all");
+    InspectorProtocol.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.setPauseOnExceptions", {state: "all"}, function(responseObject) {
+        InspectorProtocol.checkForError(responseObject);
+        ProtocolTest.log("Debugger.setPauseOnExceptions - all");
         evaluateExpectedNoPauses(function() {
             expectPause = true;
             triggerNext();
         });
     });
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
-        InspectorTest.log("Paused!");
+        ProtocolTest.log("Paused!");
 
         if (!expectPause) {
-            InspectorTest.log("FAIL - debugger paused when we did not expect to");
-            InspectorTest.completeTest();
+            ProtocolTest.log("FAIL - debugger paused when we did not expect to");
+            ProtocolTest.completeTest();
             return;
         }
 
-        InspectorTest.sendCommand("Debugger.resume", {});
+        InspectorProtocol.sendCommand("Debugger.resume", {});
     }
 
-    InspectorTest.eventHandler["Debugger.resumed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.resumed"] = function(messageObject)
     {
-        InspectorTest.log("Resumed");
+        ProtocolTest.log("Resumed");
         triggerNext();
     }
 }
index ed6ec49..8e32d54 100644 (file)
@@ -5,38 +5,38 @@
 <script>
 function test()
 {
-    InspectorTest.sendCommand("Debugger.enable", {});
-    InspectorTest.sendCommand("Debugger.setPauseOnExceptions", {state: "none"}, function(responseObject) {
-        InspectorTest.checkForError(responseObject);
-        InspectorTest.log("Debugger.setPauseOnExceptions - none");
-        InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { 1+1; }, 0);"});
-        InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { noException(); }, 0);"});
-        InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { catchNested(noException, 7); }, 0);"});
-        InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { try{ ({}).a.b.c.d } catch (e) { console.log('caught inline: ' + JSON.stringify(e)); } }, 0);"});
-        InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { catchNested(exceptionBasic, 1); }, 0);"});
-        InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { catchNested(exceptionDOM, 2); }, 0);"});
-        InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { catchNested(exceptionInHostFunction, 3); }, 0);"});
-        InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { catchNested(throwString, 10); }, 0);"});
-        InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { catchNested(throwParam, 5, new Error('error message')); }, 0);"});
-        InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { {}.a.b.c.d; }, 0);"});
-        InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { exceptionBasic(); }, 0);"});
-        InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { exceptionDOM(); }, 0);"});
-        InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { exceptionInHostFunction(); }, 0);"});
-        InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { throwString(); }, 0);"});
-        InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { throwParam({x:1}); }, 0);"});
-        InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { throwParam(new Error('error message')); }, 0);"}, function() {
+    InspectorProtocol.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.setPauseOnExceptions", {state: "none"}, function(responseObject) {
+        InspectorProtocol.checkForError(responseObject);
+        ProtocolTest.log("Debugger.setPauseOnExceptions - none");
+        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { 1+1; }, 0);"});
+        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { noException(); }, 0);"});
+        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { catchNested(noException, 7); }, 0);"});
+        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { try{ ({}).a.b.c.d } catch (e) { console.log('caught inline: ' + JSON.stringify(e)); } }, 0);"});
+        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { catchNested(exceptionBasic, 1); }, 0);"});
+        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { catchNested(exceptionDOM, 2); }, 0);"});
+        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { catchNested(exceptionInHostFunction, 3); }, 0);"});
+        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { catchNested(throwString, 10); }, 0);"});
+        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { catchNested(throwParam, 5, new Error('error message')); }, 0);"});
+        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { {}.a.b.c.d; }, 0);"});
+        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { exceptionBasic(); }, 0);"});
+        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { exceptionDOM(); }, 0);"});
+        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { exceptionInHostFunction(); }, 0);"});
+        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { throwString(); }, 0);"});
+        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { throwParam({x:1}); }, 0);"});
+        InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { throwParam(new Error('error message')); }, 0);"}, function() {
             setTimeout(function() {
-                InspectorTest.log("PASS: No pauses");
-                InspectorTest.completeTest();
+                ProtocolTest.log("PASS: No pauses");
+                ProtocolTest.completeTest();
             }, 10);
         });
     });
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
-        InspectorTest.log("Paused!");
-        InspectorTest.log("FAIL");
-        InspectorTest.completeTest();
+        ProtocolTest.log("Paused!");
+        ProtocolTest.log("FAIL");
+        ProtocolTest.completeTest();
     }
 }
 </script>
index 06b2b26..9143b69 100644 (file)
@@ -42,7 +42,7 @@ function test()
             var statement = list[i];
             var last = i === list.length - 1;
             var responseCallback = last ? function() { setTimeout(callback, 10); } : function(){};
-            InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { " + statement + " }, 0);"}, responseCallback);
+            InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { " + statement + " }, 0);"}, responseCallback);
         }
     }
 
@@ -50,7 +50,7 @@ function test()
     {
         var statements = statementsWithoutExceptions.concat(statementsWithCaughtExceptions);
         evaluateStatements(statements, function() {
-            InspectorTest.log("PASS - did not pause on non-exception statements or caught exception statements");
+            ProtocolTest.log("PASS - did not pause on non-exception statements or caught exception statements");
             callback();
         });
     }
@@ -60,7 +60,7 @@ function test()
         // Evaluate statement and expect to pause.
         if (currentUncaughtExceptionStatement < statementsWithUncaughtExceptions.length) {
             var statement = statementsWithUncaughtExceptions[currentUncaughtExceptionStatement++];
-            InspectorTest.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { " + statement + " }, 0);"});
+            InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { " + statement + " }, 0);"});
             return;
         }
 
@@ -69,41 +69,41 @@ function test()
             return;
 
         // Done evaluating statements to pause. Evaluate some more we do not expect to pause.
-        InspectorTest.log("PASS - paused for each uncaught exception");
+        ProtocolTest.log("PASS - paused for each uncaught exception");
         expectPause = false;
         evaluateExpectedNoPauses(function() {
-            InspectorTest.log("PASS");
-            InspectorTest.completeTest();
+            ProtocolTest.log("PASS");
+            ProtocolTest.completeTest();
         });
     }
 
 
-    InspectorTest.sendCommand("Debugger.enable", {});
-    InspectorTest.sendCommand("Debugger.setPauseOnExceptions", {state: "uncaught"}, function(responseObject) {
-        InspectorTest.checkForError(responseObject);
-        InspectorTest.log("Debugger.setPauseOnExceptions - uncaught");
+    InspectorProtocol.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.setPauseOnExceptions", {state: "uncaught"}, function(responseObject) {
+        InspectorProtocol.checkForError(responseObject);
+        ProtocolTest.log("Debugger.setPauseOnExceptions - uncaught");
         evaluateExpectedNoPauses(function() {
             expectPause = true;
             triggerNextUncaughtException();
         });
     });
 
-    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
     {
-        InspectorTest.log("Paused!");
+        ProtocolTest.log("Paused!");
 
         if (!expectPause) {
-            InspectorTest.log("FAIL - debugger paused when we did not expect to");
-            InspectorTest.completeTest();
+            ProtocolTest.log("FAIL - debugger paused when we did not expect to");
+            ProtocolTest.completeTest();
             return;
         }
 
-        InspectorTest.sendCommand("Debugger.resume", {});
+        InspectorProtocol.sendCommand("Debugger.resume", {});
     }
 
-    InspectorTest.eventHandler["Debugger.resumed"] = function(messageObject)
+    InspectorProtocol.eventHandler["Debugger.resumed"] = function(messageObject)
     {
-        InspectorTest.log("Resumed");
+        ProtocolTest.log("Resumed");
         triggerNextUncaughtException();
     }
 }
index ab0cc69..7c8aee7 100644 (file)
@@ -15,14 +15,14 @@ function test()
             try {
                 processStepOrFail(s);
             } catch (e) {
-                InspectorTest.log(e.stack);
-                InspectorTest.completeTest();
+                ProtocolTest.log(e.stack);
+                ProtocolTest.completeTest();
             }
         }
 
         function processStepOrFail(s) {
             if (!s) {
-                InspectorTest.completeTest();
+                ProtocolTest.completeTest();
                 return;
             }
             if (!s.command) {
@@ -37,29 +37,29 @@ function test()
                 if ("error" in response) {
                     if (!("errorHandler" in s)) {
                         // Error message is not logged intentionally, it may be platform-specific.
-                        InspectorTest.log("Protocol command '" + s.command + "' failed");
-                        InspectorTest.completeTest();
+                        ProtocolTest.log("Protocol command '" + s.command + "' failed");
+                        ProtocolTest.completeTest();
                         return;
                     }
                     try {
                         next = s.errorHandler(response.error);
                     } catch (e) {
-                        InspectorTest.log(e.stack);
-                        InspectorTest.completeTest();
+                        ProtocolTest.log(e.stack);
+                        ProtocolTest.completeTest();
                         return;
                     }
                 } else {
                     try {
                         next = s.callback(response.result);
                     } catch (e) {
-                        InspectorTest.log(e.stack);
-                        InspectorTest.completeTest();
+                        ProtocolTest.log(e.stack);
+                        ProtocolTest.completeTest();
                         return;
                     }
                 }
                 processStep(next);
             }
-            InspectorTest.sendCommand(s.command, s.params, innerCallback);
+            InspectorProtocol.sendCommand(s.command, s.params, innerCallback);
         }
     }
 
@@ -95,8 +95,8 @@ function test()
         };
 
         function callbackLogClosureEval(result) {
-            InspectorTest.log("Closure returns: " + JSON.stringify(result.result));
-            InspectorTest.log(" (expected: 'ttttrue52013')");
+            ProtocolTest.log("Closure returns: " + JSON.stringify(result.result));
+            ProtocolTest.log(" (expected: 'ttttrue52013')");
 
             var params = {
                 functionObjectId: functionObjectId,
@@ -110,7 +110,7 @@ function test()
         }
 
         function setVariableCallback() {
-            InspectorTest.log("Debugger.setVariableValue OK");
+            ProtocolTest.log("Debugger.setVariableValue OK");
 
             var params = {
                 objectId: functionObjectId,
@@ -123,8 +123,8 @@ function test()
         }
 
         function callbackLogClosureEval2(result) {
-            InspectorTest.log("Closure returns: " + JSON.stringify(result.result));
-            InspectorTest.log(" (expected: 'ttttrue42013')");
+            ProtocolTest.log("Closure returns: " + JSON.stringify(result.result));
+            ProtocolTest.log(" (expected: 'ttttrue42013')");
 
             var params = {
                 // No target is specified
@@ -138,7 +138,7 @@ function test()
         }
 
         function setVariableErrorCallback3(error) {
-            InspectorTest.log("Expected error: " + JSON.stringify(error));
+            ProtocolTest.log("Expected error: " + JSON.stringify(error));
 
             var params = {
                 functionObjectId: functionObjectId,
@@ -152,7 +152,7 @@ function test()
         }
 
         function setVariableErrorCallback4(error) {
-            InspectorTest.log("Expected error");
+            ProtocolTest.log("Expected error");
 
             var params = {
                 functionObjectId: functionObjectId,
@@ -166,7 +166,7 @@ function test()
         }
 
         function setVariableErrorCallback5(error) {
-            InspectorTest.log("Expected error");
+            ProtocolTest.log("Expected error");
 
             // End of test.
             return;
index 45bc3f7..864b1a4 100644 (file)
@@ -18,7 +18,7 @@ function test()
     var workerRequestId = 1;
     function sendCommandToWorker(method, params)
     {
-        InspectorTest.sendCommand("Worker.sendMessageToWorker", {
+        InspectorProtocol.sendCommand("Worker.sendMessageToWorker", {
             "workerId": workerId,
             "message": {
                 "method": method,
@@ -28,32 +28,32 @@ function test()
         });
     }
 
-    InspectorTest.sendCommand("Worker.enable", {}, function(messageObject) {
+    InspectorProtocol.sendCommand("Worker.enable", {}, function(messageObject) {
         if ("error" in messageObject) {
-            InspectorTest.log("FAIL: Couldn't enable worker debugger: " + messageObject.error.message);
-            InspectorTest.completeTest();
+            ProtocolTest.log("FAIL: Couldn't enable worker debugger: " + messageObject.error.message);
+            ProtocolTest.completeTest();
         }
     });
 
-    InspectorTest.eventHandler["Worker.workerCreated"] = function(messageObject)
+    InspectorProtocol.eventHandler["Worker.workerCreated"] = function(messageObject)
     {
         workerId = messageObject["params"]["workerId"];
-        InspectorTest.log("Worker created");
-        InspectorTest.sendCommand("Worker.connectToWorker", {"workerId": workerId}, function(messageObject) {
-            InspectorTest.log("didConnectToWorker");
+        ProtocolTest.log("Worker created");
+        InspectorProtocol.sendCommand("Worker.connectToWorker", {"workerId": workerId}, function(messageObject) {
+            ProtocolTest.log("didConnectToWorker");
             sendCommandToWorker("Debugger.enable", {});
             sendCommandToWorker("Debugger.pause", {});
         });
     }
 
-    InspectorTest.eventHandler["Worker.dispatchMessageFromWorker"] = function(messageObject)
+    InspectorProtocol.eventHandler["Worker.dispatchMessageFromWorker"] = function(messageObject)
     {
         var message = messageObject["params"]["message"];
         if (message["method"] === "Debugger.paused") {
-            InspectorTest.log("Worker paused");
-            InspectorTest.sendCommand("Runtime.evaluate", {"expression": "worker.terminate()"}, function(messageObject) {
-                InspectorTest.log("SUCCESS: Did terminate paused worker");
-                InspectorTest.completeTest();
+            ProtocolTest.log("Worker paused");
+            InspectorProtocol.sendCommand("Runtime.evaluate", {"expression": "worker.terminate()"}, function(messageObject) {
+                ProtocolTest.log("SUCCESS: Did terminate paused worker");
+                ProtocolTest.completeTest();
             });
         }
     }
index 2880f11..ac78beb 100644 (file)
@@ -19,11 +19,11 @@ function test()
 {
     var nodesById = {};
 
-    InspectorTest.eventHandler["DOM.setChildNodes"] = onSetChildNodes;
-    InspectorTest.eventHandler["DOM.childNodeRemoved"] = onChildNodeRemoved;
-    InspectorTest.eventHandler["DOM.childNodeInserted"] = onChildNodeInserted;
-    InspectorTest.eventHandler["Debugger.paused"] = onDebuggerPaused;
-    InspectorTest.eventHandler["Debugger.scriptParsed"] = onScriptParsed;
+    InspectorProtocol.eventHandler["DOM.setChildNodes"] = onSetChildNodes;
+    InspectorProtocol.eventHandler["DOM.childNodeRemoved"] = onChildNodeRemoved;
+    InspectorProtocol.eventHandler["DOM.childNodeInserted"] = onChildNodeInserted;
+    InspectorProtocol.eventHandler["Debugger.paused"] = onDebuggerPaused;
+    InspectorProtocol.eventHandler["Debugger.scriptParsed"] = onScriptParsed;
     
     function createNodeAttributesMap(attributes)
     {
@@ -70,23 +70,23 @@ function test()
     function onChildNodeRemoved(response)
     {
         var nodeId = response.params.nodeId;
-        InspectorTest.assert(getNodeIdentifier(nodeId) === "div#target_element", "onChildNodeRemoved called for #target_element");
+        ProtocolTest.assert(getNodeIdentifier(nodeId) === "div#target_element", "onChildNodeRemoved called for #target_element");
         delete nodesById[nodeId];
     }
 
     function onChildNodeInserted(response)
     {
         collectNode(response.params.node);
-        InspectorTest.assert(getNodeIdentifier(response.params.parentNodeId) === "div#final_container", "onChildNodeInserted called for parent node #final_container");
-        InspectorTest.assert(getNodeIdentifier(response.params.node.nodeId) === "div#target_element", "onChildNodeInserted called for child node #target_element");
+        ProtocolTest.assert(getNodeIdentifier(response.params.parentNodeId) === "div#final_container", "onChildNodeInserted called for parent node #final_container");
+        ProtocolTest.assert(getNodeIdentifier(response.params.node.nodeId) === "div#target_element", "onChildNodeInserted called for child node #target_element");
     }
 
     function onDebuggerPaused(response)
     {   
-        InspectorTest.log("Stopped on DOM breakpoint");
-        InspectorTest.sendCommand("Runtime.evaluate", {"expression": "moveNode()"}, function() {
-            InspectorTest.sendCommand("Debugger.resume");
-            InspectorTest.completeTest();
+        ProtocolTest.log("Stopped on DOM breakpoint");
+        InspectorProtocol.sendCommand("Runtime.evaluate", {"expression": "moveNode()"}, function() {
+            InspectorProtocol.sendCommand("Debugger.resume");
+            ProtocolTest.completeTest();
         });
     }
 
@@ -95,19 +95,19 @@ function test()
         // FIXME: The DOM breakpoints are not working unless there's a JS brakpoint set. Setting a fake breakpoint to workaround that.
         // https://bugs.webkit.org/show_bug.cgi?id=123770 
         if (/node-removed\.html$/.test(messageObject.params.url) && messageObject.params.startLine > 20) {
-            InspectorTest.eventHandler["Debugger.scriptParsed"] = null;
-            InspectorTest.log("Found <script>");
+            InspectorProtocol.eventHandler["Debugger.scriptParsed"] = null;
+            ProtocolTest.log("Found <script>");
             var location = {scriptId: messageObject.params.scriptId, lineNumber: messageObject.params.startLine + 2, columnNumber: 0};
-            InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location}, function() {
-                InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument);
+            InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location}, function() {
+                InspectorProtocol.sendCommand("DOM.getDocument", {}, onGotDocument);
             });
         }
     }
 
     function onGotDocument(response)
     {
-        InspectorTest.checkForError(response);
-        InspectorTest.sendCommand("DOM.querySelectorAll", {"nodeId": response.result.root.nodeId, "selector": "#target_element,#final_container"}, onQuerySelectorAll);
+        InspectorProtocol.checkForError(response);
+        InspectorProtocol.sendCommand("DOM.querySelectorAll", {"nodeId": response.result.root.nodeId, "selector": "#target_element,#final_container"}, onQuerySelectorAll);
     }
 
     function onQuerySelectorAll(response)
@@ -115,13 +115,13 @@ function test()
         var targetElementId = response.result.nodeIds[0];
         var finalContainerId = response.result.nodeIds[1];
 
-        InspectorTest.sendCommand("DOMDebugger.setDOMBreakpoint", {nodeId: targetElementId, type: "node-removed"});
-        InspectorTest.sendCommand("DOM.requestChildNodes", {nodeId: finalContainerId});
+        InspectorProtocol.sendCommand("DOMDebugger.setDOMBreakpoint", {nodeId: targetElementId, type: "node-removed"});
+        InspectorProtocol.sendCommand("DOM.requestChildNodes", {nodeId: finalContainerId});
 
-        InspectorTest.sendCommand("Runtime.evaluate", {"expression": "removeNode()"});
+        InspectorProtocol.sendCommand("Runtime.evaluate", {"expression": "removeNode()"});
     }
 
-    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorProtocol.sendCommand("Debugger.enable", {});
 }
 </script>
 </head>
index 995feb4..08c9b08 100644 (file)
@@ -16,9 +16,9 @@ function test()
 {
     var nodesById = {};
 
-    InspectorTest.eventHandler["DOM.setChildNodes"] = onSetChildNodes;
-    InspectorTest.eventHandler["DOM.childNodeRemoved"] = onChildNodeRemoved;
-    InspectorTest.eventHandler["DOM.childNodeInserted"] = onChildNodeInserted;
+    InspectorProtocol.eventHandler["DOM.setChildNodes"] = onSetChildNodes;
+    InspectorProtocol.eventHandler["DOM.childNodeRemoved"] = onChildNodeRemoved;
+    InspectorProtocol.eventHandler["DOM.childNodeInserted"] = onChildNodeInserted;
 
     function createNodeAttributesMap(node)
     {
@@ -47,31 +47,31 @@ function test()
     function onChildNodeRemoved(response)
     {
         var nodeId = response.params.nodeId;
-        InspectorTest.assert(getNodeIdentifier(nodeId) === "target_element", "onChildNodeRemoved called for #target_element");
+        ProtocolTest.assert(getNodeIdentifier(nodeId) === "target_element", "onChildNodeRemoved called for #target_element");
         delete nodesById[nodeId];
     }
 
     function onChildNodeInserted(response)
     {
         collectNode(response.params.node);
-        InspectorTest.assert(getNodeIdentifier(response.params.parentNodeId) === "final_container", "onChildNodeInserted called for parent node #final_container");
-        InspectorTest.assert(getNodeIdentifier(response.params.node.nodeId) === "target_element", "onChildNodeInserted called for child node #target_element");
+        ProtocolTest.assert(getNodeIdentifier(response.params.parentNodeId) === "final_container", "onChildNodeInserted called for parent node #final_container");
+        ProtocolTest.assert(getNodeIdentifier(response.params.node.nodeId) === "target_element", "onChildNodeInserted called for child node #target_element");
     }
 
-    InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument);
+    InspectorProtocol.sendCommand("DOM.getDocument", {}, onGotDocument);
 
     function onGotDocument(msg)
     {
-        InspectorTest.checkForError(msg);
-        InspectorTest.sendCommand("DOM.querySelector", {"nodeId": msg.result.root.nodeId, "selector": "#final_container"}, onQuerySelector);
+        InspectorProtocol.checkForError(msg);
+        InspectorProtocol.sendCommand("DOM.querySelector", {"nodeId": msg.result.root.nodeId, "selector": "#final_container"}, onQuerySelector);
     }
 
     function onQuerySelector(response)
     {
         // Make sure we receive the children of the "#final_container" as they are added.
-        InspectorTest.sendCommand("DOM.requestChildNodes", {nodeId: response.result.nodeId});
-        InspectorTest.sendCommand("Runtime.evaluate", {"expression": "moveNode()"}, function() {
-            InspectorTest.completeTest();
+        InspectorProtocol.sendCommand("DOM.requestChildNodes", {nodeId: response.result.nodeId});
+        InspectorProtocol.sendCommand("Runtime.evaluate", {"expression": "moveNode()"}, function() {
+            ProtocolTest.completeTest();
         });
     }
 }
index fa010a4..efe2aa4 100644 (file)
@@ -4,18 +4,18 @@
 <script>
 function test()
 {
-    InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument);
+    InspectorProtocol.sendCommand("DOM.getDocument", {}, onGotDocument);
 
     function onGotDocument(message) {
-        InspectorTest.checkForError(message);
-        InspectorTest.sendCommand("DOM.performSearch", {query: "FooBar"}, onSearchCompleted);
+        InspectorProtocol.checkForError(message);
+        InspectorProtocol.sendCommand("DOM.performSearch", {query: "FooBar"}, onSearchCompleted);
     }
 
     function onSearchCompleted(message)
     {
-        InspectorTest.checkForError(message);
-        InspectorTest.log("PASS: Test passes if it doesn't crash.");
-        InspectorTest.completeTest();
+        InspectorProtocol.checkForError(message);
+        ProtocolTest.log("PASS: Test passes if it doesn't crash.");
+        ProtocolTest.completeTest();
     }
 }
 </script>
index f0c22bb..328c30f 100644 (file)
@@ -5,7 +5,7 @@
 function test()
 {
     // Create a DOM listener to convert nodeIds to tag names.
-    InspectorTest.importScript("../dom/resources/InspectorDOMListener.js");
+    ProtocolTest.importScript("../dom/resources/InspectorDOMListener.js");
     var dom = createDOMListener();
 
     // Caching the output to avoid searching through the log.
@@ -44,10 +44,10 @@ function test()
         }
     ];
 
-    InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument);
+    InspectorProtocol.sendCommand("DOM.getDocument", {}, onGotDocument);
 
     function onGotDocument(message) {
-        InspectorTest.checkForError(message);
+        InspectorProtocol.checkForError(message);
         dom.collectNode(message.result.root);
         documentId = message.result.root.nodeId;
         performSearches(domSearchQueries, testFinished);
@@ -68,8 +68,8 @@ function test()
     {
         resolveSelectors(queryData.nodes, function(nodeIds) {
             output.push("=== Query: " + JSON.stringify(queryData.query) + " in [" + queryData.nodes.join(", ") + "] ===");
-            InspectorTest.sendCommand("DOM.performSearch", {query: queryData.query, nodeIds: nodeIds}, function(message) {
-                InspectorTest.checkForError(message);
+            InspectorProtocol.sendCommand("DOM.performSearch", {query: queryData.query, nodeIds: nodeIds}, function(message) {
+                InspectorProtocol.checkForError(message);
                 printSearchResults(message.result, callback);
             });
         });
@@ -82,8 +82,8 @@ function test()
         if (!remaining)
             return callback(results);
         nodes.forEach(function(selector, index) {
-            InspectorTest.sendCommand("DOM.querySelector", {nodeId: documentId, selector: selector}, function(message) {
-                InspectorTest.checkForError(message);
+            InspectorProtocol.sendCommand("DOM.querySelector", {nodeId: documentId, selector: selector}, function(message) {
+                InspectorProtocol.checkForError(message);
                 results[index] = message.result.nodeId;
                 if (--remaining <= 0)
                     callback(results);
@@ -98,7 +98,7 @@ function test()
             return callback();
 
         var options = {"searchId": results.searchId, "fromIndex": 0, "toIndex": results.resultCount};
-        InspectorTest.sendCommand("DOM.getSearchResults", options, function(message) {
+        InspectorProtocol.sendCommand("DOM.getSearchResults", options, function(message) {
             for (var nodeId of message.result.nodeIds)
                 output.push(dom.getNodeIdentifier(nodeId));
             callback();
@@ -107,8 +107,8 @@ function test()
 
     function testFinished()
     {
-        InspectorTest.log(output.join("\n"));
-        InspectorTest.completeTest();
+        ProtocolTest.log(output.join("\n"));
+        ProtocolTest.completeTest();
     }
 }
 </script>
index 423264b..63b4ab6 100644 (file)
@@ -5,19 +5,19 @@
 function test()
 {
     // Loading the queries from external file to avoid having them show up in the results.
-    InspectorTest.importScript("../../../../inspector/dom/resources/dom-search-queries.js");
+    ProtocolTest.importScript("../../../../inspector/dom/resources/dom-search-queries.js");
 
     // Create a DOM listener to convert nodeIds to tag names.
-    InspectorTest.importScript("../dom/resources/InspectorDOMListener.js");
+    ProtocolTest.importScript("../dom/resources/InspectorDOMListener.js");
     var dom = createDOMListener();
 
     // Caching the output to avoid searching through the log.
     var output = [];
 
-    InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument);
+    InspectorProtocol.sendCommand("DOM.getDocument", {}, onGotDocument);
 
     function onGotDocument(message) {
-        InspectorTest.checkForError(message);
+        InspectorProtocol.checkForError(message);
         dom.collectNode(message.result.root);
         performSearches(domSearchQueries, testFinished);
     }
@@ -36,8 +36,8 @@ function test()
     function search(query, callback)
     {
         output.push("=== Query: " + JSON.stringify(query) + " ===");
-        InspectorTest.sendCommand("DOM.performSearch", {query: query}, function(message) {
-            InspectorTest.checkForError(message);
+        InspectorProtocol.sendCommand("DOM.performSearch", {query: query}, function(message) {
+            InspectorProtocol.checkForError(message);
             printSearchResults(message.result, callback);
         });
     }
@@ -49,7 +49,7 @@ function test()
             return callback();
 
         var options = {"searchId": results.searchId, "fromIndex": 0, "toIndex": results.resultCount};
-        InspectorTest.sendCommand("DOM.getSearchResults", options, function onResultsReceived(message) {
+        InspectorProtocol.sendCommand("DOM.getSearchResults", options, function onResultsReceived(message) {
             for (var nodeId of message.result.nodeIds)
                 output.push(dom.getNodeIdentifier(nodeId));
             callback();
@@ -58,8 +58,8 @@ function test()
 
     function testFinished()
     {
-        InspectorTest.log(output.join("\n"));
-        InspectorTest.completeTest();
+        ProtocolTest.log(output.join("\n"));
+        ProtocolTest.completeTest();
     }
 }
 </script>
index dd77e51..21fe199 100644 (file)
@@ -10,32 +10,32 @@ window.addEventListener("load", function() {
 
 function test()
 {
-    InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument);
+    InspectorProtocol.sendCommand("DOM.getDocument", {}, onGotDocument);
 
     function onGotDocument(msg) {
         if (msg.error) {
-            InspectorTest.log(msg.error.message);
-            InspectorTest.completeTest();
+            ProtocolTest.log(msg.error.message);
+            ProtocolTest.completeTest();
             return;
         }
         var node = msg.result.root;
-        InspectorTest.sendCommand("DOM.querySelector", { "nodeId": node.nodeId, "selector": "#second" }, onQuerySelector);
+        InspectorProtocol.sendCommand("DOM.querySelector", { "nodeId": node.nodeId, "selector": "#second" }, onQuerySelector);
     }
 
     function onQuerySelector(msg) {
         if (msg.error) {
-            InspectorTest.log(msg.error.message);
-            InspectorTest.completeTest();
+            ProtocolTest.log(msg.error.message);
+            ProtocolTest.completeTest();
             return;
         }
         var node = msg.result;
-        InspectorTest.sendCommand("DOM.focus", { "nodeId": node.nodeId }, onFocus);
+        InspectorProtocol.sendCommand("DOM.focus", { "nodeId": node.nodeId }, onFocus);
     }
 
     function onFocus(msg) {
         if (msg.error)
-            InspectorTest.log(msg.error);
-        InspectorTest.completeTest();
+            ProtocolTest.log(msg.error);
+        ProtocolTest.completeTest();
     }
 }
 </script>
index 023b78c..2ec615a 100644 (file)
@@ -139,45 +139,45 @@ function test() {
     var documentNodeId = null;
 
     function onGotDocument(response) {
-        InspectorTest.checkForError(response);
+        InspectorProtocol.checkForError(response);
         documentNodeId = response.result.root.nodeId;
-        InspectorTest.sendCommand("DOM.getAccessibilityPropertiesForNode", {"nodeId": documentNodeId}, onGotAccessibilityPropertiesForDocumentNode);
+        InspectorProtocol.sendCommand("DOM.getAccessibilityPropertiesForNode", {"nodeId": documentNodeId}, onGotAccessibilityPropertiesForDocumentNode);
     }
 
     function onGotAccessibilityPropertiesForDocumentNode(response) {
-        InspectorTest.checkForError(response);
-        InspectorTest.log("#document");
+        InspectorProtocol.checkForError(response);
+        ProtocolTest.log("#document");
         logAccessibilityProperties(response.result.properties);
-        InspectorTest.log("\n");
-        InspectorTest.sendCommand("DOM.querySelectorAll", {"nodeId": documentNodeId, "selector": ".ex"}, onGotQuerySelectorAll);
+        ProtocolTest.log("\n");
+        InspectorProtocol.sendCommand("DOM.querySelectorAll", {"nodeId": documentNodeId, "selector": ".ex"}, onGotQuerySelectorAll);
     }
 
     function onGotQuerySelectorAll(response) {
-        InspectorTest.checkForError(response);
+        InspectorProtocol.checkForError(response);
         examples = response.result.nodeIds;
-        InspectorTest.log("Total elements to be tested: " + examples.length + ".");
+        ProtocolTest.log("Total elements to be tested: " + examples.length + ".");
         loop();
     }
 
     function loop() {
         if (examples.length) {
-            InspectorTest.sendCommand("DOM.getOuterHTML", {"nodeId": examples[examples.length-1]}, onGotOuterHTML);
+            InspectorProtocol.sendCommand("DOM.getOuterHTML", {"nodeId": examples[examples.length-1]}, onGotOuterHTML);
         } else {
             finishTest();
         }
     }
 
     function onGotOuterHTML(response) {
-        InspectorTest.checkForError(response);
+        InspectorProtocol.checkForError(response);
         var outerHTML = response.result.outerHTML;
         outerHTML = outerHTML.replace(/ class="ex"/g, ""); // remove any duplicated, unnecessary class attributes
         outerHTML = outerHTML.replace(/;base64,.*?"/, "...\""); // suppress full data URIs in output
-        InspectorTest.log("\n" + outerHTML);
-        InspectorTest.sendCommand("DOM.getAccessibilityPropertiesForNode", {"nodeId": examples[examples.length-1]}, onGotAccessibilityProperties);
+        ProtocolTest.log("\n" + outerHTML);
+        InspectorProtocol.sendCommand("DOM.getAccessibilityPropertiesForNode", {"nodeId": examples[examples.length-1]}, onGotAccessibilityProperties);
     }
 
     function onGotAccessibilityProperties(response) {
-        InspectorTest.checkForError(response);
+        InspectorProtocol.checkForError(response);
         logAccessibilityProperties(response.result.properties);
         examples.pop();
         loop();
@@ -193,7 +193,7 @@ function test() {
             case "mouseEventNodeId":
             case "parentNodeId":
                 if (typeof value === "number")
-                    InspectorTest.log("    " + key + ": exists");
+                    ProtocolTest.log("    " + key + ": exists");
                 break;
             case "childNodeIds":
             case "controlledNodeIds":
@@ -201,23 +201,23 @@ function test() {
             case "ownedNodeIds":
             case "selectedChildNodeIds":
                 if (typeof value === "object" && value.length)
-                    InspectorTest.log("    " + key + ".length: " + value.length);
+                    ProtocolTest.log("    " + key + ".length: " + value.length);
                 break;
             default:
-                InspectorTest.log("    " + key + ": " + value);
+                ProtocolTest.log("    " + key + ": " + value);
             }
         }
     }
 
     function finishTest() {
-        InspectorTest.sendCommand("Runtime.evaluate", {"expression": "cleanup()"}, function(){
-            InspectorTest.completeTest();
+        InspectorProtocol.sendCommand("Runtime.evaluate", {"expression": "cleanup()"}, function(){
+            ProtocolTest.completeTest();
         });
     }
 
 
 
-    InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument);
+    InspectorProtocol.sendCommand("DOM.getDocument", {}, onGotDocument);
 
 }
 </script>
index 5c1a260..bb1491f 100644 (file)
@@ -62,36 +62,36 @@ function test() {
     var bodyNodeId = null;
 
     function onGotDocument(response) {
-        InspectorTest.checkForError(response);
+        InspectorProtocol.checkForError(response);
         documentNodeId = response.result.root.nodeId;
-        InspectorTest.sendCommand("DOM.querySelectorAll", {"nodeId": documentNodeId, "selector": ".ex"}, onGotQuerySelectorAll);
+        InspectorProtocol.sendCommand("DOM.querySelectorAll", {"nodeId": documentNodeId, "selector": ".ex"}, onGotQuerySelectorAll);
     }
 
     function onGotQuerySelectorAll(response) {
-        InspectorTest.checkForError(response);
+        InspectorProtocol.checkForError(response);
         examples = response.result.nodeIds;
-        InspectorTest.log("Total elements to be tested: " + examples.length + ".");
+        ProtocolTest.log("Total elements to be tested: " + examples.length + ".");
         loop();
     }
 
     function loop() {
         if (examples.length) {
-            InspectorTest.sendCommand("DOM.getOuterHTML", {"nodeId": examples[examples.length-1]}, onGotOuterHTML);
+            InspectorProtocol.sendCommand("DOM.getOuterHTML", {"nodeId": examples[examples.length-1]}, onGotOuterHTML);
         } else {
             finishTest();
         }
     }
 
     function onGotOuterHTML(response) {
-        InspectorTest.checkForError(response);
+        InspectorProtocol.checkForError(response);
         var outerHTML = response.result.outerHTML;
         outerHTML = outerHTML.replace(/ class="ex"/g, ""); // remove any duplicated, unnecessary class attributes
-        InspectorTest.log("\n" + outerHTML);
-        InspectorTest.sendCommand("DOM.getAccessibilityPropertiesForNode", {"nodeId": examples[examples.length-1]}, onGotAccessibilityProperties);
+        ProtocolTest.log("\n" + outerHTML);
+        InspectorProtocol.sendCommand("DOM.getAccessibilityPropertiesForNode", {"nodeId": examples[examples.length-1]}, onGotAccessibilityProperties);
     }
 
     function onGotAccessibilityProperties(response) {
-        InspectorTest.checkForError(response);
+        InspectorProtocol.checkForError(response);
         logAccessibilityProperties(response.result.properties);
         examples.pop();
         loop();
@@ -106,7 +106,7 @@ function test() {
             case "liveRegionAtomic":
             case "liveRegionRelevant":
             case "liveRegionStatus":
-                InspectorTest.log("    " + key + ": " + value);
+                ProtocolTest.log("    " + key + ": " + value);
                 break;
             default:
                 continue;
@@ -115,12 +115,12 @@ function test() {
     }
 
     function finishTest() {
-        InspectorTest.sendCommand("Runtime.evaluate", {"expression": "cleanup()"}, function(){
-            InspectorTest.completeTest();
+        InspectorProtocol.sendCommand("Runtime.evaluate", {"expression": "cleanup()"}, function(){
+            ProtocolTest.completeTest();
         });
     }
 
-    InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument);
+    InspectorProtocol.sendCommand("DOM.getDocument", {}, onGotDocument);
 
 }
 </script>
index dbb5ab8..ce6f210 100644 (file)
@@ -76,47 +76,47 @@ function test() {
     var bodyNodeId = null;
 
     function onGotDocument(response) {
-        InspectorTest.checkForError(response);
+        InspectorProtocol.checkForError(response);
         documentNodeId = response.result.root.nodeId;
-        InspectorTest.sendCommand("DOM.querySelector", {"nodeId": documentNodeId, "selector": "body"}, onGotBody);
+        InspectorProtocol.sendCommand("DOM.querySelector", {"nodeId": documentNodeId, "selector": "body"}, onGotBody);
     }
 
     function onGotBody(response) {
-        InspectorTest.checkForError(response);
+        InspectorProtocol.checkForError(response);
         bodyNodeId = response.result.nodeId;
-        InspectorTest.sendCommand("DOM.getAccessibilityPropertiesForNode", {"nodeId": bodyNodeId}, onGotAccessibilityPropertiesForBodyNode);
+        InspectorProtocol.sendCommand("DOM.getAccessibilityPropertiesForNode", {"nodeId": bodyNodeId}, onGotAccessibilityPropertiesForBodyNode);
     }
 
     function onGotAccessibilityPropertiesForBodyNode(response) {
-        InspectorTest.checkForError(response);
-        InspectorTest.sendCommand("DOM.querySelectorAll", {"nodeId": documentNodeId, "selector": ".ex"}, onGotQuerySelectorAll);
+        InspectorProtocol.checkForError(response);
+        InspectorProtocol.sendCommand("DOM.querySelectorAll", {"nodeId": documentNodeId, "selector": ".ex"}, onGotQuerySelectorAll);
     }
 
     function onGotQuerySelectorAll(response) {
-        InspectorTest.checkForError(response);
+        InspectorProtocol.checkForError(response);
         examples = response.result.nodeIds;
-        InspectorTest.log("Total elements to be tested: " + examples.length + ".");
+        ProtocolTest.log("Total elements to be tested: " + examples.length + ".");
         loop();
     }
 
     function loop() {
         if (examples.length) {
-            InspectorTest.sendCommand("DOM.getOuterHTML", {"nodeId": examples[examples.length-1]}, onGotOuterHTML);
+            InspectorProtocol.sendCommand("DOM.getOuterHTML", {"nodeId": examples[examples.length-1]}, onGotOuterHTML);
         } else {
             finishTest();
         }
     }
 
     function onGotOuterHTML(response) {
-        InspectorTest.checkForError(response);
+        InspectorProtocol.checkForError(response);
         var outerHTML = response.result.outerHTML;
         outerHTML = outerHTML.replace(/ class="ex"/g, ""); // remove any duplicated, unnecessary class attributes
-        InspectorTest.log("\n" + outerHTML);
-        InspectorTest.sendCommand("DOM.getAccessibilityPropertiesForNode", {"nodeId": examples[examples.length-1]}, onGotAccessibilityProperties);
+        ProtocolTest.log("\n" + outerHTML);
+        InspectorProtocol.sendCommand("DOM.getAccessibilityPropertiesForNode", {"nodeId": examples[examples.length-1]}, onGotAccessibilityProperties);
     }
 
     function onGotAccessibilityProperties(response) {
-        InspectorTest.checkForError(response);
+        InspectorProtocol.checkForError(response);
         logAccessibilityProperties(response.result.properties);
         examples.pop();
         loop();
@@ -132,16 +132,16 @@ function test() {
                 msg += "self";
             else
                 msg += "ancestor element";
-            InspectorTest.log(msg);
+            ProtocolTest.log(msg);
     }
 
     function finishTest() {
-        InspectorTest.sendCommand("Runtime.evaluate", {"expression": "cleanup()"}, function(){
-            InspectorTest.completeTest();
+        InspectorProtocol.sendCommand("Runtime.evaluate", {"expression": "cleanup()"}, function(){
+            ProtocolTest.completeTest();
         });
     }
 
-    InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument);
+    InspectorProtocol.sendCommand("DOM.getDocument", {}, onGotDocument);
 
 }
 </script>
index b308f43..09c346d 100644 (file)
@@ -9,16 +9,16 @@
 <script>
 function test()
 {
-    InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument);
+    InspectorProtocol.sendCommand("DOM.getDocument", {}, onGotDocument);
 
     function onGotDocument(msg) {
-        InspectorTest.checkForError(msg);
+        InspectorProtocol.checkForError(msg);
         var node = msg.result.root;
-        InspectorTest.sendCommand("DOM.querySelector", { "nodeId": node.nodeId, "selector": "#inspectedElement" }, onQuerySelector);
+        InspectorProtocol.sendCommand("DOM.querySelector", { "nodeId": node.nodeId, "selector": "#inspectedElement" }, onQuerySelector);
     }
 
     function onQuerySelector(msg) {
-        InspectorTest.checkForError(msg);
+        InspectorProtocol.checkForError(msg);
         var node = msg.result;
         var highlightConfig = {
             showInfo: true,
@@ -27,12 +27,12 @@ function test()
             borderColor: {r: 255, g: 255, b: 255},
             marginColor: {r: 255, g: 255, b: 255},
         };
-        InspectorTest.sendCommand("DOM.highlightNode", { "highlightConfig": highlightConfig, "nodeId": node.nodeId }, onHighlightComplete);
+        InspectorProtocol.sendCommand("DOM.highlightNode", { "highlightConfig": highlightConfig, "nodeId": node.nodeId }, onHighlightComplete);
     }
 
     function onHighlightComplete(msg) {
-        InspectorTest.checkForError(msg);
-        InspectorTest.completeTest();
+        InspectorProtocol.checkForError(msg);
+        ProtocolTest.completeTest();
     }
 }
 </script>
index 138ffcc..511ad48 100644 (file)
@@ -18,9 +18,9 @@ function test()
 {
     var nodesById = {};
 
-    InspectorTest.eventHandler["DOM.setChildNodes"] = onSetChildNodes;
-    InspectorTest.eventHandler["DOM.childNodeRemoved"] = onChildNodeRemoved;
-    InspectorTest.eventHandler["DOM.childNodeInserted"] = onChildNodeInserted;
+    InspectorProtocol.eventHandler["DOM.setChildNodes"] = onSetChildNodes;
+    InspectorProtocol.eventHandler["DOM.childNodeRemoved"] = onChildNodeRemoved;
+    InspectorProtocol.eventHandler["DOM.childNodeInserted"] = onChildNodeInserted;
 
     function createNodeAttributesMap(attributes)
     {
@@ -67,32 +67,32 @@ function test()
     function onChildNodeRemoved(response)
     {
         var nodeId = response.params.nodeId;
-        InspectorTest.log("Removing node " + getNodeIdentifier(nodeId));
+        ProtocolTest.log("Removing node " + getNodeIdentifier(nodeId));
         delete nodesById[nodeId];
     }
 
     function onChildNodeInserted(response)
     {
         collectNode(response.params.node);
-        InspectorTest.log("Inserting node " + getNodeIdentifier(response.params.node.nodeId) + " into " + getNodeIdentifier(response.params.parentNodeId));
+        ProtocolTest.log("Inserting node " + getNodeIdentifier(response.params.node.nodeId) + " into " + getNodeIdentifier(response.params.parentNodeId));
     }
 
-    InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument);
+    InspectorProtocol.sendCommand("DOM.getDocument", {}, onGotDocument);
 
     function onGotDocument(msg)
     {
-        InspectorTest.checkForError(msg);
-        InspectorTest.sendCommand("DOM.querySelectorAll", {"nodeId": msg.result.root.nodeId, "selector": "#parent_container,#final_container"}, onQuerySelectorAll);
+        InspectorProtocol.checkForError(msg);
+        InspectorProtocol.sendCommand("DOM.querySelectorAll", {"nodeId": msg.result.root.nodeId, "selector": "#parent_container,#final_container"}, onQuerySelectorAll);
     }
 
     function onQuerySelectorAll(response)
     {
         // Make sure we receive the children of the "#final_container" as they are added.
         for (var i = 0; i < response.result.nodeIds.length; ++i)
-            InspectorTest.sendCommand("DOM.requestChildNodes", {nodeId: response.result.nodeIds[i]});
+            InspectorProtocol.sendCommand("DOM.requestChildNodes", {nodeId: response.result.nodeIds[i]});
         
-        InspectorTest.sendCommand("Runtime.evaluate", {"expression": "moveNode()"}, function() {
-            InspectorTest.completeTest();
+        InspectorProtocol.sendCommand("Runtime.evaluate", {"expression": "moveNode()"}, function() {
+            ProtocolTest.completeTest();
         });
     }
 }
index eef9d99..4d3dfdf 100644 (file)
@@ -9,7 +9,7 @@ function test()
 
     getDocument();
 
-    InspectorTest.eventHandler["DOM.setChildNodes"] = function setChildNodes(messageObject)
+    InspectorProtocol.eventHandler["DOM.setChildNodes"] = function setChildNodes(messageObject)
     {
         eventsCount++;
 
@@ -20,7 +20,7 @@ function test()
         else if (eventsCount === 3)
             gotAllChildren(messageObject);
         else
-            InspectorTest.log(JSON.stringify(messageObject, null, "    "));
+            ProtocolTest.log(JSON.stringify(messageObject, null, "    "));
     };
 
     function getDocument()
@@ -104,15 +104,15 @@ function test()
     {
         assert("Expected number of setChildNodes events", eventsCount, 3);
 
-        InspectorTest.completeTest();
+        ProtocolTest.completeTest();
     };
 
     function step(test)
     {
-        InspectorTest.log("\n=== " + test.name + " ===\n");
-        InspectorTest.sendCommand(test.command, test.parameters, function(messageObject) {
+        ProtocolTest.log("\n=== " + test.name + " ===\n");
+        InspectorProtocol.sendCommand(test.command, test.parameters, function(messageObject) {
             if (messageObject.hasOwnProperty("error"))
-                InspectorTest.log("Backend error: " + messageObject.error.message + " (" + messageObject.error.code + ")\n");
+                ProtocolTest.log("Backend error: " + messageObject.error.message + " (" + messageObject.error.code + ")\n");
 
             if (test.callback)
                 test.callback(messageObject.result);
@@ -122,10 +122,10 @@ function test()
     function assert(message, actual, expected)
     {
         if (actual === expected)
-            InspectorTest.log("PASS: " + message);
+            ProtocolTest.log("PASS: " + message);
         else {
-            InspectorTest.log("FAIL: " + message + ", expected \"" + expected + "\" but got \"" + actual + "\"");
-            InspectorTest.completeTest();
+            ProtocolTest.log("FAIL: " + message + ", expected \"" + expected + "\" but got \"" + actual + "\"");
+            ProtocolTest.completeTest();
         }
     };
 };
index dc08b42..004227d 100644 (file)
@@ -8,7 +8,7 @@ function test()
 
     var nodes;
  
-    InspectorTest.eventHandler["DOM.setChildNodes"] = setChildNodes;
+    InspectorProtocol.eventHandler["DOM.setChildNodes"] = setChildNodes;
 
     enableLayerTreeAgent();
     
@@ -71,7 +71,7 @@ function test()
         assert("Node has id", node.attributes[0], "id");
         assert("Node has expected id", node.attributes[1], "first-letter");
         
-        InspectorTest.completeTest();
+        ProtocolTest.completeTest();
     };
 
     function setChildNodes (messageObject) {
@@ -87,20 +87,20 @@ function test()
 
     function logTestName(name)
     {
-        InspectorTest.log("\n=== " + name + " ===\n");
+        ProtocolTest.log("\n=== " + name + " ===\n");
     };
 
     function runCommand(command)
     {
-        InspectorTest.sendCommand(command.command, command.parameters, function(messageObject) {
+        InspectorProtocol.sendCommand(command.command, command.parameters, function(messageObject) {
             if (messageObject.hasOwnProperty("error")) {
-                InspectorTest.log("FAIL: " + messageObject.error.message + " (" + messageObject.error.code + ")");
-                InspectorTest.completeTest();
+                ProtocolTest.log("FAIL: " + messageObject.error.message + " (" + messageObject.error.code + ")");
+                ProtocolTest.completeTest();
                 return;
             }
 
             if (command.name)
-                InspectorTest.log("PASS");
+                ProtocolTest.log("PASS");
 
             if (command.callback)
                 command.callback(messageObject.result);
@@ -110,9 +110,9 @@ function test()
     function assert(name, actual, expected)
     {
         if (expected === actual)
-            InspectorTest.log("PASS: " + name + ".");
+            ProtocolTest.log("PASS: " + name + ".");
         else
-            InspectorTest.log("FAIL: " + name + ". Expected " + expected + " but got " + actual);
+            ProtocolTest.log("FAIL: " + name + ". Expected " + expected + " but got " + actual);
     };
 
 };
index 0940b92..fc887b7 100644 (file)
@@ -8,7 +8,7 @@ function test()
 
     var nodes = [];
  
-    InspectorTest.eventHandler["DOM.setChildNodes"] = setChildNodes;
+    InspectorProtocol.eventHandler["DOM.setChildNodes"] = setChildNodes;
 
     enableLayerTreeAgent();
     
@@ -76,7 +76,7 @@ function test()
             }
 
             if (++count === layers.length)
-                InspectorTest.completeTest();
+                ProtocolTest.completeTest();
         };
 
         layers.forEach(function (layer) {
@@ -105,16 +105,16 @@ function test()
 
     function logTestName(name)
     {
-        InspectorTest.log("\n=== " + name + " ===\n");
+        ProtocolTest.log("\n=== " + name + " ===\n");
     };
 
     function runCommand(command)
     {
-        InspectorTest.sendCommand(command.command, command.parameters, function(messageObject) {
-            InspectorTest.checkForError(messageObject);
+        InspectorProtocol.sendCommand(command.command, command.parameters, function(messageObject) {
+            InspectorProtocol.checkForError(messageObject);
 
             if (command.name)
-                InspectorTest.log("PASS");
+                ProtocolTest.log("PASS");
 
             if (command.callback)
                 command.callback(messageObject.result);
@@ -124,9 +124,9 @@ function test()
     function assert(name, actual, expected)
     {
         if (expected === actual)
-            InspectorTest.log("PASS: " + name + ".");
+            ProtocolTest.log("PASS: " + name + ".");
         else
-            InspectorTest.log("FAIL: " + name + ". Expected " + expected + " but got " + actual);
+            ProtocolTest.log("FAIL: " + name + ". Expected " + expected + " but got " + actual);
     };
 
 };
index 1e38032..5bd9351 100644 (file)
@@ -8,7 +8,7 @@ function test()
 
     var nodes = [];
  
-    InspectorTest.eventHandler["DOM.setChildNodes"] = setChildNodes;
+    InspectorProtocol.eventHandler["DOM.setChildNodes"] = setChildNodes;
 
     enableLayerTreeAgent();
     
@@ -76,7 +76,7 @@ function test()
             }
 
             if (++count === layers.length)
-                InspectorTest.completeTest();
+                ProtocolTest.completeTest();
         };
 
         layers.forEach(function (layer) {
@@ -105,20 +105,20 @@ function test()
 
     function logTestName(name)
     {
-        InspectorTest.log("\n=== " + name + " ===\n");
+        ProtocolTest.log("\n=== " + name + " ===\n");
     };
 
     function runCommand(command)
     {
-        InspectorTest.sendCommand(command.command, command.parameters, function(messageObject) {
+        InspectorProtocol.sendCommand(command.command, command.parameters, function(messageObject) {
             if (messageObject.hasOwnProperty("error")) {
-                InspectorTest.log("FAIL: " + messageObject.error.message + " (" + messageObject.error.code + ")");
-                InspectorTest.completeTest();
+                ProtocolTest.log("FAIL: " + messageObject.error.message + " (" + messageObject.error.code + ")");
+                ProtocolTest.completeTest();
                 return;
             }
 
             if (command.name)
-                InspectorTest.log("PASS");
+                ProtocolTest.log("PASS");
 
             if (command.callback)
                 command.callback(messageObject.result);
@@ -128,9 +128,9 @@ function test()
     function assert(name, actual, expected)
     {
         if (expected === actual)
-            InspectorTest.log("PASS: " + name + ".");
+            ProtocolTest.log("PASS: " + name + ".");
         else
-            InspectorTest.log("FAIL: " + name + ". Expected " + expected + " but got " + actual);
+            ProtocolTest.log("FAIL: " + name + ". Expected " + expected + " but got " + actual);
     };
 
 };
index cfd655d..d5fed01 100644 (file)
@@ -17,7 +17,7 @@ function test()
     var initialLayers;
     var eventsCount = 0;
 
-    InspectorTest.eventHandler["LayerTree.layerTreeDidChange"] = function (messageObject) {
+    InspectorProtocol.eventHandler["LayerTree.layerTreeDidChange"] = function (messageObject) {
         eventsCount++;
     };
 
@@ -99,7 +99,7 @@ function test()
     {
         var attributes = attributesDictionaryFromArray(result.attributes);
         if (attributes.id !== "last-element")
-            InspectorTest.log("FAIL: Did not obtain the expected element for the last inserted layer.");
+            ProtocolTest.log("FAIL: Did not obtain the expected element for the last inserted layer.");
 
         finishTest();
     };
@@ -107,11 +107,11 @@ function test()
     function finishTest()
     {
         if (!eventsCount)
-            InspectorTest.log("FAIL: Did not receive layerTreeDidChange events.");
+            ProtocolTest.log("FAIL: Did not receive layerTreeDidChange events.");
         else
-            InspectorTest.log("\n=== Test complete, all expected conditions met ===");
+            ProtocolTest.log("\n=== Test complete, all expected conditions met ===");
 
-        InspectorTest.completeTest();
+        ProtocolTest.completeTest();
     };
 
     function layerMutations(oldLayers, newLayers)
@@ -157,20 +157,20 @@ function test()
             return value;
         };
         
-        InspectorTest.log("\n" + JSON.stringify(layers, replacer, "    "));
+        ProtocolTest.log("\n" + JSON.stringify(layers, replacer, "    "));
     };
 
     function step(test)
     {
-        InspectorTest.log("\n=== " + test.name + " ===\n")
-        InspectorTest.sendCommand(test.command, test.parameters, function(messageObject) {
+        ProtocolTest.log("\n=== " + test.name + " ===\n")
+        InspectorProtocol.sendCommand(test.command, test.parameters, function(messageObject) {
             if (messageObject.hasOwnProperty("error")) {
-                InspectorTest.log("FAIL: " + messageObject.error.message + " (" + messageObject.error.code + ")");
-                InspectorTest.completeTest();
+                ProtocolTest.log("FAIL: " + messageObject.error.message + " (" + messageObject.error.code + ")");
+                ProtocolTest.completeTest();
                 return;
             }
 
-            InspectorTest.log("PASS");
+            ProtocolTest.log("PASS");
             test.callback(messageObject.result);
         });
     };
@@ -178,9 +178,9 @@ function test()
     function assert(name, actual, expected)
     {
         if (expected === actual)
-            InspectorTest.log("PASS: " + name + ".");
+            ProtocolTest.log("PASS: " + name + ".");
         else
-            InspectorTest.log("FAIL: " + name + ". Expected " + expected + " but got " + actual);
+            ProtocolTest.log("FAIL: " + name + ". Expected " + expected + " but got " + actual);
     };
 
 };
index 4709ce3..ee9da7d 100644 (file)
@@ -8,7 +8,7 @@ function test()
 
     var nodes;
  
-    InspectorTest.eventHandler["DOM.setChildNodes"] = setChildNodes;
+    InspectorProtocol.eventHandler["DOM.setChildNodes"] = setChildNodes;
 
     enableLayerTreeAgent();
     
@@ -88,7 +88,7 @@ function test()
         assert("Generating node has id", node.attributes[0], "id");
         assert("Generating node has expected id", node.attributes[1], "generator");
         
-        InspectorTest.completeTest();
+        ProtocolTest.completeTest();
     };
 
     function setChildNodes (messageObject) {
@@ -104,20 +104,20 @@ function test()
 
     function logTestName(name)
     {
-        InspectorTest.log("\n=== " + name + " ===\n");
+        ProtocolTest.log("\n=== " + name + " ===\n");
     };
 
     function runCommand(command)
     {
-        InspectorTest.sendCommand(command.command, command.parameters, function(messageObject) {
+        InspectorProtocol.sendCommand(command.command, command.parameters, function(messageObject) {
             if (messageObject.hasOwnProperty("error")) {
-                InspectorTest.log("FAIL: " + messageObject.error.message + " (" + messageObject.error.code + ")");
-                InspectorTest.completeTest();
+                ProtocolTest.log("FAIL: " + messageObject.error.message + " (" + messageObject.error.code + ")");
+                ProtocolTest.completeTest();
                 return;
             }
 
             if (command.name)
-                InspectorTest.log("PASS");
+                ProtocolTest.log("PASS");
 
             if (command.callback)
                 command.callback(messageObject.result);
@@ -127,9 +127,9 @@ function test()
     function assert(name, actual, expected)
     {
         if (expected === actual)
-            InspectorTest.log("PASS: " + name + ".");
+            ProtocolTest.log("PASS: " + name + ".");
         else
-            InspectorTest.log("FAIL: " + name + ". Expected " + expected + " but got " + actual);
+            ProtocolTest.log("FAIL: " + name + ". Expected " + expected + " but got " + actual);
     };
 
 };
index 0322058..b2fc90f 100644 (file)
@@ -8,7 +8,7 @@ function test()
 
     var nodes;
  
-    InspectorTest.eventHandler["DOM.setChildNodes"] = setChildNodes;
+    InspectorProtocol.eventHandler["DOM.setChildNodes"] = setChildNodes;
 
     enableLayerTreeAgent();
     
@@ -72,7 +72,7 @@ function test()
         assert("Node has CSS class", node.attributes[0], "class");
         assert("Node has expected CSS class", node.attributes[1], "reflected composited");
         
-        InspectorTest.completeTest();
+        ProtocolTest.completeTest();
     };
 
     function setChildNodes (messageObject) {
@@ -88,20 +88,20 @@ function test()
 
     function logTestName(name)
     {
-        InspectorTest.log("\n=== " + name + " ===\n");
+        ProtocolTest.log("\n=== " + name + " ===\n");
     };
 
     function runCommand(command)
     {
-        InspectorTest.sendCommand(command.command, command.parameters, function(messageObject) {
+        InspectorProtocol.sendCommand(command.command, command.parameters, function(messageObject) {
             if (messageObject.hasOwnProperty("error")) {
-                InspectorTest.log("FAIL: " + messageObject.error.message + " (" + messageObject.error.code + ")");
-                InspectorTest.completeTest();
+                ProtocolTest.log("FAIL: " + messageObject.error.message + " (" + messageObject.error.code + ")");
+                ProtocolTest.completeTest();
                 return;
             }
 
             if (command.name)
-                InspectorTest.log("PASS");
+                ProtocolTest.log("PASS");
 
             if (command.callback)
                 command.callback(messageObject.result);
@@ -111,9 +111,9 @@ function test()
     function assert(name, actual, expected)
     {
         if (expected === actual)
-            InspectorTest.log("PASS: " + name + ".");
+            ProtocolTest.log("PASS: " + name + ".");
         else
-            InspectorTest.log("FAIL: " + name + ". Expected " + expected + " but got " + actual);
+            ProtocolTest.log("FAIL: " + name + ". Expected " + expected + " but got " + actual);
     };
 
 };
index 8aedf3d..2bcb2a4 100644 (file)
@@ -4,17 +4,17 @@
 <script>
 function test()
 {
-    InspectorTest.sendCommand("Page.enable", {});
-    InspectorTest.sendCommand("Page.archive", {}, function(event) {
+    InspectorProtocol.sendCommand("Page.enable", {});
+    InspectorProtocol.sendCommand("Page.archive", {}, function(event) {
         var data = event.result.data;
         if (!data)
-            InspectorTest.log("FAIL: no data");
+            ProtocolTest.log("FAIL: no data");
         else if (data.length < 1000)
-            InspectorTest.log("FAIL: unexpectedly short data. A serialized archive should be pretty large.");
+            ProtocolTest.log("FAIL: unexpectedly short data. A serialized archive should be pretty large.");
         else
-            InspectorTest.log("PASS: Received archive data.");
+            ProtocolTest.log("PASS: Received archive data.");
 
-        InspectorTest.completeTest();
+        ProtocolTest.completeTest();
     });
 }
 </script>
index 5ab19ec..44d8bae 100644 (file)
@@ -10,29 +10,29 @@ function load()
 
 function test()
 {
-    InspectorTest.eventHandler["Page.frameScheduledNavigation"] = onScheduled;
-    InspectorTest.eventHandler["Page.frameStartedLoading"] = onStarted;
-    InspectorTest.eventHandler["Page.frameClearedScheduledNavigation"] = onCleared;
-    InspectorTest.sendCommand("Page.enable", {});
+    InspectorProtocol.eventHandler["Page.frameScheduledNavigation"] = onScheduled;
+    InspectorProtocol.eventHandler["Page.frameStartedLoading"] = onStarted;
+    InspectorProtocol.eventHandler["Page.frameClearedScheduledNavigation"] = onCleared;
+    InspectorProtocol.sendCommand("Page.enable", {});
 
     function onScheduled(msg)
     {
-        InspectorTest.log("Scheduled navigation with delay " + msg.params.delay);
+        ProtocolTest.log("Scheduled navigation with delay " + msg.params.delay);
     }
 
     function onStarted(msg)
     {
         // This event should be received before the scheduled navigation is cleared.
-        InspectorTest.log("Started loading");
+        ProtocolTest.log("Started loading");
     }
 
     function onCleared(msg)
     {
-        InspectorTest.log("Cleared scheduled navigation");
-        InspectorTest.completeTest();
+        ProtocolTest.log("Cleared scheduled navigation");
+        ProtocolTest.completeTest();
     }
 
-    InspectorTest.sendCommand("Runtime.evaluate", { "expression": "load()" });
+    InspectorProtocol.sendCommand("Runtime.evaluate", { "expression": "load()" });
 }
 
 </script>
index b3a940d..1fb2d03 100644 (file)
@@ -12,21 +12,21 @@ function load()
 
 function test()
 {
-    InspectorTest.eventHandler["Page.frameStartedLoading"] = onStart;
-    InspectorTest.eventHandler["Page.frameStoppedLoading"] = onStop;
-    InspectorTest.sendCommand("Page.enable", {});
+    InspectorProtocol.eventHandler["Page.frameStartedLoading"] = onStart;
+    InspectorProtocol.eventHandler["Page.frameStoppedLoading"] = onStop;
+    InspectorProtocol.sendCommand("Page.enable", {});
 
     function onStart()
     {
-        InspectorTest.log("Started loading");
+        ProtocolTest.log("Started loading");
     }
     function onStop()
     {
-        InspectorTest.log("Stopped loading");
-        InspectorTest.completeTest();
+        ProtocolTest.log("Stopped loading");
+        ProtocolTest.completeTest();
     }
 
-    InspectorTest.sendCommand("Runtime.evaluate", { "expression": "load()" });
+    InspectorProtocol.sendCommand("Runtime.evaluate", { "expression": "load()" });
 }
 
 </script>
index 04e37b0..ef6d389 100644 (file)
@@ -13,27 +13,27 @@ function onBeforeUnload()
 
 function test()
 {
-    InspectorTest.eventHandler["Page.javascriptDialogOpening"] = onOpening;
-    InspectorTest.eventHandler["Page.javascriptDialogClosed"] = onClosed;
-    InspectorTest.sendCommand("Page.enable", {});
+    InspectorProtocol.eventHandler["Page.javascriptDialogOpening"] = onOpening;
+    InspectorProtocol.eventHandler["Page.javascriptDialogClosed"] = onClosed;
+    InspectorProtocol.sendCommand("Page.enable", {});
 
     function onOpening(event)
     {
-        InspectorTest.log("Opening with message: " + event.params.message);
+        ProtocolTest.log("Opening with message: " + event.params.message);
     }
     function onClosed()
     {
-        InspectorTest.log("Closed");
+        ProtocolTest.log("Closed");
     }
 
-    InspectorTest.sendCommand("Page.navigate", { "url": "nosuchurl" });
-    InspectorTest.sendCommand("Runtime.evaluate", { "expression": "alert('alert')" });
-    InspectorTest.sendCommand("Runtime.evaluate", { "expression": "confirm('confirm')" });
-    InspectorTest.sendCommand("Runtime.evaluate", { "expression": "prompt('prompt')" }, onDone);
+    InspectorProtocol.sendCommand("Page.navigate", { "url": "nosuchurl" });
+    InspectorProtocol.sendCommand("Runtime.evaluate", { "expression": "alert('alert')" });
+    InspectorProtocol.sendCommand("Runtime.evaluate", { "expression": "confirm('confirm')" });
+    InspectorProtocol.sendCommand("Runtime.evaluate", { "expression": "prompt('prompt')" }, onDone);
 
     function onDone()
     {
-        InspectorTest.completeTest();
+        ProtocolTest.completeTest();
     }
 }
 
index 188a5a5..bd18757 100644 (file)
@@ -9,12 +9,12 @@ theMediaQueryList.addListener(function(aMediaQueryList) {
 
 function test()
 {
-    InspectorTest.sendCommand("Page.enable", {});
-    InspectorTest.sendCommand("Page.setEmulatedMedia", {"media": "print"}, function(messageObject) {
+    InspectorProtocol.sendCommand("Page.enable", {});
+    InspectorProtocol.sendCommand("Page.setEmulatedMedia", {"media": "print"}, function(messageObject) {
         if (messageObject.error)
-            InspectorTest.log("FAILED: " + messageObject.error.message);
-        InspectorTest.sendCommand("Page.disable", {});
-        InspectorTest.completeTest();
+            ProtocolTest.log("FAILED: " + messageObject.error.message);
+        InspectorProtocol.sendCommand("Page.disable", {});
+        ProtocolTest.completeTest();
     });
 }
 </script>
index c44fe23..b11b64d 100644 (file)
@@ -4,7 +4,7 @@
 <script>
 function test()
 {
-    var suite = new InspectorTest.AsyncTestSuite("Runtime.getProperties");
+    var suite = new ProtocolTest.AsyncTestSuite("Runtime.getProperties");
 
     addGetPropertiesTestCase({
         name: "CheckPropertiesOfWrapperObject",
@@ -33,8 +33,8 @@ function test()
             name,
             description,
             test: function(resolve, reject) {
-                InspectorTest.log("Evaluating expression: " + expression);
-                InspectorTest.awaitCommand({
+                ProtocolTest.log("Evaluating expression: " + expression);
+                InspectorProtocol.awaitCommand({
                     method: "Runtime.evaluate",
                     params: {expression}
                 })
@@ -43,7 +43,7 @@ function test()
                     if (objectId === undefined)
                         throw new Error("objectId is expected");
 
-                    return InspectorTest.awaitCommand({
+                    return InspectorProtocol.awaitCommand({
                         method: "Runtime.getProperties",
                         params: {objectId, ownProperties: true}
                     });
@@ -61,14 +61,14 @@ function test()
     function dumpGetPropertiesResult(protocolResult) {
         var properties = protocolResult.result;
         if (properties) {
-            InspectorTest.log("Properties:");
+            ProtocolTest.log("Properties:");
             properties.sort(NamedThingComparator);
             properties.map(dumpSingleProperty);
         }
 
         var internalProperties = protocolResult.internalProperties;
         if (internalProperties) {
-            InspectorTest.log("Internal properties:");
+            ProtocolTest.log("Internal properties:");
             internalProperties.sort(NamedThingComparator);
             internalProperties.map(dumpSingleProperty);
         }
@@ -76,9 +76,9 @@ function test()
         function dumpSingleProperty(property) {
             var {name, value} = property;
             if (value)
-                InspectorTest.log("  " + name + " " + value.type + " " + (value.value || value.description));
+                ProtocolTest.log("  " + name + " " + value.type + " " + (value.value || value.description));
             else
-                InspectorTest.log("  " + name);
+                ProtocolTest.log("  " + name);
         }
 
         function NamedThingComparator(o1, o2) {
index e25de42..863148a 100644 (file)
@@ -6,60 +6,60 @@
 function test()
 {
     try {
-        new InspectorTest.AsyncTestSuite();
-        InspectorTest.log("FAIL: instantiating AsyncTestSuite requires name argument.");
+        new ProtocolTest.AsyncTestSuite();
+        ProtocolTest.log("FAIL: instantiating AsyncTestSuite requires name argument.");
     } catch (e) {
-        InspectorTest.log("PASS: instantiating AsyncTestSuite requires name argument.");
+        ProtocolTest.log("PASS: instantiating AsyncTestSuite requires name argument.");
     }
 
     try {
-        new InspectorTest.AsyncTestSuite({});
-        InspectorTest.log("FAIL: instantiating AsyncTestSuite requires string name argument.");
+        new ProtocolTest.AsyncTestSuite({});
+        ProtocolTest.log("FAIL: instantiating AsyncTestSuite requires string name argument.");
     } catch (e) {
-        InspectorTest.log("PASS: instantiating AsyncTestSuite requires string name argument.");
+        ProtocolTest.log("PASS: instantiating AsyncTestSuite requires string name argument.");
     }
 
-    var badArgsSuite = new InspectorTest.AsyncTestSuite("dummy");
+    var badArgsSuite = new ProtocolTest.AsyncTestSuite("dummy");
     try {
         badArgsSuite.addTestCase();
-        InspectorTest.log("FAIL: should not be able to add empty test case.");
+        ProtocolTest.log("FAIL: should not be able to add empty test case.");
     } catch (e) {
-        InspectorTest.log("PASS: should not be able to add empty test case.");
+        ProtocolTest.log("PASS: should not be able to add empty test case.");
     }
     try {
         badArgsSuite.addTestCase("string");
-        InspectorTest.log("FAIL: should not be able to add non-object test case.");
+        ProtocolTest.log("FAIL: should not be able to add non-object test case.");
     } catch (e) {
-        InspectorTest.log("PASS: should not be able to add non-object test case.");
+        ProtocolTest.log("PASS: should not be able to add non-object test case.");
     }
     try {
         badArgsSuite.addTestCase({
             name: {},
             test: function() {},
         });
-        InspectorTest.log("FAIL: test case should require string name.");
+        ProtocolTest.log("FAIL: test case should require string name.");
     } catch (e) {
-        InspectorTest.log("PASS: test case should require string name.");
+        ProtocolTest.log("PASS: test case should require string name.");
     }
     try {
         badArgsSuite.addTestCase({
             name: "foo",
             test: null,
         });
-        InspectorTest.log("FAIL: test case should require test function.");
+        ProtocolTest.log("FAIL: test case should require test function.");
     } catch (e) {
-        InspectorTest.log("PASS: test case should require test function.");
+        ProtocolTest.log("PASS: test case should require test function.");
     }
 
-    var runEmptySuite = new InspectorTest.AsyncTestSuite("AsyncTestSuite.RunEmptySuite");
+    var runEmptySuite = new ProtocolTest.AsyncTestSuite("AsyncTestSuite.RunEmptySuite");
     try {
         runEmptySuite.runTestCases();
-        InspectorTest.log("FAIL: should not be able to run empty test suite.");
+        ProtocolTest.log("FAIL: should not be able to run empty test suite.");
     } catch (e) {
-        InspectorTest.log("PASS: should not be able to run empty test suite.");
+        ProtocolTest.log("PASS: should not be able to run empty test suite.");
     }
 
-    var runTwiceSuite = new InspectorTest.AsyncTestSuite("AsyncTestSuite.RunTwiceSuite");
+    var runTwiceSuite = new ProtocolTest.AsyncTestSuite("AsyncTestSuite.RunTwiceSuite");
     runTwiceSuite.addTestCase({
         name: "DummyTest0",
         description: "Check that a suite can't run more than once.",
@@ -73,15 +73,15 @@ function test()
         // Test cases won't run in this event loop; this call should still throw.
         // Later tests are chained to this suite to avoid nondeterminism.
         runTwiceSuite.runTestCases();
-        InspectorTest.log("FAIL: should not be able to run a test suite twice.");
+        ProtocolTest.log("FAIL: should not be able to run a test suite twice.");
     } catch (e) {
-        InspectorTest.log("PASS: should not be able to run a test suite twice.");
+        ProtocolTest.log("PASS: should not be able to run a test suite twice.");
     }
 
     var rejectToken = {"token": 666};
     var thrownError = new Error(rejectToken);
 
-    var sequentialExecutionSuite = new InspectorTest.AsyncTestSuite("AsyncTestSuite.SequentialExecution");
+    var sequentialExecutionSuite = new ProtocolTest.AsyncTestSuite("AsyncTestSuite.SequentialExecution");
     sequentialExecutionSuite.addTestCase({
         name: "DummyTest1",
         description: "Check test case execution order.",
@@ -111,7 +111,7 @@ function test()
         }
     });
 
-    var abortOnFailureSuite = new InspectorTest.AsyncTestSuite("AsyncTestSuite.AbortOnFailure");
+    var abortOnFailureSuite = new ProtocolTest.AsyncTestSuite("AsyncTestSuite.AbortOnFailure");
     abortOnFailureSuite.addTestCase({
         name: "PassingTest5",
         description: "This test is a dummy.",
@@ -136,41 +136,41 @@ function test()
 
     result = result.then(function() {
         var promise = sequentialExecutionSuite.runTestCases();
-        InspectorTest.assert(result instanceof Promise, "AsyncTestSuite.RunTestCases() should return a Promise.");
+        ProtocolTest.assert(result instanceof Promise, "AsyncTestSuite.RunTestCases() should return a Promise.");
         return promise;
     });
     result = result.then(function resolved() {
-        InspectorTest.log("FAIL: Promise from sequentialExecutionSuite.runTestCases() should reject when a test case fails.");
+        ProtocolTest.log("FAIL: Promise from sequentialExecutionSuite.runTestCases() should reject when a test case fails.");
         return Promise.resolve(); // Continue this test.
     }, function rejected(e) {
-        InspectorTest.log("PASS: Promise from sequentialExecutionSuite.runTestCases() should reject when a test case fails.");
-        InspectorTest.assert(e === thrownError, "Promise from sequentialExecutionSuite.runTestCases() should reject without altering its result value.");
+        ProtocolTest.log("PASS: Promise from sequentialExecutionSuite.runTestCases() should reject when a test case fails.");
+        ProtocolTest.assert(e === thrownError, "Promise from sequentialExecutionSuite.runTestCases() should reject without altering its result value.");
 
-        InspectorTest.assert(sequentialExecutionSuite.runCount === 4, "sequentialExecutionSuite should have executed four tests.");
-        InspectorTest.assert(sequentialExecutionSuite.passCount === 3, "sequentialExecutionSuite should have passed three tests.");
-        InspectorTest.assert(sequentialExecutionSuite.failCount === 1, "sequentialExecutionSuite should have failed 1 test.");
-        InspectorTest.assert(sequentialExecutionSuite.skipCount === 0, "sequentialExecutionSuite should have skipped zero tests.");
+        ProtocolTest.assert(sequentialExecutionSuite.runCount === 4, "sequentialExecutionSuite should have executed four tests.");
+        ProtocolTest.assert(sequentialExecutionSuite.passCount === 3, "sequentialExecutionSuite should have passed three tests.");
+        ProtocolTest.assert(sequentialExecutionSuite.failCount === 1, "sequentialExecutionSuite should have failed 1 test.");
+        ProtocolTest.assert(sequentialExecutionSuite.skipCount === 0, "sequentialExecutionSuite should have skipped zero tests.");
         return Promise.resolve(); // Continue this test.
     });
 
     result = result.then(function() {
         return abortOnFailureSuite.runTestCases();
     }).then(function resolved() {
-        InspectorTest.log("FAIL: Promise from abortOnFailureSuite.runTestCases() should reject when a test case fails.");
+        ProtocolTest.log("FAIL: Promise from abortOnFailureSuite.runTestCases() should reject when a test case fails.");
         return Promise.resolve(); // Continue this test.
     }, function rejected(e) {
-        InspectorTest.log("PASS: Promise from abortOnFailureSuite.runTestCases() should reject when a test case fails.");
-        InspectorTest.assert(e === rejectToken, "Promise from abortOnFailureSuite.runTestCases() should reject without altering its result value.");
-        InspectorTest.assert(abortOnFailureSuite.runCount === 2, "abortOnFailureSuite should have executed two tests.");
-        InspectorTest.assert(abortOnFailureSuite.passCount === 1, "abortOnFailureSuite should have passed one test.");
-        InspectorTest.assert(abortOnFailureSuite.failCount === 1, "abortOnFailureSuite should have failed one test.");
-        InspectorTest.assert(abortOnFailureSuite.skipCount === 1, "abortOnFailureSuite should have skipped one test.");
+        ProtocolTest.log("PASS: Promise from abortOnFailureSuite.runTestCases() should reject when a test case fails.");
+        ProtocolTest.assert(e === rejectToken, "Promise from abortOnFailureSuite.runTestCases() should reject without altering its result value.");
+        ProtocolTest.assert(abortOnFailureSuite.runCount === 2, "abortOnFailureSuite should have executed two tests.");
+        ProtocolTest.assert(abortOnFailureSuite.passCount === 1, "abortOnFailureSuite should have passed one test.");
+        ProtocolTest.assert(abortOnFailureSuite.failCount === 1, "abortOnFailureSuite should have failed one test.");
+        ProtocolTest.assert(abortOnFailureSuite.skipCount === 1, "abortOnFailureSuite should have skipped one test.");
 
         return Promise.resolve(); // Continue this test.
     });
 
     // This will finish the test whether the chain was resolved or rejected.
-    result = result.then(function() { InspectorTest.completeTest(); });
+    result = result.then(function() { ProtocolTest.completeTest(); });
 }
 </script>
 </head>
index ea6b9e4..9843508 100644 (file)
@@ -6,60 +6,60 @@
 function test()
 {
     try {
-        new InspectorTest.SyncTestSuite();
-        InspectorTest.log("FAIL: instantiating SyncTestSuite requires name argument.");
+        new ProtocolTest.SyncTestSuite();
+        ProtocolTest.log("FAIL: instantiating SyncTestSuite requires name argument.");
     } catch (e) {
-        InspectorTest.log("PASS: instantiating SyncTestSuite requires name argument.");
+        ProtocolTest.log("PASS: instantiating SyncTestSuite requires name argument.");
     }
 
     try {
-        new InspectorTest.SyncTestSuite({});
-        InspectorTest.log("FAIL: instantiating SyncTestSuite requires string name argument.");
+        new ProtocolTest.SyncTestSuite({});
+        ProtocolTest.log("FAIL: instantiating SyncTestSuite requires string name argument.");
     } catch (e) {
-        InspectorTest.log("PASS: instantiating SyncTestSuite requires string name argument.");
+        ProtocolTest.log("PASS: instantiating SyncTestSuite requires string name argument.");
     }
 
-    var badArgsSuite = new InspectorTest.SyncTestSuite("dummy");
+    var badArgsSuite = new ProtocolTest.SyncTestSuite("dummy");
     try {
         badArgsSuite.addTestCase();
-        InspectorTest.log("FAIL: should not be able to add empty test case.");
+        ProtocolTest.log("FAIL: should not be able to add empty test case.");
     } catch (e) {
-        InspectorTest.log("PASS: should not be able to add empty test case.");
+        ProtocolTest.log("PASS: should not be able to add empty test case.");
     }
     try {
         badArgsSuite.addTestCase("string");
-        InspectorTest.log("FAIL: should not be able to add non-object test case.");
+        ProtocolTest.log("FAIL: should not be able to add non-object test case.");
     } catch (e) {
-        InspectorTest.log("PASS: should not be able to add non-object test case.");
+        ProtocolTest.log("PASS: should not be able to add non-object test case.");
     }
     try {
         badArgsSuite.addTestCase({
             name: {},
             test: function() { return true; },
         });
-        InspectorTest.log("FAIL: test case should require string name.");
+        ProtocolTest.log("FAIL: test case should require string name.");
     } catch (e) {
-        InspectorTest.log("PASS: test case should require string name.");
+        ProtocolTest.log("PASS: test case should require string name.");
     }
     try {
         badArgsSuite.addTestCase({
             name: "foo",
             test: null,
         });
-        InspectorTest.log("FAIL: test case should require test function.");
+        ProtocolTest.log("FAIL: test case should require test function.");
     } catch (e) {
-        InspectorTest.log("PASS: test case should require test function.");
+        ProtocolTest.log("PASS: test case should require test function.");
     }
 
-    var runEmptySuite = new InspectorTest.SyncTestSuite("SyncTestSuite.RunEmptySuite");
+    var runEmptySuite = new ProtocolTest.SyncTestSuite("SyncTestSuite.RunEmptySuite");
     try {
         runEmptySuite.runTestCases();
-        InspectorTest.log("FAIL: should not be able to run empty test suite.");
+        ProtocolTest.log("FAIL: should not be able to run empty test suite.");
     } catch (e) {
-        InspectorTest.log("PASS: should not be able to run empty test suite.");
+        ProtocolTest.log("PASS: should not be able to run empty test suite.");
     }
 
-    var runTwiceSuite = new InspectorTest.SyncTestSuite("SyncTestSuite.RunTwiceSuite");
+    var runTwiceSuite = new ProtocolTest.SyncTestSuite("SyncTestSuite.RunTwiceSuite");
     runTwiceSuite.addTestCase({
         name: "DummyTest0",
         description: "Check that a suite can't run more than once.",
@@ -68,17 +68,17 @@ function test()
 
     try {
         var result = runTwiceSuite.runTestCases();
-        InspectorTest.assert(result === true, "Return value of runTwiceSuite.runTestCases() should be true when all tests pass.");
+        ProtocolTest.assert(result === true, "Return value of runTwiceSuite.runTestCases() should be true when all tests pass.");
 
         runTwiceSuite.runTestCases(); // Try to trigger an error.
-        InspectorTest.log("FAIL: should not be able to run a test suite twice.");
+        ProtocolTest.log("FAIL: should not be able to run a test suite twice.");
     } catch (e) {
-        InspectorTest.log("PASS: should not be able to run a test suite twice.");
+        ProtocolTest.log("PASS: should not be able to run a test suite twice.");
     }
 
     var thrownError = new Error({"token": 666});
 
-    var sequentialExecutionSuite = new InspectorTest.SyncTestSuite("SyncTestSuite.SequentialExecution");
+    var sequentialExecutionSuite = new ProtocolTest.SyncTestSuite("SyncTestSuite.SequentialExecution");
     sequentialExecutionSuite.addTestCase({
         name: "DummyTest1",
         description: "Check test case execution order.",
@@ -101,13 +101,13 @@ function test()
     });
 
     var result = sequentialExecutionSuite.runTestCases();
-    InspectorTest.assert(result === false, "Return value of sequentialExecutionSuite.runTestCases() should be false when a test case fails.");
-    InspectorTest.assert(sequentialExecutionSuite.runCount === 4, "sequentialExecutionSuite should have executed four tests.");
-    InspectorTest.assert(sequentialExecutionSuite.passCount === 3, "sequentialExecutionSuite should have passed three tests.");
-    InspectorTest.assert(sequentialExecutionSuite.failCount === 1, "sequentialExecutionSuite should have failed 1 test.");
-    InspectorTest.assert(sequentialExecutionSuite.skipCount === 0, "sequentialExecutionSuite should have skipped zero tests.");
+    ProtocolTest.assert(result === false, "Return value of sequentialExecutionSuite.runTestCases() should be false when a test case fails.");
+    ProtocolTest.assert(sequentialExecutionSuite.runCount === 4, "sequentialExecutionSuite should have executed four tests.");
+    ProtocolTest.assert(sequentialExecutionSuite.passCount === 3, "sequentialExecutionSuite should have passed three tests.");
+    ProtocolTest.assert(sequentialExecutionSuite.failCount === 1, "sequentialExecutionSuite should have failed 1 test.");
+    ProtocolTest.assert(sequentialExecutionSuite.skipCount === 0, "sequentialExecutionSuite should have skipped zero tests.");
 
-    var abortOnFailureSuite = new InspectorTest.SyncTestSuite("SyncTestSuite.AbortOnFailure");
+    var abortOnFailureSuite = new ProtocolTest.SyncTestSuite("SyncTestSuite.AbortOnFailure");
     abortOnFailureSuite.addTestCase({
         name: "PassingTest5",
         description: "This test is a dummy.",
@@ -125,13 +125,13 @@ function test()
     });
 
     abortOnFailureSuite.runTestCases();
-    InspectorTest.assert(result === false, "Return value of abortOnFailureSuite.runTestCases() should be false when a test case fails.");
-    InspectorTest.assert(abortOnFailureSuite.runCount === 2, "abortOnFailureSuite should have executed two tests.");
-    InspectorTest.assert(abortOnFailureSuite.passCount === 1, "abortOnFailureSuite should have passed one test.");
-    InspectorTest.assert(abortOnFailureSuite.failCount === 1, "abortOnFailureSuite should have failed one test.");
-    InspectorTest.assert(abortOnFailureSuite.skipCount === 1, "abortOnFailureSuite should have skipped one test.");
+    ProtocolTest.assert(result === false, "Return value of abortOnFailureSuite.runTestCases() should be false when a test case fails.");
+    ProtocolTest.assert(abortOnFailureSuite.runCount === 2, "abortOnFailureSuite should have executed two tests.");
+    ProtocolTest.assert(abortOnFailureSuite.passCount === 1, "abortOnFailureSuite should have passed one test.");
+    ProtocolTest.assert(abortOnFailureSuite.failCount === 1, "abortOnFailureSuite should have failed one test.");
+    ProtocolTest.assert(abortOnFailureSuite.skipCount === 1, "abortOnFailureSuite should have skipped one test.");
 
-    InspectorTest.completeTest();
+    ProtocolTest.completeTest();
 }
 </script>
 </head>