Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file.v8 | |
| 4 | |
| 5 print('Checks that Runtime agent correctly restore its state.'); | |
| 6 | |
| 7 InspectorTest.addScript(` | |
| 8 var formatter = { | |
| 9 header: function(x) | |
| 10 { | |
| 11 return ["span", {}, "Header formatted ", x.name]; | |
| 12 }, | |
| 13 | |
| 14 hasBody: function(x) | |
| 15 { | |
| 16 return true; | |
| 17 }, | |
| 18 | |
| 19 body: function(x) | |
| 20 { | |
| 21 return ["span", {}, "Body formatted ", x.name] | |
| 22 } | |
| 23 }; | |
| 24 | |
| 25 devtoolsFormatters = [ formatter ]; | |
| 26 | |
| 27 //# sourceURL=test.js`) | |
| 28 | |
| 29 InspectorTest.runTestSuite([ | |
| 30 function testExecutionContextsNotificationsOnRestore(next) { | |
| 31 Protocol.Runtime.onExecutionContextsCleared(InspectorTest.logMessage); | |
| 32 Protocol.Runtime.onExecutionContextCreated(InspectorTest.logMessage); | |
| 33 Protocol.Runtime.onExecutionContextDestroyed(InspectorTest.logMessage); | |
| 34 Protocol.Runtime.enable() | |
| 35 .then(() => InspectorTest.log('will reconnect..')) | |
| 36 .then(() => reconnect()) | |
| 37 .then(Protocol.Runtime.disable) | |
| 38 .then(() => Protocol.Runtime.onExecutionContextsCleared(null)) | |
| 39 .then(() => Protocol.Runtime.onExecutionContextCreated(null)) | |
| 40 .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.
| |
| 41 .then(next); | |
| 42 }, | |
| 43 | |
| 44 function testConsoleAPICalledAfterRestore(next) { | |
| 45 Protocol.Runtime.onConsoleAPICalled(InspectorTest.logMessage); | |
| 46 Protocol.Runtime.enable() | |
| 47 .then(() => InspectorTest.log('will reconnect..')) | |
| 48 .then(() => reconnect()) | |
| 49 .then(() => Protocol.Runtime.evaluate({ expression: 'console.log(42)' })) | |
| 50 .then(Protocol.Runtime.disable) | |
| 51 .then(() => Protocol.Runtime.onConsoleAPICalled(null)) | |
| 52 .then(next); | |
| 53 }, | |
| 54 | |
| 55 function testSetCustomObjectFormatterEnabled(next) { | |
| 56 Protocol.Runtime.onConsoleAPICalled(InspectorTest.logMessage); | |
| 57 Protocol.Runtime.setCustomObjectFormatterEnabled({ enabled: true }) | |
| 58 .then(() => InspectorTest.log('will reconnect..')) | |
| 59 .then(() => reconnect()) | |
| 60 .then(Protocol.Runtime.enable) | |
| 61 .then(() => Protocol.Runtime.evaluate({ expression: 'console.log({ name: 4 2 })'})) | |
| 62 .then(InspectorTest.logMessage) | |
| 63 .then(() => Protocol.Runtime.onConsoleAPICalled(null)) | |
| 64 .then(Protocol.Runtime.disable) | |
| 65 .then(next); | |
| 66 }, | |
| 67 ]); | |
| OLD | NEW |