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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/sources/debugger/network-uisourcecode-provider.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="../../../http/tests/inspector/inspector-test.js"></script> 3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/debugger-test.js"></script> 4 <script src="../../../http/tests/inspector/debugger-test.js"></script>
5 <script src="../../../http/tests/inspector/workspace-test.js"></script> 5 <script src="../../../http/tests/inspector/workspace-test.js"></script>
6 <script> 6 <script>
7 function test() 7 function test()
8 { 8 {
9 var mockContentsMap = {}; 9 var mockContentsMap = {};
10 var target; 10 var target;
(...skipping 16 matching lines...) Expand all
27 27
28 function createResourceMock(type, content) 28 function createResourceMock(type, content)
29 { 29 {
30 var documentURL = "http://fake.url"; 30 var documentURL = "http://fake.url";
31 var resourceId = ++lastResourceId + ""; 31 var resourceId = ++lastResourceId + "";
32 var url = documentURL + "/" + resourceId; 32 var url = documentURL + "/" + resourceId;
33 var frameId = "frame-id"; 33 var frameId = "frame-id";
34 var loaderId = "loader-id"; 34 var loaderId = "loader-id";
35 var mimeType; 35 var mimeType;
36 switch (type) { 36 switch (type) {
37 case WebInspector.resourceTypes.Document: 37 case Common.resourceTypes.Document:
38 mimeType = "text/html"; 38 mimeType = "text/html";
39 break; 39 break;
40 case WebInspector.resourceTypes.Script: 40 case Common.resourceTypes.Script:
41 mimeType = "text/javascript"; 41 mimeType = "text/javascript";
42 break; 42 break;
43 case WebInspector.resourceTypes.Stylesheet: 43 case Common.resourceTypes.Stylesheet:
44 mimeType = "text/css"; 44 mimeType = "text/css";
45 break; 45 break;
46 } 46 }
47 47
48 var resource = new WebInspector.Resource(target, null, url, documentURL, frameId, loaderId, type, mimeType); 48 var resource = new SDK.Resource(target, null, url, documentURL, frameId, loaderId, type, mimeType);
49 resource._content = content; 49 resource._content = content;
50 target.resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceT reeModel.Events.ResourceAdded, resource); 50 target.resourceTreeModel.dispatchEventToListeners(SDK.ResourceTreeModel. Events.ResourceAdded, resource);
51 51
52 return resource; 52 return resource;
53 } 53 }
54 54
55 function createScriptMock(content) 55 function createScriptMock(content)
56 { 56 {
57 var documentURL = "http://fake.url"; 57 var documentURL = "http://fake.url";
58 var resourceId = ++lastResourceId + ""; 58 var resourceId = ++lastResourceId + "";
59 var url = documentURL + "/" + resourceId; 59 var url = documentURL + "/" + resourceId;
60 var script = InspectorTest.createScriptMock(url, 0, 0, false, content, t arget); 60 var script = InspectorTest.createScriptMock(url, 0, 0, false, content, t arget);
61 target.debuggerModel.dispatchEventToListeners(WebInspector.DebuggerModel .Events.ParsedScriptSource, script); 61 target.debuggerModel.dispatchEventToListeners(SDK.DebuggerModel.Events.P arsedScriptSource, script);
62 } 62 }
63 63
64 function finishResource(resource) 64 function finishResource(resource)
65 { 65 {
66 resource.request.finished = true; 66 resource.request.finished = true;
67 resource.request.dispatchEventToListeners(WebInspector.NetworkRequest.Ev ents.FinishedLoading, resource.request); 67 resource.request.dispatchEventToListeners(SDK.NetworkRequest.Events.Fini shedLoading, resource.request);
68 } 68 }
69 69
70 function createNetworkUISourceCodeProvider() 70 function createNetworkUISourceCodeProvider()
71 { 71 {
72 target = InspectorTest.createWorkspaceWithTarget(true); 72 target = InspectorTest.createWorkspaceWithTarget(true);
73 } 73 }
74 74
75 InspectorTest.runTestSuite([ 75 InspectorTest.runTestSuite([
76 function testDocumentResource(next) 76 function testDocumentResource(next)
77 { 77 {
78 createNetworkUISourceCodeProvider(); 78 createNetworkUISourceCodeProvider();
79 InspectorTest.addResult("Creating resource."); 79 InspectorTest.addResult("Creating resource.");
80 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCodeAdd ed); 80 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCodeAdd ed);
81 createResourceMock(WebInspector.resourceTypes.Document, "<document r esource content>"); 81 createResourceMock(Common.resourceTypes.Document, "<document resourc e content>");
82 82
83 function uiSourceCodeAdded(uiSourceCode) 83 function uiSourceCodeAdded(uiSourceCode)
84 { 84 {
85 // setTimeouts are necessary since same event finalizes uiSource Code creation. 85 // setTimeouts are necessary since same event finalizes uiSource Code creation.
86 setTimeout(function() { InspectorTest.dumpUISourceCode(uiSourceC ode, next); }); 86 setTimeout(function() { InspectorTest.dumpUISourceCode(uiSourceC ode, next); });
87 } 87 }
88 }, 88 },
89 89
90 function testScriptResourceAndVMScript(next) 90 function testScriptResourceAndVMScript(next)
91 { 91 {
92 createNetworkUISourceCodeProvider(); 92 createNetworkUISourceCodeProvider();
93 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCodeAdd ed); 93 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCodeAdd ed);
94 InspectorTest.addResult("Creating script resource."); 94 InspectorTest.addResult("Creating script resource.");
95 createResourceMock(WebInspector.resourceTypes.Script, "<script resou rce content>"); 95 createResourceMock(Common.resourceTypes.Script, "<script resource co ntent>");
96 InspectorTest.addResult("Creating script."); 96 InspectorTest.addResult("Creating script.");
97 createScriptMock("<script content>"); 97 createScriptMock("<script content>");
98 98
99 function uiSourceCodeAdded(uiSourceCode) 99 function uiSourceCodeAdded(uiSourceCode)
100 { 100 {
101 setTimeout(function() { InspectorTest.dumpUISourceCode(uiSourceC ode, next); }); 101 setTimeout(function() { InspectorTest.dumpUISourceCode(uiSourceC ode, next); });
102 } 102 }
103 }, 103 },
104 104
105 function testRemoveStyleSheetFromModelWithComplexURL(next) 105 function testRemoveStyleSheetFromModelWithComplexURL(next)
106 { 106 {
107 var mockStyleSheetHeader = createMockStyleSheetHeader("http://exampl e.com/foo.css"); 107 var mockStyleSheetHeader = createMockStyleSheetHeader("http://exampl e.com/foo.css");
108 testRemoveStyleSheetFromModel(mockStyleSheetHeader, next); 108 testRemoveStyleSheetFromModel(mockStyleSheetHeader, next);
109 }, 109 },
110 110
111 function testRemoveStyleSheetFromModelWithSimpleURL(next) 111 function testRemoveStyleSheetFromModelWithSimpleURL(next)
112 { 112 {
113 var mockStyleSheetHeader = createMockStyleSheetHeader("foo.css"); 113 var mockStyleSheetHeader = createMockStyleSheetHeader("foo.css");
114 testRemoveStyleSheetFromModel(mockStyleSheetHeader, next); 114 testRemoveStyleSheetFromModel(mockStyleSheetHeader, next);
115 } 115 }
116 ]); 116 ]);
117 117
118 function testRemoveStyleSheetFromModel(mockStyleSheetHeader, callback) 118 function testRemoveStyleSheetFromModel(mockStyleSheetHeader, callback)
119 { 119 {
120 createNetworkUISourceCodeProvider(); 120 createNetworkUISourceCodeProvider();
121 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCodeAdded); 121 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCodeAdded);
122 InspectorTest.addResult("Creating stylesheet resource."); 122 InspectorTest.addResult("Creating stylesheet resource.");
123 createResourceMock(WebInspector.resourceTypes.Stylesheet, "<stylesheet r esource content>"); 123 createResourceMock(Common.resourceTypes.Stylesheet, "<stylesheet resourc e content>");
124 124
125 WebInspector.CSSModel.fromTarget(target)._styleSheetAdded(mockStyleSheet Header); 125 SDK.CSSModel.fromTarget(target)._styleSheetAdded(mockStyleSheetHeader);
126 126
127 function uiSourceCodeAdded(uiSourceCode) 127 function uiSourceCodeAdded(uiSourceCode)
128 { 128 {
129 InspectorTest.addResult("Added uiSourceCode: " + InspectorTest.uiSou rceCodeURL(uiSourceCode)); 129 InspectorTest.addResult("Added uiSourceCode: " + InspectorTest.uiSou rceCodeURL(uiSourceCode));
130 InspectorTest.waitForWorkspaceUISourceCodeRemovedEvent(uiSourceCodeR emoved); 130 InspectorTest.waitForWorkspaceUISourceCodeRemovedEvent(uiSourceCodeR emoved);
131 WebInspector.CSSModel.fromTarget(target)._styleSheetRemoved(mockStyl eSheetHeader.styleSheetId); 131 SDK.CSSModel.fromTarget(target)._styleSheetRemoved(mockStyleSheetHea der.styleSheetId);
132 } 132 }
133 133
134 function uiSourceCodeRemoved(uiSourceCode) 134 function uiSourceCodeRemoved(uiSourceCode)
135 { 135 {
136 InspectorTest.addResult("Removed uiSourceCode: " + InspectorTest.uiS ourceCodeURL(uiSourceCode)); 136 InspectorTest.addResult("Removed uiSourceCode: " + InspectorTest.uiS ourceCodeURL(uiSourceCode));
137 callback(); 137 callback();
138 } 138 }
139 } 139 }
140 }; 140 };
141 </script> 141 </script>
142 </head> 142 </head>
143 <body onload="runTest()"> 143 <body onload="runTest()">
144 <p>Tests NetworkUISourceCodeProvider class.</p> 144 <p>Tests NetworkUISourceCodeProvider class.</p>
145 </body> 145 </body>
146 </html> 146 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698