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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/script-snippet-model.html

Issue 2752403002: [DevTools] Migrate usages of Target to RuntimeModel where makes sense (Closed)
Patch Set: review comments addressed Created 3 years, 9 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
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> 5 <script>
6 function startWorker() 6 function startWorker()
7 { 7 {
8 var workerScript = "postMessage('Done.');"; 8 var workerScript = "postMessage('Done.');";
9 var blob = new Blob([workerScript], { type: "text/javascript" }); 9 var blob = new Blob([workerScript], { type: "text/javascript" });
10 var worker = new Worker(URL.createObjectURL(blob)); 10 var worker = new Worker(URL.createObjectURL(blob));
11 } 11 }
12 12
13 function test() 13 function test()
14 { 14 {
15 function evaluateSnippetAndDumpEvaluationDetails(uiSourceCode, context, call back) 15 function evaluateSnippetAndDumpEvaluationDetails(uiSourceCode, context, call back)
16 { 16 {
17 InspectorTest.addSniffer(Snippets.ScriptSnippetModel.prototype, "_printR unScriptResult", dumpResult); 17 InspectorTest.addSniffer(Snippets.ScriptSnippetModel.prototype, "_printR unScriptResult", dumpResult);
18 Snippets.scriptSnippetModel.evaluateScriptSnippet(context, uiSourceCode) ; 18 Snippets.scriptSnippetModel.evaluateScriptSnippet(context, uiSourceCode) ;
19 var target = context.target(); 19 var target = context.target();
20 var mapping = Snippets.scriptSnippetModel._mappingForDebuggerModel.get(S DK.DebuggerModel.fromTarget(target)); 20 var mapping = Snippets.scriptSnippetModel._mappingForDebuggerModel.get(t arget.model(SDK.DebuggerModel));
21 var evaluationSourceURL = mapping._evaluationSourceURL(uiSourceCode); 21 var evaluationSourceURL = mapping._evaluationSourceURL(uiSourceCode);
22 var snippetId = Snippets.scriptSnippetModel._snippetIdForUISourceCode.ge t(uiSourceCode); 22 var snippetId = Snippets.scriptSnippetModel._snippetIdForUISourceCode.ge t(uiSourceCode);
23 InspectorTest.addResult("Last evaluation source url for snippet: " + eva luationSourceURL); 23 InspectorTest.addResult("Last evaluation source url for snippet: " + eva luationSourceURL);
24 InspectorTest.assertEquals(snippetId, Snippets.scriptSnippetModel._snipp etIdForSourceURL(evaluationSourceURL), "Snippet can not be identified by its eva luation sourceURL."); 24 InspectorTest.assertEquals(snippetId, Snippets.scriptSnippetModel._snipp etIdForSourceURL(evaluationSourceURL), "Snippet can not be identified by its eva luation sourceURL.");
25 25
26 26
27 function dumpResult(target, result) 27 function dumpResult(target, result)
28 { 28 {
29 InspectorTest.addResult("Snippet execution result: " + result.descri ption); 29 InspectorTest.addResult("Snippet execution result: " + result.descri ption);
30 callback(); 30 callback();
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 }, 161 },
162 162
163 function testEvaluate(next) 163 function testEvaluate(next)
164 { 164 {
165 var uiSourceCode1; 165 var uiSourceCode1;
166 var uiSourceCode2; 166 var uiSourceCode2;
167 var uiSourceCode3; 167 var uiSourceCode3;
168 var context = UI.context.flavor(SDK.ExecutionContext); 168 var context = UI.context.flavor(SDK.ExecutionContext);
169 169
170 resetSnippetsSettings(); 170 resetSnippetsSettings();
171 var snippetScriptMapping = Snippets.scriptSnippetModel.snippetScript Mapping(SDK.DebuggerModel.fromTarget(SDK.targetManager.targets()[0])); 171 var snippetScriptMapping = Snippets.scriptSnippetModel.snippetScript Mapping(SDK.targetManager.models(SDK.DebuggerModel)[0]);
172 172
173 Snippets.scriptSnippetModel.project().createFile("", null, "", step2 .bind(this)); 173 Snippets.scriptSnippetModel.project().createFile("", null, "", step2 .bind(this));
174 174
175 function step2(uiSourceCode) 175 function step2(uiSourceCode)
176 { 176 {
177 uiSourceCode1 = uiSourceCode; 177 uiSourceCode1 = uiSourceCode;
178 uiSourceCode1.rename("Snippet1", function() { }); 178 uiSourceCode1.rename("Snippet1", function() { });
179 var content = ""; 179 var content = "";
180 content += "// This snippet does nothing.\n"; 180 content += "// This snippet does nothing.\n";
181 content += "var i = 2+2;\n"; 181 content += "var i = 2+2;\n";
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 function snippetFinished(result) 234 function snippetFinished(result)
235 { 235 {
236 var script = snippetScriptMapping._scriptForUISourceCode.get (uiSourceCode); 236 var script = snippetScriptMapping._scriptForUISourceCode.get (uiSourceCode);
237 InspectorTest.addResult("Snippet execution result: " + resul t.description); 237 InspectorTest.addResult("Snippet execution result: " + resul t.description);
238 238
239 InspectorTest.reloadPage(callback) 239 InspectorTest.reloadPage(callback)
240 } 240 }
241 } 241 }
242 242
243 resetSnippetsSettings(); 243 resetSnippetsSettings();
244 var snippetScriptMapping = Snippets.scriptSnippetModel.snippetScript Mapping(SDK.DebuggerModel.fromTarget(SDK.targetManager.targets()[0])); 244 var snippetScriptMapping = Snippets.scriptSnippetModel.snippetScript Mapping(SDK.targetManager.models(SDK.DebuggerModel)[0]);
245 245
246 Snippets.scriptSnippetModel.project().createFile("", null, "", step3 .bind(this)); 246 Snippets.scriptSnippetModel.project().createFile("", null, "", step3 .bind(this));
247 247
248 function step3(uiSourceCode) 248 function step3(uiSourceCode)
249 { 249 {
250 var uiSourceCode1 = uiSourceCode; 250 var uiSourceCode1 = uiSourceCode;
251 uiSourceCode1.rename("Snippet1", function() { }); 251 uiSourceCode1.rename("Snippet1", function() { });
252 var content = ""; 252 var content = "";
253 content += "// This snippet does nothing.\n"; 253 content += "// This snippet does nothing.\n";
254 content += "var i = 2+2;\n"; 254 content += "var i = 2+2;\n";
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 307 }
308 } 308 }
309 ]); 309 ]);
310 }; 310 };
311 </script> 311 </script>
312 </head> 312 </head>
313 <body onload="runTest()"> 313 <body onload="runTest()">
314 <p>Tests script snippet model.</p> 314 <p>Tests script snippet model.</p>
315 </body> 315 </body>
316 </html> 316 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698