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

Side by Side Diff: LayoutTests/http/tests/inspector/stylesheet-source-mapping.html

Issue 404763002: DevTools: Inject styleSheetId in WebInspector.CSSLocation constructor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
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="debugger-test.js"></script> 4 <script src="debugger-test.js"></script>
5 <script src="workspace-test.js"></script> 5 <script src="workspace-test.js"></script>
6 6
7 <script> 7 <script>
8 8
9 function test() 9 function test()
10 { 10 {
11 var contentReceived; 11 var contentReceived;
12 var finalMappedLocation; 12 var finalMappedLocation;
13 InspectorTest.createWorkspace(); 13 InspectorTest.createWorkspace();
14 var cssModel = new WebInspector.CSSStyleModel(WebInspector.targetManager.act iveTarget(), InspectorTest.testWorkspace); 14 var cssModel = new WebInspector.CSSStyleModel(WebInspector.targetManager.act iveTarget(), InspectorTest.testWorkspace);
15 WebInspector.targetManager.activeTarget().cssModel = cssModel; 15 WebInspector.targetManager.activeTarget().cssModel = cssModel;
16 var mapping = new WebInspector.CSSStyleSheetMapping(cssModel, InspectorTest. testWorkspace, InspectorTest.testNetworkWorkspaceBinding); 16 var mapping = new WebInspector.CSSStyleSheetMapping(cssModel, InspectorTest. testWorkspace, InspectorTest.testNetworkWorkspaceBinding);
17 17
18 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(cssUISourceCodeAdded); 18 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(cssUISourceCodeAdded);
19 const styleSheetURL = "http://localhost:8000/inspector/resources/example.css "; 19 const styleSheetURL = "http://localhost:8000/inspector/resources/example.css ";
20 const sourceMapURL = "example.css.map"; 20 const sourceMapURL = "example.css.map";
21 const styleSheetId = 1;
21 InspectorTest.addMockUISourceCodeToWorkspace(styleSheetURL, WebInspector.res ourceTypes.Stylesheet, ""); 22 InspectorTest.addMockUISourceCodeToWorkspace(styleSheetURL, WebInspector.res ourceTypes.Stylesheet, "");
22 23
23 InspectorTest.addSniffer(WebInspector.CSSStyleSheetHeader.prototype, "update Locations", locationsUpdated, true); 24 InspectorTest.addSniffer(WebInspector.CSSStyleSheetHeader.prototype, "update Locations", locationsUpdated, true);
24 cssModel._styleSheetAdded(createMockStyleSheetHeader(styleSheetURL, sourceMa pURL)); 25 cssModel._styleSheetAdded(createMockStyleSheetHeader(styleSheetURL, sourceMa pURL));
25 26
26 function locationsUpdated() 27 function locationsUpdated()
27 { 28 {
28 var uiLocation = new WebInspector.CSSLocation(WebInspector.targetManager .activeTarget(), "http://localhost:8000/inspector/resources/example.css", 2, 3). toUILocation(); 29 var uiLocation = new WebInspector.CSSLocation(WebInspector.targetManager .activeTarget(), styleSheetId, styleSheetURL, 2, 3).toUILocation();
29 if (uiLocation.uiSourceCode.url.indexOf(".scss") === -1) 30 if (uiLocation.uiSourceCode.url.indexOf(".scss") === -1)
30 return; 31 return;
31 finalMappedLocation = uiLocation.uiSourceCode.url + ":" + uiLocation.lin eNumber + ":" + uiLocation.columnNumber; 32 finalMappedLocation = uiLocation.uiSourceCode.url + ":" + uiLocation.lin eNumber + ":" + uiLocation.columnNumber;
32 join(); 33 join();
33 } 34 }
34 35
35 36
36 function createMockStyleSheetHeader(url, sourceMapURL) 37 function createMockStyleSheetHeader(url, sourceMapURL)
37 { 38 {
38 const frame = WebInspector.resourceTreeModel.mainFrame; 39 const frame = WebInspector.resourceTreeModel.mainFrame;
39 return { 40 return {
40 styleSheetId: "1000", 41 styleSheetId: styleSheetId,
41 frameId: frame.id, 42 frameId: frame.id,
42 sourceURL: url, 43 sourceURL: url,
43 sourceMapURL: sourceMapURL, 44 sourceMapURL: sourceMapURL,
44 origin: "regular", 45 origin: "regular",
45 title: "", 46 title: "",
46 disabled: false 47 disabled: false
47 }; 48 };
48 } 49 }
49 50
50 function createMockStyleSheetResource(url, mimeType, content) 51 function createMockStyleSheetResource(url, mimeType, content)
(...skipping 14 matching lines...) Expand all
65 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(scssUISourceCodeAdd ed); 66 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(scssUISourceCodeAdd ed);
66 } 67 }
67 68
68 function scssUISourceCodeAdded(uiSourceCode) 69 function scssUISourceCodeAdded(uiSourceCode)
69 { 70 {
70 afterStyleSheetAdded(); 71 afterStyleSheetAdded();
71 } 72 }
72 73
73 function rawLocationToUILocation(line, column) 74 function rawLocationToUILocation(line, column)
74 { 75 {
75 return new WebInspector.CSSLocation(WebInspector.targetManager.activeTar get(), "http://localhost:8000/inspector/resources/example.css", line, column).to UILocation(); 76 return new WebInspector.CSSLocation(WebInspector.targetManager.activeTar get(), styleSheetId, styleSheetURL, line, column).toUILocation();
76 } 77 }
77 78
78 function afterStyleSheetAdded() 79 function afterStyleSheetAdded()
79 { 80 {
80 var cssUISourceCode = InspectorTest.testWorkspace.uiSourceCodeForOriginU RL("http://localhost:8000/inspector/resources/example.css"); 81 var cssUISourceCode = InspectorTest.testWorkspace.uiSourceCodeForOriginU RL(styleSheetURL);
81 var scssUISourceCode = InspectorTest.testWorkspace.uiSourceCodeForOrigin URL("http://localhost:8000/inspector/resources/example.scss"); 82 var scssUISourceCode = InspectorTest.testWorkspace.uiSourceCodeForOrigin URL("http://localhost:8000/inspector/resources/example.scss");
82 83
83 InspectorTest.checkUILocation(cssUISourceCode, 0, 3, rawLocationToUILoca tion(0, 3)); 84 InspectorTest.checkUILocation(cssUISourceCode, 0, 3, rawLocationToUILoca tion(0, 3));
84 InspectorTest.checkUILocation(scssUISourceCode, 1, 0, rawLocationToUILoc ation(1, 0)); 85 InspectorTest.checkUILocation(scssUISourceCode, 1, 0, rawLocationToUILoc ation(1, 0));
85 InspectorTest.checkUILocation(scssUISourceCode, 2, 2, rawLocationToUILoc ation(2, 4)); 86 InspectorTest.checkUILocation(scssUISourceCode, 2, 2, rawLocationToUILoc ation(2, 4));
86 InspectorTest.checkUILocation(scssUISourceCode, 2, 5, rawLocationToUILoc ation(2, 6)); 87 InspectorTest.checkUILocation(scssUISourceCode, 2, 5, rawLocationToUILoc ation(2, 6));
87 InspectorTest.checkUILocation(scssUISourceCode, 2, 7, rawLocationToUILoc ation(2, 9)); 88 InspectorTest.checkUILocation(scssUISourceCode, 2, 7, rawLocationToUILoc ation(2, 9));
88 InspectorTest.checkUILocation(scssUISourceCode, 2, 10, rawLocationToUILo cation(3, 7)); 89 InspectorTest.checkUILocation(scssUISourceCode, 2, 10, rawLocationToUILo cation(3, 7));
89 InspectorTest.checkUILocation(scssUISourceCode, 4, 2, rawLocationToUILoc ation(4, 8)); 90 InspectorTest.checkUILocation(scssUISourceCode, 4, 2, rawLocationToUILoc ation(4, 8));
90 InspectorTest.checkUILocation(scssUISourceCode, 4, 2, rawLocationToUILoc ation(4, 10)); 91 InspectorTest.checkUILocation(scssUISourceCode, 4, 2, rawLocationToUILoc ation(4, 10));
(...skipping 20 matching lines...) Expand all
111 } 112 }
112 113
113 </script> 114 </script>
114 115
115 </head> 116 </head>
116 117
117 <body onload="runTest()"> 118 <body onload="runTest()">
118 <p>Tests SourceMap and StyleSheetMapping.</p> 119 <p>Tests SourceMap and StyleSheetMapping.</p>
119 </body> 120 </body>
120 </html> 121 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698