OLD | NEW |
(Empty) | |
| 1 (async function(testRunner) { |
| 2 let {page, session, dp} = await testRunner.startBlank(''); |
| 3 |
| 4 var reportedExecutionContextId; |
| 5 dp.Runtime.onExecutionContextCreated(message => { |
| 6 if (message.params.context.auxData.frameId !== mainFrameId) |
| 7 return; |
| 8 if (message.params.context.auxData.isDefault === false && |
| 9 message.params.context.name === 'Test world') { |
| 10 reportedExecutionContextId = message.params.context.id; |
| 11 } else { |
| 12 testRunner.log('fail - main world created.'); |
| 13 testRunner.log(JSON.stringify(message.params)); |
| 14 testRunner.completeTest(); |
| 15 } |
| 16 }); |
| 17 |
| 18 await dp.Runtime.enable(); |
| 19 testRunner.log('Runtime enabled'); |
| 20 |
| 21 await dp.Page.enable(); |
| 22 testRunner.log('Page enabled'); |
| 23 |
| 24 var response = await dp.Page.getResourceTree(); |
| 25 var mainFrameId = response.result.frameTree.frame.id; |
| 26 testRunner.log('Main Frame obtained'); |
| 27 |
| 28 response = await dp.Page.createIsolatedWorld({frameId: mainFrameId, worldName:
'Test world'}); |
| 29 if (reportedExecutionContextId === response.result.executionContextId) |
| 30 testRunner.log('PASS - execution context id match.'); |
| 31 else |
| 32 testRunner.log('fail - execution context id differ.'); |
| 33 testRunner.completeTest(); |
| 34 }) |
OLD | NEW |