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

Unified Diff: test/inspector/runtime/runtime-restore.js

Issue 2713023004: [inspector] added reconnect method for tests (Closed)
Patch Set: rebased Created 3 years, 10 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/runtime/run-script-async.js ('k') | test/inspector/runtime/runtime-restore-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/inspector/runtime/runtime-restore.js
diff --git a/test/inspector/runtime/runtime-restore.js b/test/inspector/runtime/runtime-restore.js
new file mode 100644
index 0000000000000000000000000000000000000000..5c2fea5768d9f1b92147ca0cf22ddb8592464063
--- /dev/null
+++ b/test/inspector/runtime/runtime-restore.js
@@ -0,0 +1,77 @@
+// 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.v8
+
+InspectorTest.log('Checks that Runtime agent correctly restore its state.');
+
+InspectorTest.addScript(`
+var formatter = {
+ header: function(x)
+ {
+ return ["span", {}, "Header formatted ", x.name];
+ },
+
+ hasBody: function(x)
+ {
+ return true;
+ },
+
+ body: function(x)
+ {
+ return ["span", {}, "Body formatted ", x.name]
+ }
+};
+
+devtoolsFormatters = [ formatter ];
+
+//# sourceURL=test.js`)
+
+InspectorTest.runTestSuite([
+ function testExecutionContextsNotificationsOnRestore(next) {
+ Protocol.Runtime.onExecutionContextsCleared(InspectorTest.logMessage);
+ Protocol.Runtime.onExecutionContextCreated(InspectorTest.logMessage);
+ Protocol.Runtime.onExecutionContextDestroyed(InspectorTest.logMessage);
+ Protocol.Runtime.enable()
+ .then(reconnect)
+ .then(Protocol.Runtime.disable)
+ .then(() => {
+ Protocol.Runtime.onExecutionContextsCleared(null);
+ Protocol.Runtime.onExecutionContextCreated(null);
+ Protocol.Runtime.onExecutionContextDestroyed(null);
+ next()
+ });
+ },
+
+ function testConsoleAPICalledAfterRestore(next) {
+ Protocol.Runtime.onConsoleAPICalled(InspectorTest.logMessage);
+ Protocol.Runtime.enable()
+ .then(reconnect)
+ .then(() => Protocol.Runtime.evaluate({ expression: 'console.log(42);' }))
+ .then(Protocol.Runtime.disable)
+ .then(() => {
+ Protocol.Runtime.onConsoleAPICalled(null);
+ next();
+ });
+ },
+
+ function testSetCustomObjectFormatterEnabled(next) {
+ Protocol.Runtime.onConsoleAPICalled(InspectorTest.logMessage);
+ // cleanup console message storage
+ reconnect();
+ Protocol.Runtime.enable()
+ .then(() => Protocol.Runtime.setCustomObjectFormatterEnabled({ enabled: true }))
+ .then(reconnect)
+ .then(() => Protocol.Runtime.evaluate({ expression: 'console.log({ name: 42 })'}))
+ .then(InspectorTest.logMessage)
+ .then(Protocol.Runtime.disable)
+ .then(() => {
+ Protocol.Runtime.onConsoleAPICalled(null);
+ next();
+ });
+ },
+]);
+
+function reconnect() {
+ InspectorTest.logMessage('will reconnect..');
+ utils.reconnect();
+}
« no previous file with comments | « test/inspector/runtime/run-script-async.js ('k') | test/inspector/runtime/runtime-restore-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698