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

Unified Diff: test/inspector/sessions/runtime-console-api-called.js

Issue 2906153002: [inspector] Support multiple sessions per context group (Closed)
Patch Set: using set per kozy@ 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
Index: test/inspector/sessions/runtime-console-api-called.js
diff --git a/test/inspector/sessions/runtime-console-api-called.js b/test/inspector/sessions/runtime-console-api-called.js
new file mode 100644
index 0000000000000000000000000000000000000000..fc9d79bebaa1359ee1577765500618ec66b22e71
--- /dev/null
+++ b/test/inspector/sessions/runtime-console-api-called.js
@@ -0,0 +1,38 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+InspectorTest.log('Tests that all sessions get console api notifications.');
+
+function connect(contextGroup, num) {
+ var session = contextGroup.connect();
+ session.Protocol.Runtime.onConsoleAPICalled(message => {
+ InspectorTest.log('From session ' + num);
+ InspectorTest.logMessage(message);
+ });
+ return session;
+}
+
+(async function test() {
+ var contextGroup = new InspectorTest.ContextGroup();
+ var session1 = connect(contextGroup, 1);
+ var session2 = connect(contextGroup, 2);
+ await session1.Protocol.Runtime.enable();
+ await session2.Protocol.Runtime.enable();
+
+ InspectorTest.log('Error in 2');
+ await session2.Protocol.Runtime.evaluate({expression: 'console.error(1)'});
+
+ InspectorTest.log('Logging in 1');
+ await session1.Protocol.Runtime.evaluate({expression: 'console.log(2)'});
+
+ InspectorTest.log('Error in setTimeout 1');
+ await session1.Protocol.Runtime.evaluate({expression: 'setTimeout(() => console.error("a"), 0)'});
+ await InspectorTest.waitForPendingTasks();
+
+ InspectorTest.log('Logging in setTimeout 2');
+ await session2.Protocol.Runtime.evaluate({expression: 'setTimeout(() => console.log("b"), 0)'});
+ await InspectorTest.waitForPendingTasks();
+
+ InspectorTest.completeTest();
+})();
« no previous file with comments | « test/inspector/sessions/create-session-expected.txt ('k') | test/inspector/sessions/runtime-console-api-called-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698