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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 { | 97 { |
98 uiSourceCode1 = uiSourceCode; | 98 uiSourceCode1 = uiSourceCode; |
99 | 99 |
100 uiSourceCode1.requestContent().then(contentCallback) | 100 uiSourceCode1.requestContent().then(contentCallback) |
101 .then(contentDumped1); | 101 .then(contentDumped1); |
102 | 102 |
103 function contentDumped1() | 103 function contentDumped1() |
104 { | 104 { |
105 uiSourceCode1.addRevision("<snippet content>"); | 105 uiSourceCode1.addRevision("<snippet content>"); |
106 InspectorTest.addResult("Snippet content set."); | 106 InspectorTest.addResult("Snippet content set."); |
107 delete uiSourceCode1._content; | 107 uiSourceCode1._requestContentPromise = null; |
einbinder
2016/12/19 21:34:16
There was a race condition before with _requestCon
| |
108 delete uiSourceCode1._contentLoaded; | 108 uiSourceCode1.contentLoaded = false; |
109 uiSourceCode1.requestContent() | 109 uiSourceCode1.requestContent() |
110 .then(contentCallback) | 110 .then(contentCallback) |
111 .then(contentDumped2) | 111 .then(contentDumped2) |
112 } | 112 } |
113 | 113 |
114 function contentDumped2() | 114 function contentDumped2() |
115 { | 115 { |
116 InspectorTest.addResult("Snippet1 created."); | 116 InspectorTest.addResult("Snippet1 created."); |
117 Snippets.scriptSnippetModel.project().createFile("", null, " ", step3.bind(this)); | 117 Snippets.scriptSnippetModel.project().createFile("", null, " ", step3.bind(this)); |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 function step3(uiSourceCode) | 121 function step3(uiSourceCode) |
122 { | 122 { |
123 var uiSourceCode2 = uiSourceCode; | 123 var uiSourceCode2 = uiSourceCode; |
124 InspectorTest.addResult("Snippet2 created."); | 124 InspectorTest.addResult("Snippet2 created."); |
125 renameSnippetAndCheckWorkspace(uiSourceCode1, "foo"); | 125 renameSnippetAndCheckWorkspace(uiSourceCode1, "foo"); |
126 renameSnippetAndCheckWorkspace(uiSourceCode1, " "); | 126 renameSnippetAndCheckWorkspace(uiSourceCode1, " "); |
127 renameSnippetAndCheckWorkspace(uiSourceCode1, " bar "); | 127 renameSnippetAndCheckWorkspace(uiSourceCode1, " bar "); |
128 renameSnippetAndCheckWorkspace(uiSourceCode1, "foo"); | 128 renameSnippetAndCheckWorkspace(uiSourceCode1, "foo"); |
129 renameSnippetAndCheckWorkspace(uiSourceCode2, "bar"); | 129 renameSnippetAndCheckWorkspace(uiSourceCode2, "bar"); |
130 renameSnippetAndCheckWorkspace(uiSourceCode2, "foo"); | 130 renameSnippetAndCheckWorkspace(uiSourceCode2, "foo"); |
131 delete uiSourceCode1._content; | 131 uiSourceCode1._requestContentPromise = null; |
132 delete uiSourceCode1._contentLoaded; | 132 uiSourceCode1.contentLoaded = false; |
133 uiSourceCode1.requestContent() | 133 uiSourceCode1.requestContent() |
134 .then(contentCallback) | 134 .then(contentCallback) |
135 .then(onContentDumped); | 135 .then(onContentDumped); |
136 | 136 |
137 function onContentDumped() | 137 function onContentDumped() |
138 { | 138 { |
139 Snippets.scriptSnippetModel.project().deleteFile(uiSourceCod e1.url()); | 139 Snippets.scriptSnippetModel.project().deleteFile(uiSourceCod e1.url()); |
140 Snippets.scriptSnippetModel.project().deleteFile(uiSourceCod e2.url()); | 140 Snippets.scriptSnippetModel.project().deleteFile(uiSourceCod e2.url()); |
141 Snippets.scriptSnippetModel.project().createFile("", null, " ", step4.bind(this)); | 141 Snippets.scriptSnippetModel.project().createFile("", null, " ", step4.bind(this)); |
142 } | 142 } |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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> |
OLD | NEW |