Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / inspector / debugger-test.js
index 9dd6f70..9d7b5c5 100644 (file)
@@ -4,7 +4,7 @@ InspectorTest.startDebuggerTest = function(callback, quiet)
 {
     if (quiet !== undefined)
         InspectorTest._quiet = quiet;
-    WebInspector.showPanel("sources");
+    WebInspector.inspectorView.showPanel("sources");
 
     if (WebInspector.debuggerModel.debuggerEnabled())
         startTest();
@@ -95,17 +95,17 @@ InspectorTest.runAsyncCallStacksTest = function(totalDebuggerStatements, maxAsyn
 
     function step2()
     {
-        InspectorTest.runTestFunctionAndWaitUntilPaused(didPaused);
+        InspectorTest.runTestFunctionAndWaitUntilPaused(didPause);
     }
 
     var step = 0;
     var callStacksOutput = [];
-    function didPaused(callFrames, reason, breakpointIds, asyncStackTrace)
+    function didPause(callFrames, reason, breakpointIds, asyncStackTrace)
     {
         ++step;
         callStacksOutput.push(InspectorTest.captureStackTraceIntoString(callFrames, asyncStackTrace) + "\n");
         if (step < totalDebuggerStatements) {
-            InspectorTest.resumeExecution(InspectorTest.waitUntilPaused.bind(InspectorTest, didPaused));
+            InspectorTest.resumeExecution(InspectorTest.waitUntilPaused.bind(InspectorTest, didPause));
         } else {
             InspectorTest.addResult("Captured call stacks in no particular order:");
             callStacksOutput.sort();
@@ -148,7 +148,7 @@ InspectorTest.waitUntilResumed = function(callback)
 InspectorTest.resumeExecution = function(callback)
 {
     if (WebInspector.panels.sources.paused)
-        WebInspector.panels.sources._togglePause();
+        WebInspector.panels.sources.togglePause();
     InspectorTest.waitUntilResumed(callback);
 };
 
@@ -166,20 +166,20 @@ InspectorTest.captureStackTraceIntoString = function(callFrames, asyncStackTrace
     {
         for (var i = 0; i < callFrames.length; i++) {
             var frame = callFrames[i];
-            var script = WebInspector.debuggerModel.scriptForId(frame.location.scriptId);
+            var script = WebInspector.debuggerModel.scriptForId(frame.location().scriptId);
             var url;
             var lineNumber;
             if (script) {
                 url = WebInspector.displayNameForURL(script.sourceURL);
-                lineNumber = frame.location.lineNumber + 1;
+                lineNumber = frame.location().lineNumber + 1;
             } else {
                 url = "(internal script)";
                 lineNumber = "(line number)";
             }
             var s = "    " + i + ") " + frame.functionName + " (" + url + (options.dropLineNumbers ? "" : ":" + lineNumber) + ")";
             results.push(s);
-            if (options.printReturnValue && frame.returnValue)
-                results.push("       <return>: " + frame.returnValue.description);
+            if (options.printReturnValue && frame.returnValue())
+                results.push("       <return>: " + frame.returnValue().description);
         }
     }
 
@@ -188,7 +188,7 @@ InspectorTest.captureStackTraceIntoString = function(callFrames, asyncStackTrace
 
     while (asyncStackTrace) {
         results.push("    [" + (asyncStackTrace.description || "Async Call") + "]");
-        printCallFrames(asyncStackTrace.callFrames);
+        printCallFrames(WebInspector.DebuggerModel.CallFrame.fromPayloadArray(WebInspector.targetManager.activeTarget(), asyncStackTrace.callFrames));
         if (asyncStackTrace.callFrames.peekLast().functionName === "testFunction")
             break;
         asyncStackTrace = asyncStackTrace.asyncStackTrace;
@@ -209,7 +209,7 @@ InspectorTest._pausedScript = function(callFrames, reason, auxData, breakpointId
 {
     if (!InspectorTest._quiet)
         InspectorTest.addResult("Script execution paused.");
-    InspectorTest._pausedScriptArguments = [callFrames, reason, breakpointIds, asyncStackTrace];
+    InspectorTest._pausedScriptArguments = [WebInspector.DebuggerModel.CallFrame.fromPayloadArray(WebInspector.targetManager.activeTarget(), callFrames), reason, breakpointIds, asyncStackTrace];
     if (InspectorTest._waitUntilPausedCallback) {
         var callback = InspectorTest._waitUntilPausedCallback;
         delete InspectorTest._waitUntilPausedCallback;
@@ -231,7 +231,7 @@ InspectorTest._resumedScript = function()
 
 InspectorTest.showUISourceCode = function(uiSourceCode, callback)
 {
-    var panel = WebInspector.showPanel("sources");
+    var panel = WebInspector.inspectorView.showPanel("sources");
     panel.showUISourceCode(uiSourceCode);
     var sourceFrame = panel.visibleView;
     if (sourceFrame.loaded)
@@ -247,7 +247,7 @@ InspectorTest.showScriptSource = function(scriptName, callback)
 
 InspectorTest.waitForScriptSource = function(scriptName, callback)
 {
-    var panel = WebInspector.showPanel("sources");
+    var panel = WebInspector.inspectorView.showPanel("sources");
     var uiSourceCodes = panel._workspace.uiSourceCodes();
     for (var i = 0; i < uiSourceCodes.length; ++i) {
         if (uiSourceCodes[i].name() === scriptName) {
@@ -256,16 +256,13 @@ InspectorTest.waitForScriptSource = function(scriptName, callback)
         }
     }
 
-    InspectorTest.addSniffer(WebInspector.SourcesPanel.prototype, "_addUISourceCode", InspectorTest.waitForScriptSource.bind(InspectorTest, scriptName, callback));
+    InspectorTest.addSniffer(WebInspector.SourcesView.prototype, "_addUISourceCode", InspectorTest.waitForScriptSource.bind(InspectorTest, scriptName, callback));
 };
 
-InspectorTest.dumpScriptsNavigator = function(navigator, prefix)
+InspectorTest.dumpNavigatorView = function(navigatorView, id, prefix)
 {
-    prefix = prefix || "";
-    InspectorTest.addResult(prefix + "Dumping ScriptsNavigator 'Scripts' tab:");
-    dumpNavigatorTreeOutline(prefix, navigator._sourcesView._scriptsTree);
-    InspectorTest.addResult(prefix + "Dumping ScriptsNavigator 'Content scripts' tab:");
-    dumpNavigatorTreeOutline(prefix, navigator._contentScriptsView._scriptsTree);
+    InspectorTest.addResult(prefix + "Dumping ScriptsNavigator " + id + " tab:");
+    dumpNavigatorTreeOutline(prefix, navigatorView._scriptsTree);
 
     function dumpNavigatorTreeElement(prefix, treeElement)
     {
@@ -279,7 +276,6 @@ InspectorTest.dumpScriptsNavigator = function(navigator, prefix)
         for (var i = 0; i < treeOutline.children.length; ++i)
             dumpNavigatorTreeElement(prefix + "  ", treeOutline.children[i]);
     }
-    InspectorTest.addResult("");
 };
 
 InspectorTest.setBreakpoint = function(sourceFrame, lineNumber, condition, enabled)
@@ -368,7 +364,7 @@ InspectorTest.createScriptMock = function(url, startLine, startColumn, isContent
     var endLine = startLine + lineCount - 1;
     var endColumn = lineCount === 1 ? startColumn + source.length : source.length - source.lineEndings()[lineCount - 2];
     var hasSourceURL = !!source.match(/\/\/#\ssourceURL=\s*(\S*?)\s*$/m) || !!source.match(/\/\/@\ssourceURL=\s*(\S*?)\s*$/m);
-    var script = new WebInspector.Script(scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, null, hasSourceURL);
+    var script = new WebInspector.Script(WebInspector.targetManager.activeTarget(), scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, null, hasSourceURL);
     script.requestContent = function(callback)
     {
         var trimmedSource = WebInspector.Script._trimSourceURLComment(source);
@@ -395,4 +391,13 @@ InspectorTest.checkUILocation = function(uiSourceCode, lineNumber, columnNumber,
     InspectorTest.assertEquals(columnNumber, location.columnNumber, "Incorrect columnNumber, expected '" + columnNumber + "', but got '" + location.columnNumber + "'");
 };
 
+InspectorTest.scriptFormatter = function()
+{
+    var editorActions = WebInspector.moduleManager.instances(WebInspector.SourcesView.EditorAction);
+    for (var i = 0; i < editorActions.length; ++i) {
+        if (editorActions[i] instanceof WebInspector.ScriptFormatterEditorAction)
+            return editorActions[i];
+    }
+};
+
 };