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

Unified 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, 6 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-in-tight-loop.js
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-in-tight-loop.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-in-tight-loop.js
new file mode 100644
index 0000000000000000000000000000000000000000..f56dc97e588ee6d64e3e8b33b1b1f50bad8e3af7
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/debugger-pause-in-tight-loop.js
@@ -0,0 +1,41 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank('');
+
+ await dp.Runtime.enable();
+ await dp.Debugger.enable();
+
+ // Start tight loop in page.
+ session.evaluate(`
+ var terminated = false;
+ function hotFunction() {
+ console.log('hi');
+ var message_id = 1;
+ var ts = Date.now();
+ while (!terminated) {
+ // Without this try/catch v8 will optimize the function and break will not work.
+ try {
+ if (Date.now() - ts > 1000) {
+ ts = Date.now();
+ console.error('Message #' + message_id++);
+ }
+ } catch (e) {
+ }
+ }
+ }
+ setTimeout(hotFunction, 0);
+ `);
+ testRunner.log('didEval');
+
+ await dp.Runtime.onceConsoleAPICalled();
+ testRunner.log('didFireTimer');
+
+ dp.Debugger.pause();
+ await dp.Debugger.oncePaused();
+ testRunner.log('SUCCESS: Paused');
+
+ dp.Runtime.evaluate({expression: 'terminated = true;' });
+ dp.Debugger.resume();
+ await dp.Debugger.onceResumed();
+ testRunner.log('SUCCESS: Resumed');
+ testRunner.completeTest();
+})

Powered by Google App Engine
This is Rietveld 408576698