Index: third_party/WebKit/LayoutTests/inspector/console/console-log-multiple-execution-contexts.html |
diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-log-multiple-execution-contexts.html b/third_party/WebKit/LayoutTests/inspector/console/console-log-multiple-execution-contexts.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2802b3540823e3e06490ba553cf1dc8c8fab379e |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/inspector/console/console-log-multiple-execution-contexts.html |
@@ -0,0 +1,57 @@ |
+<html> |
+<head> |
+<script src="../../http/tests/inspector/inspector-test.js"></script> |
+<script src="../../http/tests/inspector/console-test.js"></script> |
+<script> |
+function prepareMessages() |
+{ |
+ var iframe = document.createElement("iframe"); |
+ iframe.src = "resources/iframe-logger.html"; |
+ document.body.appendChild(iframe); |
+ console.log('log from target page'); |
+ var worker = new Worker("resources/worker-logger.js"); |
+ var startedTest = false; |
+ worker.onmessage = function() { |
+ if (!startedTest) { |
+ runTest(); |
+ startedTest = true; |
+ } |
+ } |
+ worker.postMessage(null); |
+} |
+ |
+function test(){ |
+ InspectorTest.evaluateInPage("prepareMessages()", step2); |
+ |
+ function step2() { |
+ InspectorTest.waitForConsoleMessages(3, step3); |
+ } |
+ |
+ function step3() { |
+ InspectorTest.addResult("Adding swContext"); |
+ InspectorTest.runtimeModel._executionContextCreated({id: "sw1", auxData: { isDefault: true, frameId: "" }, origin: "origin", name: "swContext"}); |
+ var options = Console.ConsoleView.instance()._consoleContextSelector._selectElement.options; |
+ var values = Array.prototype.map.call(options, option => option.value).sort(); |
+ var currentContextName = Console.ConsoleContextSelector.titleForContext(UI.context.flavor(SDK.ExecutionContext), false /* formatForSelector */); |
+ InspectorTest.addResult('Current context:' + currentContextName); |
+ |
+ for (var value of values) { |
+ InspectorTest.changeExecutionContext(value); |
+ var currentContext = UI.context.flavor(SDK.ExecutionContext); |
+ InspectorTest.addResult('\nSwitched to context:' + Console.ConsoleContextSelector.titleForContext(currentContext, false /* formatForSelector */)); |
+ InspectorTest.dumpConsoleMessages(); |
+ } |
+ InspectorTest.completeTest(); |
+ } |
+} |
+ |
+</script> |
+</head> |
+ |
+<body onload="runTest()"> |
+<p> |
+Tests how execution context and target are selected. |
+</p> |
+ |
+</body> |
+</html> |