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 src="./resources/foo.js"></script> | 7 <script src="./resources/foo.js"></script> |
8 <script> | 8 <script> |
9 | 9 |
10 function test() | 10 function test() |
11 { | 11 { |
| 12 var testMapping = InspectorTest.initializeTestMapping(); |
12 Runtime.experiments.enableForTest("persistence2"); | 13 Runtime.experiments.enableForTest("persistence2"); |
13 var sourcesNavigator = new Sources.SourcesNavigatorView(); | 14 var sourcesNavigator = new Sources.SourcesNavigatorView(); |
14 sourcesNavigator.show(UI.inspectorView.element); | 15 sourcesNavigator.show(UI.inspectorView.element); |
15 var fs = new InspectorTest.TestFileSystem("file:///var/www"); | 16 var fs = new InspectorTest.TestFileSystem("file:///var/www"); |
16 var fsEntry = InspectorTest.addFooJSFile(fs); | 17 var fsEntry = InspectorTest.addFooJSFile(fs); |
17 | 18 |
18 InspectorTest.runTestSuite([ | 19 InspectorTest.runTestSuite([ |
19 function addFileSystem(next) | 20 function addFileSystem(next) |
20 { | 21 { |
21 fs.reportCreated(next); | 22 fs.reportCreated(next); |
22 }, | 23 }, |
23 | 24 |
24 function waitForUISourceCodes(next) | 25 function waitForUISourceCodes(next) |
25 { | 26 { |
26 var promises = [ | 27 var promises = [ |
27 InspectorTest.waitForUISourceCode("foo.js", Workspace.projectTyp
es.Network), | 28 InspectorTest.waitForUISourceCode("foo.js", Workspace.projectTyp
es.Network), |
28 InspectorTest.waitForUISourceCode("foo.js", Workspace.projectTyp
es.FileSystem) | 29 InspectorTest.waitForUISourceCode("foo.js", Workspace.projectTyp
es.FileSystem) |
29 ]; | 30 ]; |
30 Promise.all(promises).then(onUISourceCodesAdded); | 31 Promise.all(promises).then(onUISourceCodesAdded); |
31 | 32 |
32 function onUISourceCodesAdded() | 33 function onUISourceCodesAdded() |
33 { | 34 { |
34 InspectorTest.dumpNavigatorView(sourcesNavigator, true); | 35 InspectorTest.dumpNavigatorView(sourcesNavigator, true); |
35 next(); | 36 next(); |
36 } | 37 } |
37 }, | 38 }, |
38 | 39 |
39 function addFileMapping(next) | 40 function addFileMapping(next) |
40 { | 41 { |
| 42 testMapping.addBinding("foo.js"); |
41 InspectorTest.waitForBinding("foo.js").then(onBindingCreated); | 43 InspectorTest.waitForBinding("foo.js").then(onBindingCreated); |
42 Workspace.fileSystemMapping.addFileMapping(fs.fileSystemPath, "http:
//127.0.0.1:8000", "/"); | |
43 | 44 |
44 function onBindingCreated(binding) | 45 function onBindingCreated(binding) |
45 { | 46 { |
46 InspectorTest.dumpNavigatorView(sourcesNavigator, true); | 47 InspectorTest.dumpNavigatorView(sourcesNavigator, true); |
47 next(); | 48 next(); |
48 } | 49 } |
49 }, | 50 }, |
50 | 51 |
51 function removeFileMapping(next) | 52 function removeFileMapping(next) |
52 { | 53 { |
53 Persistence.persistence.addEventListener(Persistence.Persistence.Eve
nts.BindingRemoved, onBindingRemoved); | 54 Persistence.persistence.addEventListener(Persistence.Persistence.Eve
nts.BindingRemoved, onBindingRemoved); |
54 Workspace.fileSystemMapping.removeFileMapping(fs.fileSystemPath, "ht
tp://127.0.0.1:8000", "/"); | 55 testMapping.removeBinding("foo.js"); |
55 | 56 |
56 function onBindingRemoved(event) | 57 function onBindingRemoved(event) |
57 { | 58 { |
58 var binding = event.data; | 59 var binding = event.data; |
59 if (binding.network.name() !== "foo.js") | 60 if (binding.network.name() !== "foo.js") |
60 return | 61 return |
61 Persistence.persistence.removeEventListener(Persistence.Persiste
nce.Events.BindingRemoved, onBindingRemoved); | 62 Persistence.persistence.removeEventListener(Persistence.Persiste
nce.Events.BindingRemoved, onBindingRemoved); |
62 InspectorTest.dumpNavigatorView(sourcesNavigator, true); | 63 InspectorTest.dumpNavigatorView(sourcesNavigator, true); |
63 next(); | 64 next(); |
64 } | 65 } |
65 }, | 66 }, |
66 ]); | 67 ]); |
67 }; | 68 }; |
68 </script> | 69 </script> |
69 </head> | 70 </head> |
70 <body onload="runTest()"> | 71 <body onload="runTest()"> |
71 <p>Verify that navigator view removes mapped UISourceCodes.</p> | 72 <p>Verify that navigator view removes mapped UISourceCodes.</p> |
72 </body> | 73 </body> |
73 </html> | 74 </html> |
OLD | NEW |