Chromium Code Reviews| 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/timeline-test.js"></script> | 4 <script src="../../../http/tests/inspector/timeline-test.js"></script> |
| 5 <script src="../../tracing-test.js"></script> | 5 <script src="../../tracing-test.js"></script> |
| 6 <script> | 6 <script> |
| 7 | 7 |
| 8 function importStyle(onComplete) | 8 function importStyle() |
| 9 { | 9 { |
| 10 var callback; | |
| 11 var promies = new Promise((fulfill) => callback = fulfill); | |
| 10 var link = document.createElement('link'); | 12 var link = document.createElement('link'); |
| 11 link.setAttribute('rel', 'stylesheet'); | 13 link.setAttribute('rel', 'stylesheet'); |
| 12 link.type = 'text/css'; | 14 link.type = 'text/css'; |
| 13 link.href = '../resources/style.css'; | 15 link.href = '../resources/style.css'; |
| 14 document.head.appendChild(link); | 16 document.head.appendChild(link); |
| 15 link.onload = onComplete.bind(this, null); | 17 link.onload = callback.bind(this, null); |
|
caseq
2016/08/05 17:56:42
use createLoadPromise()
kozy
2016/08/10 01:21:15
Done.
| |
| 18 return promies; | |
| 16 } | 19 } |
| 17 | 20 |
| 18 function test() | 21 function test() |
| 19 { | 22 { |
| 20 InspectorTest.invokeWithTracing("importStyle", processTracingEvents); | 23 InspectorTest.invokeWithTracing("importStyle", processTracingEvents); |
| 21 | 24 |
| 22 function processTracingEvents() | 25 function processTracingEvents() |
| 23 { | 26 { |
| 24 var record = InspectorTest.findFirstTimelineRecord(WebInspector.Timeline Model.RecordType.ParseAuthorStyleSheet); | 27 var record = InspectorTest.findFirstTimelineRecord(WebInspector.Timeline Model.RecordType.ParseAuthorStyleSheet); |
| 25 if (record) | 28 if (record) |
| 26 InspectorTest.addResult("SUCCESS: found ParseAuthorStyleSheet record "); | 29 InspectorTest.addResult("SUCCESS: found ParseAuthorStyleSheet record "); |
| 27 else | 30 else |
| 28 InspectorTest.addResult("FAIL: ParseAuthorStyleSheet record not foun d"); | 31 InspectorTest.addResult("FAIL: ParseAuthorStyleSheet record not foun d"); |
| 29 InspectorTest.completeTest(); | 32 InspectorTest.completeTest(); |
| 30 } | 33 } |
| 31 } | 34 } |
| 32 | 35 |
| 33 </script> | 36 </script> |
| 34 </head> | 37 </head> |
| 35 | 38 |
| 36 <body onload="runTest()"> | 39 <body onload="runTest()"> |
| 37 <p> | 40 <p> |
| 38 Tests that ParseAuthorStyleSheet trace event is recorded. | 41 Tests that ParseAuthorStyleSheet trace event is recorded. |
| 39 </p> | 42 </p> |
| 40 </body> | 43 </body> |
| 41 </html> | 44 </html> |
| OLD | NEW |