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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector/elements/styles/update-locations-on-filesystem-scss-load.html

Issue 2784733002: DevTools: prepare tests for Persistence2.0 release (Closed)
Patch Set: address comments + three special tests Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../../inspector-test.js"></script>
4 <script src="../../isolated-filesystem-test.js"></script>
5 <script>
6 function loadCSS()
7 {
8 var link = document.createElement("link");
9 link.rel = "stylesheet";
10 link.type = "text/css";
11 link.href = "resources/update-locations-on-filesystem-scss-load.css";
12 document.head.appendChild(link);
13 }
14
15 function test()
16 {
17 InspectorTest.addResult("Creating filesystem with the SCSS file...");
18 var fs = new InspectorTest.TestFileSystem("file:///var/www");
19 fs.root.addFile("update-locations-on-filesystem-scss-load.scss", ["a {", " foo: bar;", "/* COMMENT */", " font-size: 12px;", "}"].join("\n"));
20 fs.addFileMapping(Common.ParsedURL.completeURL(InspectorTest.mainTarget.insp ectedURL(), "resources/source/"), "/");
21 fs.reportCreated(fileSystemCreated);
22
23 function fileSystemCreated()
24 {
25 InspectorTest.addResult("Loading raw css with mapping...");
26 InspectorTest.cssModel.addEventListener(SDK.CSSModel.Events.StyleSheetAd ded, styleSheetAdded);
27 InspectorTest.evaluateInPage("loadCSS()");
28 }
29
30 var liveLocation;
31
32 function styleSheetAdded(event)
33 {
34 InspectorTest.addResult("Stylesheet was added, dumping location:");
35 var header = event.data;
36 var cssLocation = new SDK.CSSLocation(header, 0, 1);
37 liveLocation = Bindings.cssWorkspaceBinding.createLiveLocation(cssLocati on, function() {}, new Bindings.LiveLocationPool());
38 InspectorTest.cssModel.sourceMapManager().addEventListener(SDK.SourceMap Manager.Events.SourceMapAttached, afterBind);
39 dumpLiveLocation();
40 }
41
42 function afterBind()
43 {
44 InspectorTest.addResult("Source map was bound to the file loaded from fi lesystem:");
45 dumpLiveLocation();
46 InspectorTest.completeTest();
47 }
48
49 function dumpLiveLocation()
50 {
51 var uiLocation = liveLocation.uiLocation();
52 if (!uiLocation) {
53 InspectorTest.addResult("Null uiLocation");
54 return;
55 }
56 InspectorTest.addResult(uiLocation.uiSourceCode.url() + ":" + uiLocation .lineNumber + ":" + uiLocation.columnNumber);
57 }
58 };
59 </script>
60 </head>
61 <body onload="runTest()">
62 <p>Tests that stylesheet LiveLocations are updated when an SCSS file is loaded f rom the filesystem.</p>
63 </body>
64 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698