OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../http/tests/inspector/console-test.js"></script> |
| 5 <script> |
| 6 function prepareMessages() |
| 7 { |
| 8 var iframe = document.createElement("iframe"); |
| 9 iframe.src = "resources/iframe-logger.html"; |
| 10 document.body.appendChild(iframe); |
| 11 console.log('log from target page'); |
| 12 var worker = new Worker("resources/worker-logger.js"); |
| 13 var startedTest = false; |
| 14 worker.onmessage = function() { |
| 15 if (!startedTest) { |
| 16 runTest(); |
| 17 startedTest = true; |
| 18 } |
| 19 } |
| 20 worker.postMessage(null); |
| 21 } |
| 22 |
| 23 function test(){ |
| 24 InspectorTest.evaluateInPage("prepareMessages()", step2); |
| 25 |
| 26 function step2() { |
| 27 InspectorTest.waitForConsoleMessages(3, step3); |
| 28 } |
| 29 |
| 30 function step3() { |
| 31 InspectorTest.addResult("Adding swContext"); |
| 32 InspectorTest.runtimeModel._executionContextCreated({id: "sw1", auxData:
{ isDefault: true, frameId: "" }, origin: "origin", name: "swContext"}); |
| 33 var options = Console.ConsoleView.instance()._consoleContextSelector._se
lectElement.options; |
| 34 var values = Array.prototype.map.call(options, option => option.value).s
ort(); |
| 35 var currentContextName = Console.ConsoleContextSelector.titleForContext(
UI.context.flavor(SDK.ExecutionContext), false /* formatForSelector */); |
| 36 InspectorTest.addResult('Current context:' + currentContextName); |
| 37 |
| 38 for (var value of values) { |
| 39 InspectorTest.changeExecutionContext(value); |
| 40 var currentContext = UI.context.flavor(SDK.ExecutionContext); |
| 41 InspectorTest.addResult('\nSwitched to context:' + Console.ConsoleCo
ntextSelector.titleForContext(currentContext, false /* formatForSelector */)); |
| 42 InspectorTest.dumpConsoleMessages(); |
| 43 } |
| 44 InspectorTest.completeTest(); |
| 45 } |
| 46 } |
| 47 |
| 48 </script> |
| 49 </head> |
| 50 |
| 51 <body onload="runTest()"> |
| 52 <p> |
| 53 Tests how execution context and target are selected. |
| 54 </p> |
| 55 |
| 56 </body> |
| 57 </html> |
OLD | NEW |