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

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

Issue 2493373002: DevTools: rename WebInspector into modules. (Closed)
Patch Set: for bots Created 4 years, 1 month 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
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 function test() 8 function test()
9 { 9 {
10 var contentReceived; 10 var contentReceived;
11 var finalMappedLocation; 11 var finalMappedLocation;
12 var target = InspectorTest.createWorkspaceWithTarget(); 12 var target = InspectorTest.createWorkspaceWithTarget();
13 var cssModel = WebInspector.CSSModel.fromTarget(target); 13 var cssModel = SDK.CSSModel.fromTarget(target);
14 WebInspector.cssWorkspaceBinding = InspectorTest.testCSSWorkspaceBinding; 14 Bindings.cssWorkspaceBinding = InspectorTest.testCSSWorkspaceBinding;
15 15
16 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(cssUISourceCodeAdded); 16 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(cssUISourceCodeAdded);
17 const styleSheetURL = "http://localhost:8000/inspector/resources/example.css "; 17 const styleSheetURL = "http://localhost:8000/inspector/resources/example.css ";
18 const sourceMapURL = "example.css.map"; 18 const sourceMapURL = "example.css.map";
19 const styleSheetId = "1"; 19 const styleSheetId = "1";
20 20
21 InspectorTest.addSniffer(WebInspector.CSSWorkspaceBinding.TargetInfo.prototy pe, "_updateLocations", locationsUpdated, true); 21 InspectorTest.addSniffer(Bindings.CSSWorkspaceBinding.TargetInfo.prototype, "_updateLocations", locationsUpdated, true);
22 cssModel._styleSheetAdded(createMockStyleSheetHeader(styleSheetURL, sourceMa pURL)); 22 cssModel._styleSheetAdded(createMockStyleSheetHeader(styleSheetURL, sourceMa pURL));
23 23
24 function locationsUpdated() 24 function locationsUpdated()
25 { 25 {
26 var header = cssModel.styleSheetHeaderForId(styleSheetId); 26 var header = cssModel.styleSheetHeaderForId(styleSheetId);
27 var uiLocation = InspectorTest.testCSSWorkspaceBinding.rawLocationToUILo cation(new WebInspector.CSSLocation(header, 2, 3)); 27 var uiLocation = InspectorTest.testCSSWorkspaceBinding.rawLocationToUILo cation(new SDK.CSSLocation(header, 2, 3));
28 if (uiLocation.uiSourceCode.url().indexOf(".scss") === -1) 28 if (uiLocation.uiSourceCode.url().indexOf(".scss") === -1)
29 return; 29 return;
30 finalMappedLocation = uiLocation.uiSourceCode.url() + ":" + uiLocation.l ineNumber + ":" + uiLocation.columnNumber; 30 finalMappedLocation = uiLocation.uiSourceCode.url() + ":" + uiLocation.l ineNumber + ":" + uiLocation.columnNumber;
31 join(); 31 join();
32 } 32 }
33 33
34 function createMockStyleSheetHeader(url, sourceMapURL) 34 function createMockStyleSheetHeader(url, sourceMapURL)
35 { 35 {
36 const frame = InspectorTest.resourceTreeModel.mainFrame; 36 const frame = InspectorTest.resourceTreeModel.mainFrame;
37 return { 37 return {
38 styleSheetId: styleSheetId, 38 styleSheetId: styleSheetId,
39 frameId: frame.id, 39 frameId: frame.id,
40 sourceURL: url, 40 sourceURL: url,
41 sourceMapURL: sourceMapURL, 41 sourceMapURL: sourceMapURL,
42 origin: "regular", 42 origin: "regular",
43 title: "", 43 title: "",
44 disabled: false 44 disabled: false
45 }; 45 };
46 } 46 }
47 47
48 function createMockStyleSheetResource(url, mimeType, content) 48 function createMockStyleSheetResource(url, mimeType, content)
49 { 49 {
50 const documentURL = "http://localhost:8000/inspector/stylesheet-source-m apping.html"; 50 const documentURL = "http://localhost:8000/inspector/stylesheet-source-m apping.html";
51 const frame = InspectorTest.resourceTreeModel.mainFrame; 51 const frame = InspectorTest.resourceTreeModel.mainFrame;
52 var resource = new WebInspector.Resource(target, null, url, documentURL, frame.id, frame.loaderId, WebInspector.resourceTypes.Stylesheet, mimeType); 52 var resource = new SDK.Resource(target, null, url, documentURL, frame.id , frame.loaderId, Common.resourceTypes.Stylesheet, mimeType);
53 resource.requestContent = function() 53 resource.requestContent = function()
54 { 54 {
55 return Promise.resolve(content); 55 return Promise.resolve(content);
56 } 56 }
57 return resource; 57 return resource;
58 } 58 }
59 59
60 60
61 function cssUISourceCodeAdded(uiSourceCode) 61 function cssUISourceCodeAdded(uiSourceCode)
62 { 62 {
63 InspectorTest.addResult("Added CSS uiSourceCode: " + uiSourceCode.url()) ; 63 InspectorTest.addResult("Added CSS uiSourceCode: " + uiSourceCode.url()) ;
64 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(scssUISourceCodeAdd ed); 64 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(scssUISourceCodeAdd ed);
65 } 65 }
66 66
67 function rawLocationToUILocation(line, column) 67 function rawLocationToUILocation(line, column)
68 { 68 {
69 var header = cssModel.styleSheetHeaderForId(styleSheetId); 69 var header = cssModel.styleSheetHeaderForId(styleSheetId);
70 return InspectorTest.testCSSWorkspaceBinding.rawLocationToUILocation(new WebInspector.CSSLocation(header, line, column)); 70 return InspectorTest.testCSSWorkspaceBinding.rawLocationToUILocation(new SDK.CSSLocation(header, line, column));
71 } 71 }
72 72
73 function scssUISourceCodeAdded(uiSourceCode) 73 function scssUISourceCodeAdded(uiSourceCode)
74 { 74 {
75 InspectorTest.addResult("Added SCSS uiSourceCode: " + uiSourceCode.url() ); 75 InspectorTest.addResult("Added SCSS uiSourceCode: " + uiSourceCode.url() );
76 var cssUISourceCode = InspectorTest.testWorkspace.uiSourceCodeForURL(sty leSheetURL); 76 var cssUISourceCode = InspectorTest.testWorkspace.uiSourceCodeForURL(sty leSheetURL);
77 var scssUISourceCode = InspectorTest.testWorkspace.uiSourceCodeForURL("h ttp://localhost:8000/inspector/resources/example.scss"); 77 var scssUISourceCode = InspectorTest.testWorkspace.uiSourceCodeForURL("h ttp://localhost:8000/inspector/resources/example.scss");
78 78
79 InspectorTest.checkUILocation(cssUISourceCode, 0, 3, rawLocationToUILoca tion(0, 3)); 79 InspectorTest.checkUILocation(cssUISourceCode, 0, 3, rawLocationToUILoca tion(0, 3));
80 InspectorTest.checkUILocation(scssUISourceCode, 1, 0, rawLocationToUILoc ation(1, 0)); 80 InspectorTest.checkUILocation(scssUISourceCode, 1, 0, rawLocationToUILoc ation(1, 0));
(...skipping 26 matching lines...) Expand all
107 } 107 }
108 108
109 </script> 109 </script>
110 110
111 </head> 111 </head>
112 112
113 <body onload="runTest()"> 113 <body onload="runTest()">
114 <p>Tests SourceMap and StyleSheetMapping.</p> 114 <p>Tests SourceMap and StyleSheetMapping.</p>
115 </body> 115 </body>
116 </html> 116 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698