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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector-protocol/runtime/runtime-execution-contexts-events.js

Issue 2954093003: [DevTools] Migrate inspector-protocol/runtime tests to new harness (Closed)
Patch Set: fail: Created 3 years, 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 (async function(testRunner) {
2 let {page, session, dp} = await testRunner.startBlank(``);
3
4 dp.Runtime.enable();
5 await dp.Runtime.onceExecutionContextCreated();
6 testRunner.log('Page context was created');
7
8 testRunner.log('Create new frame');
9 var loadPromise = session.evaluateAsync(`
10 var frame = document.createElement('iframe');
11 frame.src = '${testRunner.url('../resources/blank.html')}';
12 frame.id = 'iframe';
13 document.body.appendChild(frame);
14 new Promise(resolve => frame.onload = resolve)
15 `);
16 var frameExecutionContextId = (await dp.Runtime.onceExecutionContextCreated()) .params.context.id;
17 testRunner.log('Frame context was created');
18
19 await loadPromise;
20 testRunner.log('Navigate frame');
21 session.evaluate(`window.frames[0].location = '${testRunner.url('../resources/ runtime-events-iframe.html')}'`);
22 var executionContextId = (await dp.Runtime.onceExecutionContextDestroyed()).pa rams.executionContextId;
23 if (frameExecutionContextId !== executionContextId) {
24 testRunner.fail(`Execution context with id = ${executionContextId} was destr oyed, but iframe's executionContext had id = ${frameExecutionContextId} before n avigation`);
25 return;
26 }
27 testRunner.log(`Frame's context was destroyed`);
28 frameExecutionContextId = 0;
29
30 frameExecutionContextId = (await dp.Runtime.onceExecutionContextCreated()).par ams.context.id;
31 testRunner.log('Frame context was created');
32
33 testRunner.log('Remove frame');
34 session.evaluate(`document.querySelector('#iframe').remove()`);
35 executionContextId = (await dp.Runtime.onceExecutionContextDestroyed()).params .executionContextId;
36 if (frameExecutionContextId !== executionContextId) {
37 testRunner.fail(`Deleted frame had execution context with id = ${frameExecut ionContextId}, but executionContext with id = ${executionContextId} was removed` );
38 return;
39 }
40 testRunner.log(`Frame's context was destroyed`);
41
42 testRunner.log('Create new crafted frame');
43 session.evaluate(`
44 var frame = document.createElement('iframe');
45 frame.src = '${testRunner.url('../resources/blank.html')}';
46 frame.id = 'crafted-iframe';
47 document.body.appendChild(frame);
48 frame.contentDocument.write('<div>crafted</div>');
49 frame.contentDocument.close();
50 `);
51
52 frameExecutionContextId = (await dp.Runtime.onceExecutionContextCreated()).par ams.context.id;
53 testRunner.log('Crafted frame context was created');
54
55 testRunner.log('Remove crafted frame');
56 session.evaluate(`document.querySelector('#crafted-iframe').remove()`);
57 executionContextId = (await dp.Runtime.onceExecutionContextDestroyed()).params .executionContextId;
58 if (frameExecutionContextId !== executionContextId) {
59 testRunner.fail(`Deleted frame had execution context with id = ${frameExecut ionContextId}, but executionContext with id = ${executionContextId} was removed` );
60 return;
61 }
62 testRunner.log(`Crafted frame's context was destroyed`);
63 testRunner.completeTest();
64 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698