| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../inspector-test.js"></script> | 3 <script src="../../inspector-test.js"></script> |
| 4 <script src="../../isolated-filesystem-test.js"></script> | 4 <script src="../../isolated-filesystem-test.js"></script> |
| 5 <script src="../../workspace-test.js"></script> | 5 <script src="../../workspace-test.js"></script> |
| 6 <script> | 6 <script> |
| 7 function test() | 7 function test() |
| 8 { | 8 { |
| 9 var manager; | 9 var manager; |
| 10 var fileSystem; | 10 var fileSystem; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 InspectorTest.createWorkspace(); | 62 InspectorTest.createWorkspace(); |
| 63 manager = InspectorTest.createIsolatedFileSystemManager(InspectorTest.testWo
rkspace, InspectorTest.testFileSystemMapping); | 63 manager = InspectorTest.createIsolatedFileSystemManager(InspectorTest.testWo
rkspace, InspectorTest.testFileSystemMapping); |
| 64 cssModel = new WebInspector.CSSStyleModel(WebInspector.targetManager.mainTar
get(), InspectorTest.testWorkspace); | 64 cssModel = new WebInspector.CSSStyleModel(WebInspector.targetManager.mainTar
get(), InspectorTest.testWorkspace); |
| 65 WebInspector.targetManager.mainTarget().cssModel = cssModel; | 65 WebInspector.targetManager.mainTarget().cssModel = cssModel; |
| 66 new WebInspector.CSSStyleSheetMapping(cssModel, InspectorTest.testWorkspace,
InspectorTest.testNetworkWorkspaceBinding); | 66 new WebInspector.CSSStyleSheetMapping(cssModel, InspectorTest.testWorkspace,
InspectorTest.testNetworkWorkspaceBinding); |
| 67 | 67 |
| 68 var resourcesURL = WebInspector.ParsedURL.completeURL(WebInspector.resourceT
reeModel.inspectedPageURL(), "resources/"); | 68 var resourcesURL = WebInspector.ParsedURL.completeURL(WebInspector.resourceT
reeModel.inspectedPageURL(), "resources/"); |
| 69 var namePrefix = "update-locations-on-filesystem-scss-load." | 69 var namePrefix = "update-locations-on-filesystem-scss-load." |
| 70 var cssURL = resourcesURL + namePrefix + "css"; | 70 var cssURL = resourcesURL + namePrefix + "css"; |
| 71 var scssURL = resourcesURL + namePrefix + "scss"; | 71 var scssURL = resourcesURL + namePrefix + "scss"; |
| 72 var cssLocation = new WebInspector.CSSLocation(WebInspector.targetManager.ma
inTarget(), cssURL, 0, 1); | 72 var cssLocation = new WebInspector.CSSLocation(WebInspector.targetManager.ma
inTarget(), 1, cssURL, 0, 1); |
| 73 var scssContent = | 73 var scssContent = |
| 74 ["a {", | 74 ["a {", |
| 75 " foo: bar;", | 75 " foo: bar;", |
| 76 "/* COMMENT */", | 76 "/* COMMENT */", |
| 77 " font-size: 12px;", | 77 " font-size: 12px;", |
| 78 "}"].join("\n"); | 78 "}"].join("\n"); |
| 79 var cssContent = | 79 var cssContent = |
| 80 ["a {", | 80 ["a {", |
| 81 " foo: bar;", | 81 " foo: bar;", |
| 82 " /* COMMENT */", | 82 " /* COMMENT */", |
| 83 " font-size: 12px; }"].join("\n"); | 83 " font-size: 12px; }"].join("\n"); |
| 84 | 84 |
| 85 var files = {}; | 85 var files = {}; |
| 86 files["/" + namePrefix + "css"] = cssContent; | 86 files["/" + namePrefix + "css"] = cssContent; |
| 87 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCodeAdded, 4); | 87 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCodeAdded, 4); |
| 88 InspectorTest.addResult("Adding file system."); | 88 InspectorTest.addResult("Adding file system."); |
| 89 manager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileS
ystemAdded, fileSystemAdded, this); | 89 manager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileS
ystemAdded, fileSystemAdded, this); |
| 90 manager.addMockFileSystem(fileSystemPath); | 90 manager.addMockFileSystem(fileSystemPath); |
| 91 InspectorTest.testFileSystemMapping.addFileMapping(fileSystemPath, resources
URL, "/"); | 91 InspectorTest.testFileSystemMapping.addFileMapping(fileSystemPath, resources
URL, "/"); |
| 92 manager.addFiles(fileSystemPath, files); | 92 manager.addFiles(fileSystemPath, files); |
| 93 | 93 |
| 94 InspectorTest.addSniffer(WebInspector.SASSSourceMapping.prototype, "_bindUIS
ourceCode", afterBind); | 94 InspectorTest.addSniffer(WebInspector.SASSSourceMapping.prototype, "_bindUIS
ourceCode", afterBind); |
| 95 | 95 |
| 96 InspectorTest.addResult("Adding stylesheet header."); | 96 InspectorTest.addResult("Adding stylesheet header."); |
| 97 addMockHeader(cssURL, cssURL + ".map"); | 97 addMockHeader(cssURL, cssURL + ".map"); |
| 98 InspectorTest.addResult("Adding network resource."); | 98 InspectorTest.addResult("Adding network resource."); |
| 99 InspectorTest.addMockUISourceCodeToWorkspace(cssURL, WebInspector.resourceTy
pes.Stylesheet, cssContent); | 99 InspectorTest.addMockUISourceCodeToWorkspace(cssURL, WebInspector.resourceTy
pes.Stylesheet, cssContent); |
| 100 liveLocation = cssLocation.createLiveLocation("1", updateDelegate); | 100 liveLocation = cssLocation.createLiveLocation(updateDelegate); |
| 101 dumpLiveLocation(); | 101 dumpLiveLocation(); |
| 102 | 102 |
| 103 InspectorTest.addResult("Adding filesystem SCSS."); | 103 InspectorTest.addResult("Adding filesystem SCSS."); |
| 104 var scssPath = namePrefix + "scss"; | 104 var scssPath = namePrefix + "scss"; |
| 105 fileSystem.setFileContent(scssPath, scssContent, function() {}); | 105 fileSystem.setFileContent(scssPath, scssContent, function() {}); |
| 106 InspectorTest.addMockUISourceCodeToWorkspace(scssURL, WebInspector.resourceT
ypes.Stylesheet, scssContent); | 106 InspectorTest.addMockUISourceCodeToWorkspace(scssURL, WebInspector.resourceT
ypes.Stylesheet, scssContent); |
| 107 manager.fileSystemWorkspaceBinding._boundFileSystems.get(fileSystemPath)._ad
dFile(scssPath); | 107 manager.fileSystemWorkspaceBinding._boundFileSystems.get(fileSystemPath)._ad
dFile(scssPath); |
| 108 | 108 |
| 109 function afterBind() | 109 function afterBind() |
| 110 { | 110 { |
| 111 dumpLiveLocation(); | 111 dumpLiveLocation(); |
| 112 InspectorTest.completeTest(); | 112 InspectorTest.completeTest(); |
| 113 } | 113 } |
| 114 }; | 114 }; |
| 115 </script> | 115 </script> |
| 116 </head> | 116 </head> |
| 117 <body onload="runTest()"> | 117 <body onload="runTest()"> |
| 118 <p>Tests that stylesheet LiveLocations are updated when an SCSS file is added fr
om the filesystem.</p> | 118 <p>Tests that stylesheet LiveLocations are updated when an SCSS file is added fr
om the filesystem.</p> |
| 119 </body> | 119 </body> |
| 120 </html> | 120 </html> |
| OLD | NEW |