OLD | NEW |
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)); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 var storageSnippetsCount = WebInspector.scriptSnippetModel._snip
petStorage.snippets().length; | 82 var storageSnippetsCount = WebInspector.scriptSnippetModel._snip
petStorage.snippets().length; |
83 InspectorTest.addResult("Number of snippets in the storage: " +
storageSnippetsCount); | 83 InspectorTest.addResult("Number of snippets in the storage: " +
storageSnippetsCount); |
84 } | 84 } |
85 | 85 |
86 function contentCallback(content) | 86 function contentCallback(content) |
87 { | 87 { |
88 InspectorTest.addResult("Snippet content: " + content); | 88 InspectorTest.addResult("Snippet content: " + content); |
89 } | 89 } |
90 | 90 |
91 resetSnippetsSettings(); | 91 resetSnippetsSettings(); |
92 | 92 |
93 WebInspector.scriptSnippetModel.project().createFile("", null, "", s
tep2.bind(this)); | 93 WebInspector.scriptSnippetModel.project().createFile("", null, "", s
tep2.bind(this)); |
94 | 94 |
95 function step2(uiSourceCode) | 95 function step2(uiSourceCode) |
96 { | 96 { |
97 uiSourceCode1 = uiSourceCode; | 97 uiSourceCode1 = uiSourceCode; |
98 | |
99 uiSourceCode1.requestContent(contentCallback); | |
100 uiSourceCode1.addRevision("<snippet content>"); | |
101 InspectorTest.addResult("Snippet content set."); | |
102 delete uiSourceCode1._content; | |
103 delete uiSourceCode1._contentLoaded; | |
104 uiSourceCode1.requestContent(contentCallback); | |
105 InspectorTest.addResult("Snippet1 created."); | |
106 | 98 |
107 WebInspector.scriptSnippetModel.project().createFile("", null, "
", step3.bind(this)); | 99 uiSourceCode1.requestContent().then(contentCallback) |
| 100 .then(contentDumped1); |
| 101 |
| 102 function contentDumped1() |
| 103 { |
| 104 uiSourceCode1.addRevision("<snippet content>"); |
| 105 InspectorTest.addResult("Snippet content set."); |
| 106 delete uiSourceCode1._content; |
| 107 delete uiSourceCode1._contentLoaded; |
| 108 uiSourceCode1.requestContent() |
| 109 .then(contentCallback) |
| 110 .then(contentDumped2) |
| 111 } |
| 112 |
| 113 function contentDumped2() |
| 114 { |
| 115 InspectorTest.addResult("Snippet1 created."); |
| 116 WebInspector.scriptSnippetModel.project().createFile("", nul
l, "", step3.bind(this)); |
| 117 } |
108 } | 118 } |
109 | 119 |
110 function step3(uiSourceCode) | 120 function step3(uiSourceCode) |
111 { | 121 { |
112 var uiSourceCode2 = uiSourceCode; | 122 var uiSourceCode2 = uiSourceCode; |
113 InspectorTest.addResult("Snippet2 created."); | 123 InspectorTest.addResult("Snippet2 created."); |
114 renameSnippetAndCheckWorkspace(uiSourceCode1, "foo"); | 124 renameSnippetAndCheckWorkspace(uiSourceCode1, "foo"); |
115 renameSnippetAndCheckWorkspace(uiSourceCode1, " "); | 125 renameSnippetAndCheckWorkspace(uiSourceCode1, " "); |
116 renameSnippetAndCheckWorkspace(uiSourceCode1, " bar "); | 126 renameSnippetAndCheckWorkspace(uiSourceCode1, " bar "); |
117 renameSnippetAndCheckWorkspace(uiSourceCode1, "foo"); | 127 renameSnippetAndCheckWorkspace(uiSourceCode1, "foo"); |
118 renameSnippetAndCheckWorkspace(uiSourceCode2, "bar"); | 128 renameSnippetAndCheckWorkspace(uiSourceCode2, "bar"); |
119 renameSnippetAndCheckWorkspace(uiSourceCode2, "foo"); | 129 renameSnippetAndCheckWorkspace(uiSourceCode2, "foo"); |
120 delete uiSourceCode1._content; | 130 delete uiSourceCode1._content; |
121 delete uiSourceCode1._contentLoaded; | 131 delete uiSourceCode1._contentLoaded; |
122 uiSourceCode1.requestContent(contentCallback); | 132 uiSourceCode1.requestContent() |
123 | 133 .then(contentCallback) |
124 WebInspector.scriptSnippetModel.project().deleteFile(uiSourceCod
e1.url()); | 134 .then(onContentDumped); |
125 WebInspector.scriptSnippetModel.project().deleteFile(uiSourceCod
e2.url()); | |
126 | 135 |
127 WebInspector.scriptSnippetModel.project().createFile("", null, "
", step4.bind(this)); | 136 function onContentDumped() |
| 137 { |
| 138 WebInspector.scriptSnippetModel.project().deleteFile(uiSourc
eCode1.url()); |
| 139 WebInspector.scriptSnippetModel.project().deleteFile(uiSourc
eCode2.url()); |
| 140 WebInspector.scriptSnippetModel.project().createFile("", nul
l, "", step4.bind(this)); |
| 141 } |
128 } | 142 } |
129 | 143 |
130 function step4(uiSourceCode) | 144 function step4(uiSourceCode) |
131 { | 145 { |
132 var uiSourceCode3 = uiSourceCode; | 146 var uiSourceCode3 = uiSourceCode; |
133 InspectorTest.addResult("Snippet3 created."); | 147 InspectorTest.addResult("Snippet3 created."); |
134 WebInspector.scriptSnippetModel.project().deleteFile(uiSourceCod
e3.url()); | 148 WebInspector.scriptSnippetModel.project().deleteFile(uiSourceCod
e3.url()); |
135 InspectorTest.addResult("Snippet3 deleted."); | 149 InspectorTest.addResult("Snippet3 deleted."); |
136 | 150 |
137 InspectorTest.addResult("Number of uiSourceCodes in workspace: "
+ workspace.uiSourceCodes().filter(filterSnippet).length); | 151 InspectorTest.addResult("Number of uiSourceCodes in workspace: "
+ workspace.uiSourceCodes().filter(filterSnippet).length); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 } | 265 } |
252 }, | 266 }, |
253 ]); | 267 ]); |
254 }; | 268 }; |
255 </script> | 269 </script> |
256 </head> | 270 </head> |
257 <body onload="runTest()"> | 271 <body onload="runTest()"> |
258 <p>Tests script snippet model.</p> | 272 <p>Tests script snippet model.</p> |
259 </body> | 273 </body> |
260 </html> | 274 </html> |
OLD | NEW |