OLD | NEW |
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='../isolated-filesystem-test.js'></script> | 5 <script src='../isolated-filesystem-test.js'></script> |
6 <script src='./persistence-test.js'></script> | 6 <script src='./persistence-test.js'></script> |
7 <script> | 7 <script> |
8 | 8 |
9 function addFooJS() { | 9 function addFooJS() { |
10 var script = document.createElement('script'); | 10 var script = document.createElement('script'); |
11 script.src = './resources/foo.js'; | 11 script.src = './resources/foo.js'; |
12 document.body.appendChild(script); | 12 document.body.appendChild(script); |
13 } | 13 } |
14 | 14 |
15 function test() | 15 function test() |
16 { | 16 { |
| 17 var testMapping = InspectorTest.initializeTestMapping(); |
17 var fs = new InspectorTest.TestFileSystem('file:///var/www'); | 18 var fs = new InspectorTest.TestFileSystem('file:///var/www'); |
18 fs.addFileMapping('http://127.0.0.1:8000', '/'); | |
19 InspectorTest.addFooJSFile(fs); | 19 InspectorTest.addFooJSFile(fs); |
20 | 20 |
21 InspectorTest.runTestSuite([ | 21 InspectorTest.runTestSuite([ |
22 function addFileSystem(next) | 22 function addFileSystem(next) |
23 { | 23 { |
24 fs.reportCreated(next); | 24 fs.reportCreated(next); |
25 }, | 25 }, |
26 | 26 |
27 function addNetworkFooJS(next) | 27 function addNetworkFooJS(next) |
28 { | 28 { |
29 InspectorTest.evaluateInPage('addFooJS()'); | 29 InspectorTest.evaluateInPage('addFooJS()'); |
| 30 testMapping.addBinding('foo.js'); |
30 InspectorTest.waitForBinding('foo.js').then(next); | 31 InspectorTest.waitForBinding('foo.js').then(next); |
31 }, | 32 }, |
32 | 33 |
33 function setBreakpointInFileSystemUISourceCode(next) | 34 function setBreakpointInFileSystemUISourceCode(next) |
34 { | 35 { |
35 InspectorTest.waitForUISourceCode('foo.js', Workspace.projectTypes.F
ileSystem) | 36 InspectorTest.waitForUISourceCode('foo.js', Workspace.projectTypes.F
ileSystem) |
36 .then(sourceCode => InspectorTest.showUISourceCodePromise(source
Code)) | 37 .then(sourceCode => InspectorTest.showUISourceCodePromise(source
Code)) |
37 .then(onSourceFrame); | 38 .then(onSourceFrame); |
38 | 39 |
39 function onSourceFrame(sourceFrame) | 40 function onSourceFrame(sourceFrame) |
40 { | 41 { |
41 InspectorTest.setBreakpoint(sourceFrame, 0, '', true); | 42 InspectorTest.setBreakpoint(sourceFrame, 0, '', true); |
42 InspectorTest.waitBreakpointSidebarPane(true).then(dumpBreakpoin
tSidebarPane).then(next); | 43 InspectorTest.waitBreakpointSidebarPane(true).then(dumpBreakpoin
tSidebarPane).then(next); |
43 } | 44 } |
44 }, | 45 }, |
45 | 46 |
46 function reloadPageAndDumpBreakpoints(next) | 47 async function reloadPageAndDumpBreakpoints(next) |
47 { | 48 { |
48 Promise.all([ | 49 testMapping.removeBinding('foo.js'); |
| 50 await Promise.all([ |
49 InspectorTest.waitBreakpointSidebarPane(), | 51 InspectorTest.waitBreakpointSidebarPane(), |
50 InspectorTest.reloadPagePromise() | 52 InspectorTest.reloadPagePromise() |
51 ]).then(dumpBreakpointSidebarPane).then(next); | 53 ]); |
| 54 testMapping.addBinding('foo.js'); |
| 55 dumpBreakpointSidebarPane(); |
| 56 next(); |
52 }, | 57 }, |
53 ]); | 58 ]); |
54 | 59 |
55 function dumpBreakpointSidebarPane() | 60 function dumpBreakpointSidebarPane() |
56 { | 61 { |
57 var paneElement = self.runtime.sharedInstance(Sources.JavaScriptBreakpoi
ntsSidebarPane).contentElement; | 62 var paneElement = self.runtime.sharedInstance(Sources.JavaScriptBreakpoi
ntsSidebarPane).contentElement; |
58 var empty = paneElement.querySelector('.gray-info-message'); | 63 var empty = paneElement.querySelector('.gray-info-message'); |
59 if (empty) | 64 if (empty) |
60 return InspectorTest.textContentWithLineBreaks(empty); | 65 return InspectorTest.textContentWithLineBreaks(empty); |
61 var entries = Array.from(paneElement.querySelectorAll('.breakpoint-entry
')); | 66 var entries = Array.from(paneElement.querySelectorAll('.breakpoint-entry
')); |
62 for (var entry of entries) { | 67 for (var entry of entries) { |
63 var uiLocation = entry[Sources.JavaScriptBreakpointsSidebarPane._loc
ationSymbol]; | 68 var uiLocation = entry[Sources.JavaScriptBreakpointsSidebarPane._loc
ationSymbol]; |
64 InspectorTest.addResult(" " + uiLocation.uiSourceCode.url() +":"
+ uiLocation.lineNumber); | 69 InspectorTest.addResult(" " + uiLocation.uiSourceCode.url() +":"
+ uiLocation.lineNumber); |
65 } | 70 } |
66 } | 71 } |
67 }; | 72 }; |
68 </script> | 73 </script> |
69 </head> | 74 </head> |
70 <body onload='runTest()'> | 75 <body onload='runTest()'> |
71 <p>Verify that breakpoints are moved appropriately in case of page reload.</p> | 76 <p>Verify that breakpoints are moved appropriately in case of page reload.</p> |
72 </body> | 77 </body> |
73 </html> | 78 </html> |
OLD | NEW |