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

Unified Diff: test/inspector/runtime/create-context.js

Issue 2890463004: [inspector] Refactor inspector test (Closed)
Patch Set: better crash fix 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/inspector/protocol-test.js ('k') | test/inspector/runtime/runtime-restore.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/inspector/runtime/create-context.js
diff --git a/test/inspector/runtime/create-context.js b/test/inspector/runtime/create-context.js
index 4f86e6ec34401a15f11418210272cdfc287e7c51..8a7bd999da94d45d049bc640eb81eb6671539fd0 100644
--- a/test/inspector/runtime/create-context.js
+++ b/test/inspector/runtime/create-context.js
@@ -4,24 +4,20 @@
InspectorTest.log('Checks createContext().');
-InspectorTest.setupScriptMap();
-Protocol.Runtime.onExecutionContextCreated(InspectorTest.logMessage);
-Protocol.Debugger.onPaused((message) => {
- InspectorTest.logSourceLocation(message.params.callFrames[0].location);
- Protocol.Debugger.stepOut();
-});
var executionContextIds = new Set();
-Protocol.Debugger.onScriptParsed(message => executionContextIds.add(message.params.executionContextId));
-var contextGroupId;
+var contextGroup = InspectorTest.createContextGroup();
+var session = InspectorTest.createSession(contextGroup);
+setup(InspectorTest.session);
+setup(session);
+
Protocol.Runtime.enable()
- .then(() => contextGroupId = utils.createContextGroup())
- .then(() => Protocol.Runtime.enable({}, contextGroupId))
+ .then(() => session.Protocol.Runtime.enable({}))
.then(() => Protocol.Debugger.enable())
- .then(() => Protocol.Debugger.enable({}, contextGroupId))
+ .then(() => session.Protocol.Debugger.enable({}))
.then(InspectorTest.logMessage)
.then(() => {
- Protocol.Runtime.evaluate({ expression: 'debugger;' })
- Protocol.Runtime.evaluate({ expression: 'setTimeout(x => x * 2, 0)' }, contextGroupId);
+ Protocol.Runtime.evaluate({ expression: 'debugger;' });
+ session.Protocol.Runtime.evaluate({expression: 'setTimeout(x => x * 2, 0)'});
Protocol.Runtime.evaluate({ expression: 'setTimeout(x => x * 3, 0)' });
})
.then(() => InspectorTest.waitPendingTasks())
@@ -29,14 +25,25 @@ Protocol.Runtime.enable()
InspectorTest.log(`Reported script's execution id: ${executionContextIds.size}`);
executionContextIds.clear();
})
- .then(() => utils.reconnect())
+ .then(() => InspectorTest.session.reconnect())
+ .then(() => session.reconnect())
.then(() => {
Protocol.Runtime.evaluate({ expression: 'debugger;' })
- Protocol.Runtime.evaluate({ expression: 'setTimeout(x => x * 2, 0)' }, contextGroupId);
+ session.Protocol.Runtime.evaluate({ expression: 'setTimeout(x => x * 2, 0)' });
Protocol.Runtime.evaluate({ expression: 'setTimeout(x => x * 3, 0)' });
})
.then(() => InspectorTest.waitPendingTasks())
- .then(() => Protocol.Debugger.disable({}, contextGroupId))
+ .then(() => session.Protocol.Debugger.disable({}))
.then(() => Protocol.Debugger.disable({}))
.then(() => InspectorTest.log(`Reported script's execution id: ${executionContextIds.size}`))
.then(InspectorTest.completeTest);
+
+function setup(session) {
+ session.Protocol.Runtime.onExecutionContextCreated(InspectorTest.logMessage);
+ InspectorTest.setupScriptMap(session);
+ session.Protocol.Debugger.onPaused((message) => {
+ InspectorTest.logSourceLocation(message.params.callFrames[0].location, session);
+ session.Protocol.Debugger.stepOut();
+ });
+ session.Protocol.Debugger.onScriptParsed(message => executionContextIds.add(message.params.executionContextId));
+}
« no previous file with comments | « test/inspector/protocol-test.js ('k') | test/inspector/runtime/runtime-restore.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698