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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector-protocol/page/createIsolatedWorld.html

Issue 2947303002: [DevTools] Migrate inspector-protocol/{page,dom-snapshot} tests to new harness (Closed)
Patch Set: rebased 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 <html>
2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource s/inspector-protocol-test.js"></script>
4 <script>
5
6 function test()
7 {
8 var mainFrameId = "";
9 var executionContextId;
10 var createIsolatedWorldReturnValue;
11 InspectorTest.eventHandler["Runtime.executionContextCreated"] =
12 function(message) {
13 if (message.params.context.auxData.frameId !== mainFrameId)
14 return;
15 if (message.params.context.auxData.isDefault === false &&
16 message.params.context.name === "Test world") {
17 executionContextId = message.params.context.id;
18 maybeFinish();
19 } else {
20 InspectorTest.log("fail - main world created.");
21 InspectorTest.log(JSON.stringify(message.params));
22 InspectorTest.completeTest();
23 }
24 };
25
26 function maybeFinish() {
27 if (!executionContextId || !createIsolatedWorldReturnValue)
28 return;
29 if (executionContextId === createIsolatedWorldReturnValue) {
30 InspectorTest.log("PASS - execution context id match.");
31 } else {
32 InspectorTest.log("fail - execution context id differ.");
33 }
34 InspectorTest.completeTest();
35 }
36
37 InspectorTest.sendCommandOrDie("Runtime.enable", {}, runtimeAgentEnabled);
38
39 function runtimeAgentEnabled() {
40 InspectorTest.log("Runtime enabled");
41
42 InspectorTest.sendCommandOrDie("Page.enable", {}, pageAgentEnabled);
43 }
44
45 function pageAgentEnabled() {
46 InspectorTest.log("Page enabled");
47 InspectorTest.sendCommandOrDie(
48 "Page.getResourceTree", {}, resourceTreeLoaded);
49 }
50
51 function resourceTreeLoaded(payload) {
52 mainFrameId = payload.frameTree.frame.id;
53 onMainFrameId(mainFrameId);
54 }
55
56 function onMainFrameId(mainFrameId) {
57 InspectorTest.log("Main Frame obtained");
58 InspectorTest.sendCommandOrDie("Page.createIsolatedWorld", {
59 frameId: mainFrameId, worldName: "Test world"},
60 isolatedWorldCreated);
61 }
62
63 function isolatedWorldCreated(payload) {
64 createIsolatedWorldReturnValue = payload.executionContextId;
65 maybeFinish();
66 }
67 }
68
69 </script>
70 </head>
71 <body onload="runTest()">
72 </body>
73 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698