Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / inspector / stylesheet-source-mapping.html
index 0a71f2c..9baa631 100644 (file)
@@ -11,21 +11,23 @@ function test()
     var contentReceived;
     var finalMappedLocation;
     InspectorTest.createWorkspace();
-    var cssModel = new WebInspector.CSSStyleModel(WebInspector.targetManager.activeTarget(), InspectorTest.testWorkspace);
-    WebInspector.targetManager.activeTarget().cssModel = cssModel;
-    var mapping = new WebInspector.CSSStyleSheetMapping(cssModel, InspectorTest.testWorkspace, InspectorTest.testNetworkWorkspaceBinding);
+    var target = WebInspector.targetManager.mainTarget();
+    var cssModel = new WebInspector.CSSStyleModel(target);
+    target.cssModel = cssModel;
+    new WebInspector.CSSWorkspaceBinding.TargetInfo(target, InspectorTest.testWorkspace, InspectorTest.testNetworkWorkspaceBinding);
 
     InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(cssUISourceCodeAdded);
     const styleSheetURL = "http://localhost:8000/inspector/resources/example.css";
     const sourceMapURL = "example.css.map";
+    const styleSheetId = 1;
     InspectorTest.addMockUISourceCodeToWorkspace(styleSheetURL, WebInspector.resourceTypes.Stylesheet, "");
 
-    InspectorTest.addSniffer(WebInspector.CSSStyleSheetHeader.prototype, "updateLocations", locationsUpdated, true);
+    InspectorTest.addSniffer(WebInspector.CSSWorkspaceBinding.prototype, "updateLocations", locationsUpdated, true);
     cssModel._styleSheetAdded(createMockStyleSheetHeader(styleSheetURL, sourceMapURL));
 
     function locationsUpdated()
     {
-        var uiLocation = new WebInspector.CSSLocation(WebInspector.targetManager.activeTarget(), "http://localhost:8000/inspector/resources/example.css", 2, 3).toUILocation();
+        var uiLocation = WebInspector.cssWorkspaceBinding.rawLocationToUILocation(new WebInspector.CSSLocation(target, styleSheetId, styleSheetURL, 2, 3));
         if (uiLocation.uiSourceCode.url.indexOf(".scss") === -1)
             return;
         finalMappedLocation = uiLocation.uiSourceCode.url + ":" + uiLocation.lineNumber + ":" + uiLocation.columnNumber;
@@ -37,7 +39,7 @@ function test()
     {
         const frame = WebInspector.resourceTreeModel.mainFrame;
         return {
-            styleSheetId: "1000",
+            styleSheetId: styleSheetId,
             frameId: frame.id,
             sourceURL: url,
             sourceMapURL: sourceMapURL,
@@ -51,7 +53,7 @@ function test()
     {
         const documentURL = "http://localhost:8000/inspector/stylesheet-source-mapping.html";
         const frame = WebInspector.resourceTreeModel.mainFrame;
-        var resource = new WebInspector.Resource(null, url, documentURL, frame.id, frame.loaderId, WebInspector.resourceTypes.Stylesheet, mimeType);
+        var resource = new WebInspector.Resource(WebInspector.resourceTreeModel.target(), null, url, documentURL, frame.id, frame.loaderId, WebInspector.resourceTypes.Stylesheet, mimeType);
         resource.requestContent = function(callback)
         {
             callback(content, false, mimeType);
@@ -72,12 +74,12 @@ function test()
 
     function rawLocationToUILocation(line, column)
     {
-        return new WebInspector.CSSLocation(WebInspector.targetManager.activeTarget(), "http://localhost:8000/inspector/resources/example.css", line, column).toUILocation();
+        return WebInspector.cssWorkspaceBinding.rawLocationToUILocation(new WebInspector.CSSLocation(target, styleSheetId, styleSheetURL, line, column));
     }
 
     function afterStyleSheetAdded()
     {
-        var cssUISourceCode = InspectorTest.testWorkspace.uiSourceCodeForOriginURL("http://localhost:8000/inspector/resources/example.css");
+        var cssUISourceCode = InspectorTest.testWorkspace.uiSourceCodeForOriginURL(styleSheetURL);
         var scssUISourceCode = InspectorTest.testWorkspace.uiSourceCodeForOriginURL("http://localhost:8000/inspector/resources/example.scss");
 
         InspectorTest.checkUILocation(cssUISourceCode, 0, 3, rawLocationToUILocation(0, 3));