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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-in-tight-loop.js

Issue 2968523003: [DevTools] Migrate inspector-protocol/debugger tests to new harness (Closed)
Patch Set: all tests Created 3 years, 5 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 (async function(testRunner) {
2 let {page, session, dp} = await testRunner.startBlank('');
3
4 await dp.Runtime.enable();
5 await dp.Debugger.enable();
6
7 // Start tight loop in page.
8 session.evaluate(`
9 var terminated = false;
10 function hotFunction() {
11 console.log('hi');
12 var message_id = 1;
13 var ts = Date.now();
14 while (!terminated) {
15 // Without this try/catch v8 will optimize the function and break will n ot work.
16 try {
17 if (Date.now() - ts > 1000) {
18 ts = Date.now();
19 console.error('Message #' + message_id++);
20 }
21 } catch (e) {
22 }
23 }
24 }
25 setTimeout(hotFunction, 0);
26 `);
27 testRunner.log('didEval');
28
29 await dp.Runtime.onceConsoleAPICalled();
30 testRunner.log('didFireTimer');
31
32 dp.Debugger.pause();
33 await dp.Debugger.oncePaused();
34 testRunner.log('SUCCESS: Paused');
35
36 dp.Runtime.evaluate({expression: 'terminated = true;' });
37 dp.Debugger.resume();
38 await dp.Debugger.onceResumed();
39 testRunner.log('SUCCESS: Resumed');
40 testRunner.completeTest();
41 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698