Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(398)

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/console/console-context-selector.html

Issue 2849583006: [DevTools] Disable contexts in console selector on pause (Closed)
Patch Set: tests Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 src="../../http/tests/inspector/debugger-test.js"></script>
6 <script>
7 function setup() {
8 window.worker = new Worker('resources/worker-pause.js');
9 window.iframe = document.createElement('iframe');
10 window.iframe.src = 'data:text/html;<script>window.foo=1;<' + '/script>';
11 window.iframe.name = 'myframe';
12 document.body.appendChild(window.iframe);
13 return new Promise(f => window.iframe.onload = f);
14 }
15
16 function pauseInWorker() {
17 window.worker.postMessage('pause');
18 }
19
20 function pauseInIframe() {
21 window.iframe.contentWindow.eval('debugger;');
22 }
23
24 function pauseInMain() {
25 debugger;
26 }
27
28 function destroyIframe() {
29 window.iframe.parentElement.removeChild(window.iframe);
30 window.iframe = null;
31 }
32
33 async function test()
34 {
35 await new Promise(f => InspectorTest.startDebuggerTest(f, true));
36
37 await InspectorTest.evaluateInPageAsync('setup()');
38 var workerTarget = await InspectorTest.waitForTarget(target => target.parentTa rget() === InspectorTest.mainTarget);
39 var workerExecutionContext = await InspectorTest.waitForExecutionContext(worke rTarget.model(SDK.RuntimeModel));
40 dump();
41
42 InspectorTest.addResult('');
43 InspectorTest.addResult('Selected worker');
44 UI.context.setFlavor(SDK.Target, workerTarget);
45 dump();
46
47 var mainFrame = InspectorTest.resourceTreeModel.mainFrame;
48 var mainExecutionContext = InspectorTest.runtimeModel.executionContexts().find (context => context.frameId === mainFrame.id);
49 var childFrame = InspectorTest.resourceTreeModel.frames().find(frame => frame !== InspectorTest.resourceTreeModel.mainFrame);
50 var childExecutionContext = InspectorTest.runtimeModel.executionContexts().fin d(context => context.frameId === childFrame.id);
51 InspectorTest.addResult('');
52 InspectorTest.addResult('Selected iframe');
53 UI.context.setFlavor(SDK.ExecutionContext, childExecutionContext);
54 dump();
55
56 InspectorTest.evaluateInPage('pauseInMain()');
57 await InspectorTest.waitUntilPausedPromise();
58 InspectorTest.addResult('');
59 InspectorTest.addResult('Paused in main');
60 dump();
61
62 await new Promise(f => InspectorTest.resumeExecution(f));
63 InspectorTest.addResult('');
64 InspectorTest.addResult('Resumed');
65 dump();
66
67 InspectorTest.evaluateInPage('pauseInWorker()');
68 await InspectorTest.waitUntilPausedPromise();
69 InspectorTest.addResult('');
70 InspectorTest.addResult('Paused in worker');
71 dump();
72
73 await new Promise(f => InspectorTest.resumeExecution(f));
74 InspectorTest.addResult('');
75 InspectorTest.addResult('Resumed');
76 dump();
77
78 InspectorTest.evaluateInPage('pauseInIframe()');
79 await InspectorTest.waitUntilPausedPromise();
80 InspectorTest.addResult('');
81 InspectorTest.addResult('Paused in iframe');
82 dump();
83
84 await new Promise(f => InspectorTest.resumeExecution(f));
85 InspectorTest.addResult('');
86 InspectorTest.addResult('Resumed');
87 dump();
88
89 InspectorTest.evaluateInPage('destroyIframe()');
90 await InspectorTest.waitForExecutionContextDestroyed(childExecutionContext);
91 InspectorTest.addResult('');
92 InspectorTest.addResult('Destroyed iframe');
93 dump();
94
95 InspectorTest.completeDebuggerTest();
96
97 function dump() {
98 var consoleView = Console.ConsoleView.instance();
99 var select = consoleView._executionContextComboBox.selectElement();
100 InspectorTest.addResult('Console context selector:');
101 for (var i = 0; i < select.options.length; i++) {
102 var option = select.options[i];
103 var selected = select.selectedIndex === i;
104 var text = option.text.replace(new RegExp('\u00a0', 'g'), '_');
105 InspectorTest.addResult(`${selected ? '*' : ' '} ${text} ${option.disabled ? '[disabled]' : ''}`);
106 }
107 }
108 }
109 </script>
110 </head>
111 <body onload="runTest()">
112 <p> Tests console execution context selector.
113 </p>
114 </body>
115 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698