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

Side by Side Diff: LayoutTests/inspector/sources/debugger/dynamic-script-tag.html

Issue 881263002: DevTools: use target-based model accessors only. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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="../../../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 src="resources/load-dynamic-script.js"></script> 6 <script src="resources/load-dynamic-script.js"></script>
7 <script> 7 <script>
8 8
9 var test = function() 9 var test = function()
10 { 10 {
11 InspectorTest.runDebuggerTestSuite([ 11 InspectorTest.runDebuggerTestSuite([
12 function testOpenDevToolsAfterLoad(next) 12 function testOpenDevToolsAfterLoad(next)
13 { 13 {
14 var consoleMessagesCount = 2; 14 var consoleMessagesCount = 2;
15 15
16 var messages = WebInspector.consoleModel.messages(); 16 var messages = InspectorTest.consoleModel.messages();
17 for (var i = 0; i < messages.length; ++i) 17 for (var i = 0; i < messages.length; ++i)
18 processMessage(messages[i]); 18 processMessage(messages[i]);
19 checkWhenScriptsLoaded(); 19 checkWhenScriptsLoaded();
20 20
21 function processMessage(message) 21 function processMessage(message)
22 { 22 {
23 if (message.messageText.indexOf("DYNAMIC") !== -1) 23 if (message.messageText.indexOf("DYNAMIC") !== -1)
24 --consoleMessagesCount; 24 --consoleMessagesCount;
25 } 25 }
26 26
27 function consoleMessageAppended(message) 27 function consoleMessageAppended(message)
28 { 28 {
29 processMessage(message); 29 processMessage(message);
30 checkWhenScriptsLoaded(); 30 checkWhenScriptsLoaded();
31 } 31 }
32 32
33 function checkWhenScriptsLoaded() 33 function checkWhenScriptsLoaded()
34 { 34 {
35 if (consoleMessagesCount) { 35 if (consoleMessagesCount) {
36 InspectorTest.addConsoleSniffer(consoleMessageAppended); 36 InspectorTest.addConsoleSniffer(consoleMessageAppended);
37 return; 37 return;
38 } 38 }
39 39
40 InspectorTest.addResult("Both dynamic scripts were loaded."); 40 InspectorTest.addResult("Both dynamic scripts were loaded.");
41 var scripts = Object.values(WebInspector.debuggerModel.scripts); 41 var scripts = Object.values(InspectorTest.debuggerModel.scripts) ;
42 42
43 function filterOutInlineAndStandaloneScripts(script) 43 function filterOutInlineAndStandaloneScripts(script)
44 { 44 {
45 return !script.isInlineScript() && script.sourceURL.indexOf( "dynamic-script-tag.html") !== -1; 45 return !script.isInlineScript() && script.sourceURL.indexOf( "dynamic-script-tag.html") !== -1;
46 } 46 }
47 scripts = scripts.filter(filterOutInlineAndStandaloneScripts); 47 scripts = scripts.filter(filterOutInlineAndStandaloneScripts);
48 InspectorTest.addResult("Number of non-inline scripts with docum ent url as a sourceURL: " + scripts.length + "."); 48 InspectorTest.addResult("Number of non-inline scripts with docum ent url as a sourceURL: " + scripts.length + ".");
49 next(); 49 next();
50 } 50 }
51 }, 51 },
52 52
53 function testOpenDevToolsThenReload(next) 53 function testOpenDevToolsThenReload(next)
54 { 54 {
55 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerMod el.Events.ParsedScriptSource, scriptParsed); 55 InspectorTest.debuggerModel.addEventListener(WebInspector.DebuggerMo del.Events.ParsedScriptSource, scriptParsed);
56 InspectorTest.addResult("Reloading page."); 56 InspectorTest.addResult("Reloading page.");
57 InspectorTest.reloadPage(onPageReloaded); 57 InspectorTest.reloadPage(onPageReloaded);
58 58
59 var eventsCountBeforeNext = 2; 59 var eventsCountBeforeNext = 2;
60 function onPageReloaded() 60 function onPageReloaded()
61 { 61 {
62 if (!--eventsCountBeforeNext) 62 if (!--eventsCountBeforeNext)
63 next(); 63 next();
64 } 64 }
65 65
66 function scriptParsed(event) 66 function scriptParsed(event)
67 { 67 {
68 var script = event.data; 68 var script = event.data;
69 if (script.sourceURL.indexOf("dynamic-script-tag.html") !== -1) { 69 if (script.sourceURL.indexOf("dynamic-script-tag.html") !== -1) {
70 // Both dynamic scripts will be loaded before inline script on reload, so we are just checking 70 // Both dynamic scripts will be loaded before inline script on reload, so we are just checking
71 // that the first one that has document url as a sourceURL i s inline. 71 // that the first one that has document url as a sourceURL i s inline.
72 InspectorTest.addResult("The first script with document url as a sourceURL to be seen is " + (script.isInlineScript() ? "" : "not ") + "inli ne script."); 72 InspectorTest.addResult("The first script with document url as a sourceURL to be seen is " + (script.isInlineScript() ? "" : "not ") + "inli ne script.");
73 InspectorTest.assertTrue(script.isInlineScript(), "Only inli ne scripts should have document url as a sourceURL."); 73 InspectorTest.assertTrue(script.isInlineScript(), "Only inli ne scripts should have document url as a sourceURL.");
74 WebInspector.debuggerModel.removeEventListener(WebInspector. DebuggerModel.Events.ParsedScriptSource, scriptParsed); 74 InspectorTest.debuggerModel.removeEventListener(WebInspector .DebuggerModel.Events.ParsedScriptSource, scriptParsed);
75 if (!--eventsCountBeforeNext) 75 if (!--eventsCountBeforeNext)
76 next(); 76 next();
77 } 77 }
78 } 78 }
79 }, 79 },
80 ]); 80 ]);
81 } 81 }
82 </script> 82 </script>
83 </head> 83 </head>
84 <body onload="runTest()"> 84 <body onload="runTest()">
85 <p>Tests that inline scripts and document.write scripts get different uiSourceCo des with different URLs. 85 <p>Tests that inline scripts and document.write scripts get different uiSourceCo des with different URLs.
86 <a href="https://bugs.webkit.org/show_bug.cgi?id=87119">Bug 87119</a> 86 <a href="https://bugs.webkit.org/show_bug.cgi?id=87119">Bug 87119</a>
87 </body> 87 </body>
88 </html> 88 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698