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

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

Issue 220903002: DevTools: wrap DebuggerAgent.Location with DebuggerModel.Location. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: All tests!!! Created 6 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 | 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 var mapping = new WebInspector.CSSStyleSheetMapping(cssModel, InspectorTest. testWorkspace, InspectorTest.testNetworkWorkspaceProvider); 16 var mapping = new WebInspector.CSSStyleSheetMapping(cssModel, InspectorTest. testWorkspace, InspectorTest.testNetworkWorkspaceProvider);
16 17
17 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(cssUISourceCodeAdded); 18 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(cssUISourceCodeAdded);
18 const styleSheetURL = "http://localhost:8000/inspector/resources/example.css "; 19 const styleSheetURL = "http://localhost:8000/inspector/resources/example.css ";
19 const sourceMapURL = "example.css.map"; 20 const sourceMapURL = "example.css.map";
20 InspectorTest.addMockUISourceCodeToWorkspace(styleSheetURL, WebInspector.res ourceTypes.Stylesheet, ""); 21 InspectorTest.addMockUISourceCodeToWorkspace(styleSheetURL, WebInspector.res ourceTypes.Stylesheet, "");
21 22
22 InspectorTest.addSniffer(WebInspector.CSSStyleSheetHeader.prototype, "update Locations", locationsUpdated, true); 23 InspectorTest.addSniffer(WebInspector.CSSStyleSheetHeader.prototype, "update Locations", locationsUpdated, true);
23 cssModel._styleSheetAdded(createMockStyleSheetHeader(styleSheetURL, sourceMa pURL)); 24 cssModel._styleSheetAdded(createMockStyleSheetHeader(styleSheetURL, sourceMa pURL));
24 25
25 function locationsUpdated() 26 function locationsUpdated()
26 { 27 {
27 var uiLocation = cssModel.rawLocationToUILocation(new WebInspector.CSSLo cation("http://localhost:8000/inspector/resources/example.css", 2, 3)); 28 var uiLocation = new WebInspector.CSSLocation(WebInspector.targetManager .activeTarget(), "http://localhost:8000/inspector/resources/example.css", 2, 3). toUILocation();
28 if (uiLocation.uiSourceCode.url.indexOf(".scss") === -1) 29 if (uiLocation.uiSourceCode.url.indexOf(".scss") === -1)
29 return; 30 return;
30 finalMappedLocation = uiLocation.uiSourceCode.url + ":" + uiLocation.lin eNumber + ":" + uiLocation.columnNumber; 31 finalMappedLocation = uiLocation.uiSourceCode.url + ":" + uiLocation.lin eNumber + ":" + uiLocation.columnNumber;
31 join(); 32 join();
32 } 33 }
33 34
34 35
35 function createMockStyleSheetHeader(url, sourceMapURL) 36 function createMockStyleSheetHeader(url, sourceMapURL)
36 { 37 {
37 const frame = WebInspector.resourceTreeModel.mainFrame; 38 const frame = WebInspector.resourceTreeModel.mainFrame;
(...skipping 26 matching lines...) Expand all
64 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(scssUISourceCodeAdd ed); 65 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(scssUISourceCodeAdd ed);
65 } 66 }
66 67
67 function scssUISourceCodeAdded(uiSourceCode) 68 function scssUISourceCodeAdded(uiSourceCode)
68 { 69 {
69 afterStyleSheetAdded(); 70 afterStyleSheetAdded();
70 } 71 }
71 72
72 function rawLocationToUILocation(line, column) 73 function rawLocationToUILocation(line, column)
73 { 74 {
74 return cssModel.rawLocationToUILocation(new WebInspector.CSSLocation("ht tp://localhost:8000/inspector/resources/example.css", line, column)); 75 return new WebInspector.CSSLocation(WebInspector.targetManager.activeTar get(), "http://localhost:8000/inspector/resources/example.css", line, column).to UILocation();
75 } 76 }
76 77
77 function afterStyleSheetAdded() 78 function afterStyleSheetAdded()
78 { 79 {
79 var cssUISourceCode = InspectorTest.testWorkspace.uiSourceCodeForOriginU RL("http://localhost:8000/inspector/resources/example.css"); 80 var cssUISourceCode = InspectorTest.testWorkspace.uiSourceCodeForOriginU RL("http://localhost:8000/inspector/resources/example.css");
80 var scssUISourceCode = InspectorTest.testWorkspace.uiSourceCodeForOrigin URL("http://localhost:8000/inspector/resources/example.scss"); 81 var scssUISourceCode = InspectorTest.testWorkspace.uiSourceCodeForOrigin URL("http://localhost:8000/inspector/resources/example.scss");
81 82
82 InspectorTest.checkUILocation(cssUISourceCode, 0, 3, rawLocationToUILoca tion(0, 3)); 83 InspectorTest.checkUILocation(cssUISourceCode, 0, 3, rawLocationToUILoca tion(0, 3));
83 InspectorTest.checkUILocation(scssUISourceCode, 1, 0, rawLocationToUILoc ation(1, 0)); 84 InspectorTest.checkUILocation(scssUISourceCode, 1, 0, rawLocationToUILoc ation(1, 0));
84 InspectorTest.checkUILocation(scssUISourceCode, 2, 2, rawLocationToUILoc ation(2, 4)); 85 InspectorTest.checkUILocation(scssUISourceCode, 2, 2, rawLocationToUILoc ation(2, 4));
(...skipping 25 matching lines...) Expand all
110 } 111 }
111 112
112 </script> 113 </script>
113 114
114 </head> 115 </head>
115 116
116 <body onload="runTest()"> 117 <body onload="runTest()">
117 <p>Tests SourceMap and StyleSheetMapping.</p> 118 <p>Tests SourceMap and StyleSheetMapping.</p>
118 </body> 119 </body>
119 </html> 120 </html>
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/inspector/inspector-test.js ('k') | LayoutTests/inspector/sources/debugger/async-callstack-eval.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698