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..a469ffc7d0850c58b0213e650ff6cd564b8d0366 |
--- /dev/null |
+++ b/test/inspector/runtime/runtime-restore.js |
@@ -0,0 +1,67 @@ |
+// 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 |
+ |
+print('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(() => InspectorTest.log('will reconnect..')) |
+ .then(() => reconnect()) |
+ .then(Protocol.Runtime.disable) |
+ .then(() => Protocol.Runtime.onExecutionContextsCleared(null)) |
+ .then(() => Protocol.Runtime.onExecutionContextCreated(null)) |
+ .then(() => Protocol.Runtime.onExecutionContextDestroyed(null)) |
dgozman
2017/02/27 18:44:56
Why do you chain sync functions?
kozy
2017/02/27 19:57:13
Done.
|
+ .then(next); |
+ }, |
+ |
+ function testConsoleAPICalledAfterRestore(next) { |
+ Protocol.Runtime.onConsoleAPICalled(InspectorTest.logMessage); |
+ Protocol.Runtime.enable() |
+ .then(() => InspectorTest.log('will reconnect..')) |
+ .then(() => reconnect()) |
+ .then(() => Protocol.Runtime.evaluate({ expression: 'console.log(42)' })) |
+ .then(Protocol.Runtime.disable) |
+ .then(() => Protocol.Runtime.onConsoleAPICalled(null)) |
+ .then(next); |
+ }, |
+ |
+ function testSetCustomObjectFormatterEnabled(next) { |
+ Protocol.Runtime.onConsoleAPICalled(InspectorTest.logMessage); |
+ Protocol.Runtime.setCustomObjectFormatterEnabled({ enabled: true }) |
+ .then(() => InspectorTest.log('will reconnect..')) |
+ .then(() => reconnect()) |
+ .then(Protocol.Runtime.enable) |
+ .then(() => Protocol.Runtime.evaluate({ expression: 'console.log({ name: 42 })'})) |
+ .then(InspectorTest.logMessage) |
+ .then(() => Protocol.Runtime.onConsoleAPICalled(null)) |
+ .then(Protocol.Runtime.disable) |
+ .then(next); |
+ }, |
+]); |