11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_cicommon.skipIfInspectorDisabled();
41cb0ef41Sopenharmony_ciconst assert = require('assert');
51cb0ef41Sopenharmony_ciconst { NodeInstance } = require('../common/inspector-helper.js');
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciasync function runTests() {
81cb0ef41Sopenharmony_ci  const child = new NodeInstance(['--inspect-brk=0'],
91cb0ef41Sopenharmony_ci                                 `let c = 0;
101cb0ef41Sopenharmony_ci                                  const interval = setInterval(() => {
111cb0ef41Sopenharmony_ci                                   console.log(new Object());
121cb0ef41Sopenharmony_ci                                   if (c++ === 10)
131cb0ef41Sopenharmony_ci                                     clearInterval(interval);
141cb0ef41Sopenharmony_ci                                 }, ${common.platformTimeout(30)});`);
151cb0ef41Sopenharmony_ci  const session = await child.connectInspectorSession();
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ci  session.send([
181cb0ef41Sopenharmony_ci    { method: 'Profiler.setSamplingInterval',
191cb0ef41Sopenharmony_ci      params: { interval: common.platformTimeout(300) } },
201cb0ef41Sopenharmony_ci    { method: 'Profiler.enable' },
211cb0ef41Sopenharmony_ci    { method: 'Runtime.runIfWaitingForDebugger' },
221cb0ef41Sopenharmony_ci    { method: 'Profiler.start' }]);
231cb0ef41Sopenharmony_ci  while (await child.nextStderrString() !==
241cb0ef41Sopenharmony_ci         'Waiting for the debugger to disconnect...');
251cb0ef41Sopenharmony_ci  await session.send({ method: 'Profiler.stop' });
261cb0ef41Sopenharmony_ci  session.disconnect();
271cb0ef41Sopenharmony_ci  assert.strictEqual((await child.expectShutdown()).exitCode, 0);
281cb0ef41Sopenharmony_ci}
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_cirunTests().then(common.mustCall());
31